summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConrad Kostecki <conikost@gentoo.org>2021-12-05 21:48:18 +0100
committerConrad Kostecki <conikost@gentoo.org>2021-12-05 22:45:09 +0100
commitecb57aff97af9b05af6ae1b92096bf7234cfc104 (patch)
tree48708191e7e8a698b10c2c83b73a30a385b45357
parentsys-apps/cpuid: drop 20211121 (diff)
downloadgentoo-ecb57aff97af9b05af6ae1b92096bf7234cfc104.tar.gz
gentoo-ecb57aff97af9b05af6ae1b92096bf7234cfc104.tar.bz2
gentoo-ecb57aff97af9b05af6ae1b92096bf7234cfc104.zip
games-server/minecraft-server: add 1.18
Signed-off-by: Conrad Kostecki <conikost@gentoo.org>
-rw-r--r--games-server/minecraft-server/Manifest1
-rw-r--r--games-server/minecraft-server/files/minecraft-server.initd-r562
-rw-r--r--games-server/minecraft-server/minecraft-server-1.18.ebuild54
3 files changed, 117 insertions, 0 deletions
diff --git a/games-server/minecraft-server/Manifest b/games-server/minecraft-server/Manifest
index f752d9b23835..0d4cb060fd8b 100644
--- a/games-server/minecraft-server/Manifest
+++ b/games-server/minecraft-server/Manifest
@@ -1,2 +1,3 @@
DIST minecraft-server-1.16.5.jar 37962360 BLAKE2B 355715b809c09581e457f54618bd6ddab91b1c488d709d402fa6690d32244298d44191d439b8d9f27f4853f7e7658bfa2db88b61697a1caeb66da76ab211d9f8 SHA512 8321c50d788c6a3a3e8b2146bf1b20f6a3da87dd21ec4bd1fda0031d26f728d64e56a6a230ba5d857f4d500d7ba281eb4e3c28b6715f29d8dcba79d8c0ddf03f
DIST minecraft-server-1.17.1.jar 43626592 BLAKE2B f926c01890faf6904eb38ea14f1affddd32dbe992c4df9d125507325fa11ec98eeaa63622387a3608d89bbf2602a447efc8560a49b24ba517ed55bf2fd18fac9 SHA512 fe6e48e2cee38224d2c88f04c19afca9c21fddbe6077b5538e0a0581c2f6c4478ec99bc369bec5131d709b89273dbd769659f149163f0c284b518a38e58a5bcc
+DIST minecraft-server-1.18.jar 46323386 BLAKE2B f603477f69b0c675cff45585329dfd97f94343655946475b81d272e1ce27e08d79d3f9bdc07a476cfe2794602eaa83e353ebecdbc61043ff4f4b335a55639f08 SHA512 be8face6d0ad94578afa520eb0eecde31c1e3ea711a6f5349e0fa1a26e95069cc3a409435e37adc6a3d871a82ddfb86de8af3395c06b11148921058c220b03d0
diff --git a/games-server/minecraft-server/files/minecraft-server.initd-r5 b/games-server/minecraft-server/files/minecraft-server.initd-r5
new file mode 100644
index 000000000000..bfaad750b8c7
--- /dev/null
+++ b/games-server/minecraft-server/files/minecraft-server.initd-r5
@@ -0,0 +1,62 @@
+#!/sbin/openrc-run
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+if [ "${SVCNAME}" = "minecraft-server" ]; then
+ instance="main"
+else
+ instance="${SVCNAME#minecraft-server.}"
+fi
+
+dtach_tmpfile="$(mktemp -u)"
+minecraft_command="/usr/bin/minecraft-server"
+minecraft_logs="/var/log/minecraft-server"
+minecraft_logs_instance="${minecraft_logs}/${instance}"
+minecraft_path="/var/lib/minecraft-server"
+minecraft_path_instance="${minecraft_path}/${instance}"
+name="Minecraft Server (World: ${instance})"
+pidfile="/run/minecraft-server.${instance}.pid"
+start_stop_daemon_args="--chdir ${minecraft_path_instance} --env JAVA_OPTS='${MINECRAFT_OPTS}'"
+
+description_attach="Attaches to the session (interactive console) of the Minecraft server"
+extra_started_commands="attach"
+
+command="/usr/bin/dtach"
+command_background="true"
+command_args="-N ${dtach_tmpfile} ${minecraft_command} ${MINECRAFT_OPTS}"
+command_group="minecraft"
+command_user="minecraft"
+
+depend() {
+ use net
+}
+
+start_pre() {
+ checkpath -d -o "${command_user}:${command_group}" -q "${minecraft_path}" "${minecraft_path_instance}"
+
+ checkpath -f -o "${command_user}:${command_group}" -q "${minecraft_path_instance}"/eula.txt
+ echo "eula=true" > "${minecraft_path_instance}"/eula.txt
+
+ checkpath -d -o "${command_user}:${command_group}" -q "${minecraft_logs}" "${minecraft_logs_instance}"
+
+ if [ ! -L "${minecraft_path_instance}"/logs ]; then
+ cd "${minecraft_path_instance}" && ln -s ../../../log/minecraft-server/"${instance}" logs
+ fi
+
+ if [ -z "${MINECRAFT_OPTS}" ]; then
+ eerror "You must define 'MINECRAFT_OPTS' in '/etc/conf.d/${SVCNAME}'!"
+ return 1
+ fi
+}
+
+attach() {
+ pidnumber="$(cat ${pidfile})"
+ dtach_tmpfile="$(cat /proc/${pidnumber}/cmdline | tr '\0' ' ' | awk '{print $3}')"
+
+ if [ -S "${dtach_tmpfile}" ]; then
+ eval "${command}" -a "${dtach_tmpfile}" "${DTACH_OPTS}"
+ else
+ eerror "The determined socket file for dtach could not be found!"
+ eerror "Did the process crash?"
+ fi
+}
diff --git a/games-server/minecraft-server/minecraft-server-1.18.ebuild b/games-server/minecraft-server/minecraft-server-1.18.ebuild
new file mode 100644
index 000000000000..0cb12a0680d7
--- /dev/null
+++ b/games-server/minecraft-server/minecraft-server-1.18.ebuild
@@ -0,0 +1,54 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+EGIT_COMMIT="3cf24a8694aca6267883b17d934efacc5e44440d"
+README_GENTOO_SUFFIX="-r1"
+
+inherit readme.gentoo-r1 java-pkg-2 systemd
+
+DESCRIPTION="The official server for the sandbox video game"
+HOMEPAGE="https://www.minecraft.net/"
+SRC_URI="https://launcher.mojang.com/v1/objects/${EGIT_COMMIT}/server.jar -> ${P}.jar"
+S="${WORKDIR}"
+
+LICENSE="Mojang"
+SLOT="0"
+KEYWORDS="~amd64 ~arm64 ~x86"
+RESTRICT="bindist mirror"
+
+
+RDEPEND="
+ acct-group/minecraft
+ acct-user/minecraft
+ app-misc/dtach
+ || (
+ dev-java/openjdk:17
+ dev-java/openjdk-bin:17
+ )
+"
+
+src_unpack() {
+ cp "${DISTDIR}/${A}" "${WORKDIR}" || die
+}
+
+src_compile() {
+ :;
+}
+
+src_install() {
+ newbin "${FILESDIR}"/minecraft-server-bin minecraft-server
+
+ java-pkg_newjar minecraft-server-${PV}.jar minecraft-server.jar
+
+ newinitd "${FILESDIR}"/minecraft-server.initd-r5 minecraft-server
+ newconfd "${FILESDIR}"/minecraft-server.confd-r1 minecraft-server
+ systemd_newunit "${FILESDIR}"/minecraft-server.service minecraft-server@.service
+
+ readme.gentoo_create_doc
+}
+
+pkg_postinst() {
+ readme.gentoo_print_elog
+}