games-server/minecraft-server: Java 11 is needed

Package-Manager: Portage-3.0.18, Repoman-3.0.2
Signed-off-by: Alarig Le Lay <alarig@swordarmor.fr>
This commit is contained in:
Alarig Le Lay 2021-06-15 19:37:52 +02:00
parent 5677497a80
commit b21a56e9fc
Signed by: alarig
GPG key ID: 7AFE62C6DF8BCDEC
3 changed files with 2 additions and 59 deletions

View file

@ -1,7 +0,0 @@
# Copyright 1999-2020 Gentoo Authors
# 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"

View file

@ -1,47 +0,0 @@
#!/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}'"
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/minecraft.${SVCNAME}!"
return 1
fi
}

View file

@ -14,16 +14,12 @@ SRC_URI="https://launcher.mojang.com/v1/objects/${EGIT_COMMIT}/server.jar -> ${P
LICENSE="Mojang"
SLOT="0"
KEYWORDS="~amd64 ~arm64 ~x86"
RDEPEND="
acct-group/minecraft
acct-user/minecraft
app-misc/dtach
|| (
>=virtual/jre-1.8
>=virtual/jdk-1.8
)
dev-java/openjdk-bin:11[gentoo-vm]
"
RESTRICT="bindist mirror"
@ -50,5 +46,6 @@ src_install() {
}
pkg_postinst() {
sed -i '$i gjl_vm="openjdk-bin-11"' "${EROOT}/usr/bin/minecraft-server"
readme.gentoo_print_elog
}