From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 3431B138359 for ; Sun, 23 Aug 2020 18:14:27 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id DFC97E083E; Sun, 23 Aug 2020 18:14:24 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 97B39E083E for ; Sun, 23 Aug 2020 18:14:24 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 64D9A335D92 for ; Sun, 23 Aug 2020 18:14:23 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id B5AEA330 for ; Sun, 23 Aug 2020 18:14:20 +0000 (UTC) From: "Conrad Kostecki" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Conrad Kostecki" Message-ID: <1598203305.12cf26ce1ef4d7712b2aba972d805aea7f6ca545.conikost@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: games-server/minecraft-server/files/, games-server/minecraft-server/ X-VCS-Repository: repo/gentoo X-VCS-Files: games-server/minecraft-server/files/README.gentoo-r1 games-server/minecraft-server/files/minecraft-server.confd-r1 games-server/minecraft-server/files/minecraft-server.initd-r4 games-server/minecraft-server/metadata.xml games-server/minecraft-server/minecraft-server-1.16.2-r1.ebuild X-VCS-Directories: games-server/minecraft-server/files/ games-server/minecraft-server/ X-VCS-Committer: conikost X-VCS-Committer-Name: Conrad Kostecki X-VCS-Revision: 12cf26ce1ef4d7712b2aba972d805aea7f6ca545 X-VCS-Branch: master Date: Sun, 23 Aug 2020 18:14:20 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: d4130978-a68e-44c4-aa7f-4a2ed19e6861 X-Archives-Hash: 9d68a88be88b61f2a3218dd791f05267 commit: 12cf26ce1ef4d7712b2aba972d805aea7f6ca545 Author: Conrad Kostecki gentoo org> AuthorDate: Sun Aug 23 16:51:05 2020 +0000 Commit: Conrad Kostecki gentoo org> CommitDate: Sun Aug 23 17:21:45 2020 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=12cf26ce games-server/minecraft-server: add custom attach command Since the minecraft-server is running as an interactive console process in background, this custom command 'attach' enables the possibility to connect with dtach to that interactive console and send commands to the running server. Closes: https://github.com/gentoo/gentoo/pull/15055 Package-Manager: Portage-3.0.4, Repoman-3.0.1 Signed-off-by: Conrad Kostecki gentoo.org> .../minecraft-server/files/README.gentoo-r1 | 26 +++++++++ .../files/minecraft-server.confd-r1 | 12 +++++ .../files/minecraft-server.initd-r4 | 62 ++++++++++++++++++++++ games-server/minecraft-server/metadata.xml | 14 ++++- .../minecraft-server-1.16.2-r1.ebuild | 49 +++++++++++++++++ 5 files changed, 162 insertions(+), 1 deletion(-) diff --git a/games-server/minecraft-server/files/README.gentoo-r1 b/games-server/minecraft-server/files/README.gentoo-r1 new file mode 100644 index 00000000000..903ef5a7d9d --- /dev/null +++ b/games-server/minecraft-server/files/README.gentoo-r1 @@ -0,0 +1,26 @@ +This package provides an init script and a conf file. +You don't have to modify those files directly, +but instead you can make a symlink of that init script +and a copy of that conf file. +You would do this for every server, you want to setup. + +For example, you wan't to setup an world called 'gentoo', +you would do: + +cd /etc/init.d +ln -s minecraft-server minecraft-server.gentoo + +cd /etc/conf.d +cp minecraft-server minecraft-server.gentoo + +After that, make your settings in +/etc/conf.d/minecraft-server.gentoo. + +If you don't make a symlink, but use the default scripts, +your world will be called 'main'. + +To interact with the console of the corresponding world, +you can use the extra command attach: + +rc-service minecraft-server attach +rc-service minecraft-server.gentoo attach diff --git a/games-server/minecraft-server/files/minecraft-server.confd-r1 b/games-server/minecraft-server/files/minecraft-server.confd-r1 new file mode 100644 index 00000000000..8b380349e9a --- /dev/null +++ b/games-server/minecraft-server/files/minecraft-server.confd-r1 @@ -0,0 +1,12 @@ +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +# Dtach options, which will used, when the `attach` extra command is called. +# By default, CTRL+D is used, and no redraw is done, +# when you want to detach from the attached console. +DTACH_OPTS="-e '^D' -r none" + +# Java options for your started server +# You should at least define some memory settings (-Xms, -Xmx), +# for maximum memory, as the java default is far to low for Minecraft +MINECRAFT_OPTS="-Xms1024m -Xmx1024m" diff --git a/games-server/minecraft-server/files/minecraft-server.initd-r4 b/games-server/minecraft-server/files/minecraft-server.initd-r4 new file mode 100644 index 00000000000..e81337a7d19 --- /dev/null +++ b/games-server/minecraft-server/files/minecraft-server.initd-r4 @@ -0,0 +1,62 @@ +#!/sbin/openrc-run +# Copyright 1999-2020 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}" +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/metadata.xml b/games-server/minecraft-server/metadata.xml index 8c681902aca..c3b4c421bb1 100644 --- a/games-server/minecraft-server/metadata.xml +++ b/games-server/minecraft-server/metadata.xml @@ -5,10 +5,22 @@ conikost@gentoo.org Conrad Kostecki - + Minecraft is a sandbox video game created and designed by Swedish game designer Markus "Notch" Persson, and later fully developed and published by Mojang. This is the headless server for Minecraft. + + Minecraft est un jeu vidéo bac à sable créé et conçu par + le développeur Markus Person (alias "Notch"), et plus + tard, pleinement maintenu et édité par Mojang. + Ceci est le serveur "headless" pour Minecraft. + + + https://bugs.mojang.com/projects/MC/issues + + Mojang + + diff --git a/games-server/minecraft-server/minecraft-server-1.16.2-r1.ebuild b/games-server/minecraft-server/minecraft-server-1.16.2-r1.ebuild new file mode 100644 index 00000000000..e219f388284 --- /dev/null +++ b/games-server/minecraft-server/minecraft-server-1.16.2-r1.ebuild @@ -0,0 +1,49 @@ +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +EGIT_COMMIT="c5f6fb23c3876461d46ec380421e42b289789530" +README_GENTOO_SUFFIX="-r1" + +inherit readme.gentoo-r1 java-pkg-2 + +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" + +LICENSE="Mojang" +SLOT="0" +KEYWORDS="~amd64 ~x86" + +RDEPEND=" + acct-group/minecraft + acct-user/minecraft + app-misc/dtach + || ( + >=virtual/jre-1.8 + >=virtual/jdk-1.8 + ) +" + +RESTRICT="bindist mirror" + +S="${WORKDIR}" + +src_unpack() { + cp "${DISTDIR}/${A}" "${WORKDIR}" || die +} + +src_install() { + java-pkg_newjar minecraft-server-${PV}.jar minecraft-server.jar + java-pkg_dolauncher minecraft-server --jar minecraft-server.jar --java_args "\${JAVA_OPTS}" + + newinitd "${FILESDIR}"/minecraft-server.initd-r4 minecraft-server + newconfd "${FILESDIR}"/minecraft-server.confd-r1 minecraft-server + + readme.gentoo_create_doc +} + +pkg_postinst() { + readme.gentoo_print_elog +}