From fd4e9d93e0c6402f33ee1fec67a10ec667960b6f Mon Sep 17 00:00:00 2001 From: Michael Reichenbach Date: Fri, 14 Dec 2018 08:13:19 +0100 Subject: [PATCH 1/4] feat(minecraft-server): update spigot plugins using /plugins if newer Deep copy and *.jar files in /plugins and update the corresponding files in the /data/plugins dir. --- minecraft-server/Dockerfile | 1 + minecraft-server/start-minecraftFinalSetup | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/minecraft-server/Dockerfile b/minecraft-server/Dockerfile index f8c1e526..f3d6e3ae 100644 --- a/minecraft-server/Dockerfile +++ b/minecraft-server/Dockerfile @@ -14,6 +14,7 @@ RUN apk add --no-cache -U \ jq \ mysql-client \ tzdata \ + rsync \ python python-dev py2-pip RUN pip install mcstatus diff --git a/minecraft-server/start-minecraftFinalSetup b/minecraft-server/start-minecraftFinalSetup index 4b5a026e..06b45a55 100755 --- a/minecraft-server/start-minecraftFinalSetup +++ b/minecraft-server/start-minecraftFinalSetup @@ -54,8 +54,12 @@ done if [ "$TYPE" = "SPIGOT" ]; then if [ -d /plugins ]; then + # Copy all of the plugins directory first to include initial configs echo Copying any Bukkit plugins over cp -r /plugins /data + # Copy plugins over using rsync to allow deeply nested updates of plugins + # only updates files if the source file is newer and print updated files + rsync -a --out-format="update:%f:Last Modified %M" --prune-empty-dirs --include '*/' --include '*.txt' --exclude '*' --update /plugins /data/plugins fi fi From c3ac69a030652f2dcb08e0a8764c3d6e2e960e69 Mon Sep 17 00:00:00 2001 From: Silthus Date: Fri, 14 Dec 2018 11:31:46 +0100 Subject: [PATCH 2/4] fix(minecraft-server): typo from testing - change txt to jar --- minecraft-server/start-minecraftFinalSetup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/minecraft-server/start-minecraftFinalSetup b/minecraft-server/start-minecraftFinalSetup index 06b45a55..a568845f 100755 --- a/minecraft-server/start-minecraftFinalSetup +++ b/minecraft-server/start-minecraftFinalSetup @@ -59,7 +59,7 @@ if [ "$TYPE" = "SPIGOT" ]; then cp -r /plugins /data # Copy plugins over using rsync to allow deeply nested updates of plugins # only updates files if the source file is newer and print updated files - rsync -a --out-format="update:%f:Last Modified %M" --prune-empty-dirs --include '*/' --include '*.txt' --exclude '*' --update /plugins /data/plugins + rsync -a --out-format="update:%f:Last Modified %M" --prune-empty-dirs --include '*/' --include '*.jar' --exclude '*' --update /plugins /data/plugins fi fi From ccec190cb27a366fb9a818c8b1e5d6ed8058294f Mon Sep 17 00:00:00 2001 From: Silthus Date: Sat, 15 Dec 2018 08:29:43 +0100 Subject: [PATCH 3/4] feat(minecraft-server): copy mods with rsync as well Mods are now copied the same as plugins, with rsync. Removed the old cp command. --- minecraft-server/start-minecraftFinalSetup | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/minecraft-server/start-minecraftFinalSetup b/minecraft-server/start-minecraftFinalSetup index a568845f..a5db1dd2 100755 --- a/minecraft-server/start-minecraftFinalSetup +++ b/minecraft-server/start-minecraftFinalSetup @@ -36,13 +36,11 @@ done # If any modules have been provided, copy them over mkdir -p /data/mods -for m in /mods/*.{jar,zip} -do - if [ -f "$m" -a ! -f "/data/mods/$m" ]; then - echo Copying mod `basename "$m"` - cp "$m" /data/mods - fi -done +if [ -d /mods ]; then + echo "Copying any mods over..." + rsync -a --out-format="update:%f:Last Modified %M" --prune-empty-dirs --include '*/' --include '*.jar' -include '*.zip' --exclude '*' --update /mods /data/mods +fi + [ -d /data/config ] || mkdir /data/config for c in /config/* do @@ -52,11 +50,10 @@ do fi done +mkdir -p /data/plugins if [ "$TYPE" = "SPIGOT" ]; then if [ -d /plugins ]; then - # Copy all of the plugins directory first to include initial configs - echo Copying any Bukkit plugins over - cp -r /plugins /data + echo "Copying any Bukkit plugins over..." # Copy plugins over using rsync to allow deeply nested updates of plugins # only updates files if the source file is newer and print updated files rsync -a --out-format="update:%f:Last Modified %M" --prune-empty-dirs --include '*/' --include '*.jar' --exclude '*' --update /plugins /data/plugins From 0d9c2d13f96285e3388ddcca93331735e6619efb Mon Sep 17 00:00:00 2001 From: Silthus Date: Sat, 15 Dec 2018 08:56:05 +0100 Subject: [PATCH 4/4] fix(minecraft-server): copy plugins and mods to parent dir Using rsync will already create a subdir inside the /data volume do not create an extra layer. --- minecraft-server/start-minecraftFinalSetup | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/minecraft-server/start-minecraftFinalSetup b/minecraft-server/start-minecraftFinalSetup index a5db1dd2..e9590e1e 100755 --- a/minecraft-server/start-minecraftFinalSetup +++ b/minecraft-server/start-minecraftFinalSetup @@ -38,7 +38,7 @@ done mkdir -p /data/mods if [ -d /mods ]; then echo "Copying any mods over..." - rsync -a --out-format="update:%f:Last Modified %M" --prune-empty-dirs --include '*/' --include '*.jar' -include '*.zip' --exclude '*' --update /mods /data/mods + rsync -a --out-format="update:%f:Last Modified %M" --prune-empty-dirs --include '*/' --include '*.jar' -include '*.zip' --exclude '*' --update /mods /data fi [ -d /data/config ] || mkdir /data/config @@ -56,7 +56,7 @@ if [ "$TYPE" = "SPIGOT" ]; then echo "Copying any Bukkit plugins over..." # Copy plugins over using rsync to allow deeply nested updates of plugins # only updates files if the source file is newer and print updated files - rsync -a --out-format="update:%f:Last Modified %M" --prune-empty-dirs --include '*/' --include '*.jar' --exclude '*' --update /plugins /data/plugins + rsync -a --out-format="update:%f:Last Modified %M" --prune-empty-dirs --include '*/' --include '*.jar' --exclude '*' --update /plugins /data fi fi