summaryrefslogtreecommitdiff
blob: 5b0f749a4556c62484cceb6ae30da3ba73c34109 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=6

inherit user

DESCRIPTION="The official server for the sandbox video game Minecraft"
HOMEPAGE="https://www.minecraft.net/"
SRC_URI="https://s3.amazonaws.com/Minecraft.Download/versions/${PV}/minecraft_server.${PV}.jar -> ${P}.jar"

LICENSE="Mojang"
SLOT="0"
KEYWORDS="~amd64 ~x86"

RDEPEND="app-misc/screen
	virtual/jre"

RESTRICT="bindist mirror strip"

S="${WORKDIR}"

pkg_setup() {
	enewgroup minecraft
	enewuser minecraft -1 -1 /var/lib/minecraft-server minecraft
}

src_unpack() {
	# Don't unpack that jar, just copy it to WORKDIR
	cp "${DISTDIR}"/${A} "${WORKDIR}" || die
}

src_install() {
	insinto /usr/share/games/minecraft-server
	insopts -o minecraft -g minecraft
	newins minecraft-server-${PV}.jar minecraft-server.jar

	newinitd "${FILESDIR}"/minecraft-server.initd minecraft-server
	newconfd "${FILESDIR}"/minecraft-server.confd minecraft-server

	diropts -o minecraft -g minecraft
	keepdir /var/lib/minecraft-server
	keepdir /var/log/minecraft-server
}

pkg_postinst() {
	elog "This package provides an init script and a conf file."
	elog "You don't have to modify those files directly,"
	elog "but instead you can make a symlink of that init script"
	elog "and a copy of that conf file."
	elog "You would do this for every server, you want to setup."
	elog ""
	elog "For example, you wan't to setup an world called 'gentoo',"
	elog "you would do:"
	elog ""
	elog "cd /etc/init.d"
	elog "ln -s minecraft-server minecraft-server.gentoo"
	elog ""
	elog "cd /etc/conf.d"
	elog "cp minecraft-server minecraft-server.gentoo"
	elog ""
	elog "After that, make your settings in"
	elog "/etc/conf.d/minecraft-server.gentoo."
	elog ""
	elog "If you don't make a symlink, but use the default scripts,"
	elog "your world will be called 'main'"
}