summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConrad Kostecki <conrad@kostecki.com>2018-07-11 13:00:18 +0200
committerTony Vroon <chainsaw@gentoo.org>2018-07-11 12:17:45 +0100
commit98c36709a0e9bfd4e9c61f88b5383a780727a83d (patch)
treef15abf874b6cc723fa22cb36ca42178f6f649276 /games-server/minecraft-server/files
parentprofiles/license_groups: add Mojang license to EULA group (diff)
downloadgentoo-98c36709a0e9bfd4e9c61f88b5383a780727a83d.tar.gz
gentoo-98c36709a0e9bfd4e9c61f88b5383a780727a83d.tar.bz2
gentoo-98c36709a0e9bfd4e9c61f88b5383a780727a83d.zip
games-server/minecraft-server: New package
Closes: https://bugs.gentoo.org/652338 Package-Manager: Portage-2.3.41, Repoman-2.3.9
Diffstat (limited to 'games-server/minecraft-server/files')
-rw-r--r--games-server/minecraft-server/files/minecraft-server.confd7
-rw-r--r--games-server/minecraft-server/files/minecraft-server.initd48
2 files changed, 55 insertions, 0 deletions
diff --git a/games-server/minecraft-server/files/minecraft-server.confd b/games-server/minecraft-server/files/minecraft-server.confd
new file mode 100644
index 00000000000..700498e5aea
--- /dev/null
+++ b/games-server/minecraft-server/files/minecraft-server.confd
@@ -0,0 +1,7 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# 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 b/games-server/minecraft-server/files/minecraft-server.initd
new file mode 100644
index 00000000000..630c88871d7
--- /dev/null
+++ b/games-server/minecraft-server/files/minecraft-server.initd
@@ -0,0 +1,48 @@
+#!/sbin/openrc-run
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+if [ "${SVCNAME}" = "minecraft-server" ]; then
+ instance="main"
+else
+ instance="${SVCNAME#minecraft-server.}"
+fi
+
+java="${JAVA_HOME-/usr}"/bin/java
+minecraft_jar="/usr/share/games/minecraft-server/minecraft-server.jar"
+minecraft_logs="/var/log/minecraft-server"
+minecraft_path="/var/lib/minecraft-server/${instance}"
+name="Minecraft Server (World: ${instance})"
+pidfile="/run/minecraft-server.${instance}.pid"
+screen_name="minecraft-server.${instance}"
+start_stop_daemon_args="--chdir ${minecraft_path}"
+
+command="screen"
+command_args="-DmUS ${screen_name} ${java} ${MINECRAFT_OPTS} -jar ${minecraft_jar}"
+command_background="true"
+command_group="minecraft"
+command_user="minecraft"
+
+depend() {
+ use net
+}
+
+start_pre() {
+ checkpath -d -o "${command_user}:${command_group}" -q "${minecraft_path}"
+
+ checkpath -f -o "${command_user}:${command_group}" -q "${minecraft_path}"/eula.txt
+ echo "eula=true" > "${minecraft_path}"/eula.txt
+
+ checkpath -d -o "${command_user}:${command_group}" -q "${minecraft_logs}"/"${instance}"
+
+ if [ ! -L "${minecraft_path}"/logs ]; then
+ cd "$minecraft_path}" && ln -s ../../../log/minecraft-server/"${instance}" logs
+ fi
+
+ if [ -z ${MINECRAFT_OPTS} ]; then
+ eerror "You must define MINECRAFT_OPTS in /etc/conf.d/minecraft.${SVCNAME}!"
+ return 1
+ fi
+
+ return 0
+}