2017-11-01 05:42:44 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-09-12 01:38:54 +00:00
|
|
|
worldDest=/data/$LEVEL
|
|
|
|
|
2017-11-01 05:42:44 +00:00
|
|
|
# If supplied with a URL for a world, download it and unpack
|
|
|
|
if [[ "$WORLD" ]]; then
|
|
|
|
case "X$WORLD" in
|
|
|
|
X[Hh][Tt][Tt][Pp]*)
|
2018-07-29 18:41:00 +00:00
|
|
|
echo "Downloading world from $WORLD"
|
2018-06-26 00:13:47 +00:00
|
|
|
curl -sSL -o - "$WORLD" > /data/world.zip
|
2018-07-29 18:41:00 +00:00
|
|
|
echo "Unzipping world"
|
2018-08-24 15:36:41 +00:00
|
|
|
unzip -o -q /data/world.zip
|
2017-11-01 05:42:44 +00:00
|
|
|
rm -f /data/world.zip
|
2018-09-12 01:38:54 +00:00
|
|
|
if [ ! -d $worldDest ]; then
|
2017-11-01 05:42:44 +00:00
|
|
|
echo World directory not found
|
|
|
|
for i in /data/*/level.dat; do
|
|
|
|
if [ -f "$i" ]; then
|
|
|
|
d=`dirname "$i"`
|
|
|
|
echo Renaming world directory from $d
|
2018-09-12 01:38:54 +00:00
|
|
|
mv -f "$d" $worldDest
|
2017-11-01 05:42:44 +00:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
if [ "$TYPE" = "SPIGOT" ]; then
|
|
|
|
# Reorganise if a Spigot server
|
|
|
|
echo "Moving End and Nether maps to Spigot location"
|
2018-09-12 01:38:54 +00:00
|
|
|
[ -d "$worldDest/DIM1" ] && mv -f "$worldDest/DIM1" "/data/${LEVEL}_the_end"
|
|
|
|
[ -d "$worldDest/DIM-1" ] && mv -f "$worldDest/DIM-1" "/data/${LEVEL}_nether"
|
2017-11-01 05:42:44 +00:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
*)
|
2018-09-12 01:38:54 +00:00
|
|
|
if [[ -d $WORLD ]]; then
|
|
|
|
if [[ ! -d $worldDest ]]; then
|
|
|
|
echo "Cloning world directory from $WORLD ..."
|
|
|
|
cp -r $WORLD $worldDest
|
|
|
|
else
|
|
|
|
echo "Skipping clone from $WORLD since $worldDest exists"
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "Invalid URL given for world: Must be HTTP or HTTPS and a ZIP file"
|
|
|
|
fi
|
2017-11-01 05:42:44 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
|
|
|
exec /start-finalSetup02Modpack $@
|