From 7f62ce4df6286e589dc99d619f11b2a9225d4b4a Mon Sep 17 00:00:00 2001 From: MrLetsplay2003 Date: Sun, 23 Apr 2023 12:57:32 +0200 Subject: [PATCH] Update docker images --- paper/bin/configure_and_start | 19 +++---------------- paper/bin/update_paper | 15 +++++++++++++++ velocity-compose/.env | 4 ++-- velocity-compose/docker-compose.yml | 6 +++--- velocity/bin/configure_and_start | 20 ++++---------------- velocity/bin/update_velocity | 15 +++++++++++++++ 6 files changed, 42 insertions(+), 37 deletions(-) create mode 100755 paper/bin/update_paper create mode 100755 velocity/bin/update_velocity diff --git a/paper/bin/configure_and_start b/paper/bin/configure_and_start index 93415df..fa28523 100755 --- a/paper/bin/configure_and_start +++ b/paper/bin/configure_and_start @@ -46,26 +46,13 @@ EOF echo "eula=true" > eula.txt - mkdir -p "$meta_dir" && touch "$meta_dir/setup_done" + mkdir -p "$meta_dir" && touch "$meta_dir/config_done" else echo "Configuration is done" fi -if test "$PAPER_DONT_DOWNLOAD_ON_START" != "true"; then - echo $MC_VERSION - version=$MC_VERSION - echo "Downloading version $version" - - apiURL=https://api.papermc.io/v2/projects/paper - - build=$(curl -X GET $apiURL/versions/$version/builds | jq -r ".builds[-1].build") - echo "Build is $build" - - url=$apiURL/versions/$version/builds/$build/downloads/paper-$version-$build.jar - echo "Full URL is: $url" - - echo "Downloading to $PWD" - wget -O paper.jar $url +if test ! -f "paper.jar" -o "$PAPER_UPDATE_ON_START" == "true"; then + update_paper else echo "Skipping Paper download" fi diff --git a/paper/bin/update_paper b/paper/bin/update_paper new file mode 100755 index 0000000..f4eea4d --- /dev/null +++ b/paper/bin/update_paper @@ -0,0 +1,15 @@ +#!/bin/sh + +version=$MC_VERSION +echo "Updating Paper version $version" + +apiURL=https://api.papermc.io/v2/projects/paper + +build=$(curl -X GET "$apiURL/versions/$version/builds" | jq -r ".builds[-1].build") +echo "Build is $build" + +url="$apiURL/versions/$version/builds/$build/downloads/paper-$version-$build.jar" +echo "Full URL is: $url" + +echo "Downloading to $PWD" +wget -O paper.jar "$url" diff --git a/velocity-compose/.env b/velocity-compose/.env index 258f09c..6178fef 100644 --- a/velocity-compose/.env +++ b/velocity-compose/.env @@ -3,5 +3,5 @@ UID=1000 GID=1000 VELOCITY_ENABLE=true VELOCITY_SECRET=REPLACE_THIS_WITH_A_RANDOM_SECRET -PAPER_DONT_DOWNLOAD_ON_START=false -VELOCITY_DONT_DOWNLOAD_ON_START=false +PAPER_UPDATE_ON_START=false +VELOCITY_UPDATE_ON_START=false diff --git a/velocity-compose/docker-compose.yml b/velocity-compose/docker-compose.yml index 2679589..5cf7459 100644 --- a/velocity-compose/docker-compose.yml +++ b/velocity-compose/docker-compose.yml @@ -11,7 +11,7 @@ services: - velocity environment: - "VELOCITY_SECRET=${VELOCITY_SECRET}" - - "VELOCITY_DONT_DOWNLOAD_ON_START=${VELOCITY_DONT_DOWNLOAD_ON_START}" + - "VELOCITY_UPDATE_ON_START=${VELOCITY_UPDATE_ON_START}" server1: image: mrletsplay/paper:1.19.4 stdin_open: true @@ -24,7 +24,7 @@ services: - "EULA=${EULA}" - "VELOCITY_ENABLE=${VELOCITY_ENABLE}" - "VELOCITY_SECRET=${VELOCITY_SECRET}" - - "PAPER_DONT_DOWNLOAD_ON_START=${PAPER_DONT_DOWNLOAD_ON_START}" + - "PAPER_UPDATE_ON_START=${PAPER_UPDATE_ON_START}" server2: image: mrletsplay/paper:1.18.2 stdin_open: true @@ -37,6 +37,6 @@ services: - "EULA=${EULA}" - "VELOCITY_ENABLE=${VELOCITY_ENABLE}" - "VELOCITY_SECRET=${VELOCITY_SECRET}" - - "PAPER_DONT_DOWNLOAD_ON_START=${PAPER_DONT_DOWNLOAD_ON_START}" + - "PAPER_UPDATE_ON_START=${PAPER_UPDATE_ON_START}" networks: velocity: diff --git a/velocity/bin/configure_and_start b/velocity/bin/configure_and_start index c48a60e..c4665dd 100755 --- a/velocity/bin/configure_and_start +++ b/velocity/bin/configure_and_start @@ -2,25 +2,13 @@ meta_dir="docker_meta" -apiURL=https://api.papermc.io/v2/projects/velocity - -if test "$VELOCITY_DONT_DOWNLOAD_ON_START" != "true"; then - version=$(curl -X GET $apiURL | jq -r ".versions[-1]") - echo "Version is $version" - - build=$(curl -X GET $apiURL/versions/$version/builds | jq -r ".builds[-1].build") - echo "Build is $build" - - url=$apiURL/versions/$version/builds/$build/downloads/velocity-$version-$build.jar - echo "Full URL is: $url" - - echo "Downloading to $PWD" - wget -O velocity.jar $url +if test ! -f "velocity.jar" -o "$VELOCITY_UPDATE_ON_START" == "true"; then + update_velocity else echo "Skipping Velocity download" fi -if test ! -f "$meta_dir/setup_done"; then +if test ! -f "$meta_dir/config_done"; then if test "$VELOCITY_SECRET" = "REPLACE_THIS_WITH_A_RANDOM_SECRET"; then echo "Refusing to configure Velocity with insecure secret" exit 1 @@ -33,7 +21,7 @@ if test ! -f "$meta_dir/setup_done"; then echo shutdown | java -jar velocity.jar sed -i 's/player-info-forwarding-mode.*$/player-info-forwarding-mode = "MODERN"/g' velocity.toml - mkdir -p "$meta_dir" && touch "$meta_dir/setup_done" + mkdir -p "$meta_dir" && touch "$meta_dir/config_done" else echo "Setup is done" fi diff --git a/velocity/bin/update_velocity b/velocity/bin/update_velocity new file mode 100755 index 0000000..4eeff04 --- /dev/null +++ b/velocity/bin/update_velocity @@ -0,0 +1,15 @@ +#!/bin/sh + +apiURL=https://api.papermc.io/v2/projects/velocity + +version=$(curl -X GET $apiURL | jq -r ".versions[-1]") +echo "Version is $version" + +build=$(curl -X GET "$apiURL/versions/$version/builds" | jq -r ".builds[-1].build") +echo "Build is $build" + +url="$apiURL/versions/$version/builds/$build/downloads/velocity-$version-$build.jar" +echo "Full URL is: $url" + +echo "Downloading to $PWD" +wget -O velocity.jar "$url"