|
@ -5,18 +5,30 @@ MINECRAFT_PATH="$SERVICE_CONFIGSTORE/opt/apps/minecraft" |
|
|
MINECRAFT_DATA="/var/lib/minecraft" |
|
|
MINECRAFT_DATA="/var/lib/minecraft" |
|
|
|
|
|
|
|
|
minecraft:init-binary() { |
|
|
minecraft:init-binary() { |
|
|
local version="$1" |
|
|
|
|
|
|
|
|
|
|
|
MINECRAFT_BINARY="${MINECRAFT_PATH}/minecraft_server.${version}.jar" |
|
|
|
|
|
|
|
|
local type="$1" version="$2" |
|
|
|
|
|
|
|
|
|
|
|
case "$type" in |
|
|
|
|
|
"legacy") |
|
|
|
|
|
MINECRAFT_URL="https://docker.0k.io/downloads/minecraft_server.${version}.jar" |
|
|
|
|
|
MINECRAFT_BINARY="minecraft_server.${version}.jar" |
|
|
|
|
|
;; |
|
|
|
|
|
"paper") |
|
|
|
|
|
MINECRAFT_URL="https://api.papermc.io/v2/projects/paper/versions/${version%-*}/builds/${version##*-}/downloads/paper-${version}.jar" |
|
|
|
|
|
MINECRAFT_BINARY="paper.${version}.jar" |
|
|
|
|
|
;; |
|
|
|
|
|
*) |
|
|
|
|
|
err "Unknown ${WHITE}type${NORMAL} '$type'. Please use on of: legacy, paper" |
|
|
|
|
|
exit 1 |
|
|
|
|
|
;; |
|
|
|
|
|
esac |
|
|
if ! [ -f "$MINECRAFT_BINARY" ]; then |
|
|
if ! [ -f "$MINECRAFT_BINARY" ]; then |
|
|
mkdir -p "${MINECRAFT_PATH}" |
|
|
mkdir -p "${MINECRAFT_PATH}" |
|
|
wget "https://docker.0k.io/downloads/minecraft_server.${version}.jar" \ |
|
|
|
|
|
-O "$MINECRAFT_BINARY" |
|
|
|
|
|
|
|
|
wget "$MINECRAFT_URL" -O "$MINECRAFT_PATH/$MINECRAFT_BINARY" || exit 1 |
|
|
fi |
|
|
fi |
|
|
init-config-add " |
|
|
init-config-add " |
|
|
$SERVICE_NAME: |
|
|
$SERVICE_NAME: |
|
|
volumes: |
|
|
volumes: |
|
|
- \"${MINECRAFT_BINARY}:${MINECRAFT_DATA}/server.jar\" |
|
|
|
|
|
|
|
|
- \"$MINECRAFT_PATH/${MINECRAFT_BINARY}:${MINECRAFT_DATA}/server.jar\" |
|
|
" |
|
|
" |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|