2017-11-01 05:42:44 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2020-03-06 15:52:17 +00:00
|
|
|
. /start-utils
|
|
|
|
|
2019-01-09 00:28:34 +00:00
|
|
|
if [ $TYPE = "FEED-THE-BEAST" ]; then
|
|
|
|
worldDest=$FTB_BASE_DIR/$LEVEL
|
|
|
|
else
|
|
|
|
worldDest=/data/$LEVEL
|
|
|
|
fi
|
2018-09-12 01:38:54 +00:00
|
|
|
|
2018-10-07 12:01:08 +00:00
|
|
|
# If no world exists and a URL for a world is supplied, download it and unpack
|
2018-10-18 04:17:32 +00:00
|
|
|
if [[ "$WORLD" ]] && [ ! -d "$worldDest" ]; then
|
2017-11-01 05:42:44 +00:00
|
|
|
case "X$WORLD" in
|
|
|
|
X[Hh][Tt][Tt][Pp]*)
|
2020-03-06 15:52:17 +00:00
|
|
|
log "Downloading world from $WORLD"
|
2018-06-26 00:13:47 +00:00
|
|
|
curl -sSL -o - "$WORLD" > /data/world.zip
|
2020-03-06 15:52:17 +00:00
|
|
|
log "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
|
2020-03-06 15:52:17 +00:00
|
|
|
log World directory not found
|
2017-11-01 05:42:44 +00:00
|
|
|
for i in /data/*/level.dat; do
|
|
|
|
if [ -f "$i" ]; then
|
|
|
|
d=`dirname "$i"`
|
2020-03-06 15:52:17 +00:00
|
|
|
log 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
|
2020-03-06 15:52:17 +00:00
|
|
|
log "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
|
|
|
|
;;
|
|
|
|
*)
|
2020-04-06 23:59:26 +00:00
|
|
|
if [[ -d "$WORLD" ]]; then
|
|
|
|
if [[ ! -d "$worldDest" ]]; then
|
2020-03-06 15:52:17 +00:00
|
|
|
log "Cloning world directory from $WORLD ..."
|
2020-04-06 23:59:26 +00:00
|
|
|
cp -r "$WORLD" "$worldDest"
|
2018-09-12 01:38:54 +00:00
|
|
|
else
|
2020-03-06 15:52:17 +00:00
|
|
|
log "Skipping clone from $WORLD since $worldDest exists"
|
2018-09-12 01:38:54 +00:00
|
|
|
fi
|
|
|
|
else
|
2020-04-06 23:59:26 +00:00
|
|
|
log "World cloning source '$WORLD' doesn't seem to exist"
|
|
|
|
exit 1
|
2018-09-12 01:38:54 +00:00
|
|
|
fi
|
2017-11-01 05:42:44 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
|
|
|
exec /start-finalSetup02Modpack $@
|