diff options
author | Conrad Kostecki <conikost@gentoo.org> | 2019-12-09 22:26:45 +0100 |
---|---|---|
committer | Conrad Kostecki <conikost@gentoo.org> | 2019-12-09 23:05:21 +0100 |
commit | 3d7697a27cbdced6bde3745893b8bbe8cbc0e158 (patch) | |
tree | a4dd464cf0524299e6dafbcf8dccc3814338f868 /games-server/bedrock-server/files | |
parent | acct-user/bedrock: add user for games-server/bedrock-server (diff) | |
download | gentoo-3d7697a27cbdced6bde3745893b8bbe8cbc0e158.tar.gz gentoo-3d7697a27cbdced6bde3745893b8bbe8cbc0e158.tar.bz2 gentoo-3d7697a27cbdced6bde3745893b8bbe8cbc0e158.zip |
games-server/bedrock-server: New package
This is the official minecraft server, which can be used with all
editions, which are based on the bedrock engine. It is not compatible
with the minecraft java edition.
Closes: https://github.com/gentoo/gentoo/pull/11857
Package-Manager: Portage-2.3.81, Repoman-2.3.20
Signed-off-by: Conrad Kostecki <conikost@gentoo.org>
Diffstat (limited to 'games-server/bedrock-server/files')
-rw-r--r-- | games-server/bedrock-server/files/bedrock-server.initd | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/games-server/bedrock-server/files/bedrock-server.initd b/games-server/bedrock-server/files/bedrock-server.initd new file mode 100644 index 000000000000..9157b610a1f4 --- /dev/null +++ b/games-server/bedrock-server/files/bedrock-server.initd @@ -0,0 +1,47 @@ +#!/sbin/openrc-run +# Copyright 1999-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +if [ "${SVCNAME}" = "bedrock-server" ]; then + instance="main" +else + instance="${SVCNAME#*.}" +fi + +bedrock_command="/opt/bin/bedrock-server" +bedrock_path="/var/lib/bedrock-server" +bedrock_path_data="/opt/bedrock-server" +bedrock_path_instance="${bedrock_path}/${instance}" +name="Minecraft Bedrock server (${instance})" +pidfile="/run/bedrock-server.${instance}.pid" +screen_name="bedrock-server.${instance}" +start_stop_daemon_args="--chdir ${bedrock_path_instance}" + +command="/usr/bin/screen" +command_args="-DmUS ${screen_name} ${bedrock_command}" +command_background="true" +command_group="bedrock" +command_user="bedrock" + +depend() { + use net +} + +start_pre() { + checkpath -d -o "${command_user}:${command_group}" -q "${bedrock_path}" "${bedrock_path_instance}" + + local bedrock_configs=( "permissions.json" "server.properties" "whitelist.json" ) + for bedrock_config in ${bedrock_configs[@]}; do + if [ ! -f "${bedrock_path_instance}/${bedrock_config}" ]; then + cp "${bedrock_path_data}/${bedrock_config}" "${bedrock_path_instance}" + checkpath -f -o "${command_user}:${command_group}" -q "${bedrock_path_instance}/${bedrock_config}" + fi + done + + local bedrock_ressources=( "behavior_packs" "definitions" "resource_packs" "structures" ) + for bedrock_ressource in ${bedrock_ressources[@]}; do + if [ ! -L "${bedrock_path_instance}/${bedrock_ressource}" ]; then + ln -sf "${bedrock_path_data}/${bedrock_ressource}" "${bedrock_path_instance}" + fi + done +} |