From 491abfc833c30910e5ef0ffdc6dffcc0a9161bd1 Mon Sep 17 00:00:00 2001 From: Matthew Crowson Date: Sat, 13 Oct 2018 12:31:28 -0400 Subject: [PATCH 1/2] using find to match json files --- 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 8357ec2d..7b0e3562 100755 --- a/minecraft-server/start-minecraftFinalSetup +++ b/minecraft-server/start-minecraftFinalSetup @@ -24,7 +24,7 @@ if [ -n "$ICON" -a ! -e server-icon.png ]; then fi # Make sure files exist and are valid JSON (for pre-1.12 to 1.12 upgrades) -if [[ -z "ls *.json" ]]; then +if [[ ! -z "find . -name '$*.json'" ]]; then echo "Checking JSON files" for j in *.json; do if [[ $(python -c "print open('$j').read().strip()==''") = True ]]; then From a4a22f3bfc5164ec19336452a250bbd7d6557191 Mon Sep 17 00:00:00 2001 From: Matthew Crowson Date: Sun, 14 Oct 2018 13:47:39 -0400 Subject: [PATCH 2/2] loops only if there are JSON files present --- minecraft-server/start-minecraftFinalSetup | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/minecraft-server/start-minecraftFinalSetup b/minecraft-server/start-minecraftFinalSetup index 7b0e3562..4b5a026e 100755 --- a/minecraft-server/start-minecraftFinalSetup +++ b/minecraft-server/start-minecraftFinalSetup @@ -24,17 +24,15 @@ if [ -n "$ICON" -a ! -e server-icon.png ]; then fi # Make sure files exist and are valid JSON (for pre-1.12 to 1.12 upgrades) -if [[ ! -z "find . -name '$*.json'" ]]; then - echo "Checking JSON files" - for j in *.json; do - if [[ $(python -c "print open('$j').read().strip()==''") = True ]]; then - echo "Fixing JSON $j" - echo '[]' > $j - fi - done -else - echo "Skipping JSON check. No files present." -fi +echo "Checking for JSON files." +JSON_FILES=$(find . -name '*.json') +for j in $JSON_FILES; do + if [[ $(python -c "print open('$j').read().strip()==''") = True ]]; then + echo "Fixing JSON $j" + echo '[]' > $j + fi +done + # If any modules have been provided, copy them over mkdir -p /data/mods