Update docker-entrypoint.sh (#253)

This commit is contained in:
Osiris 2019-05-10 01:27:25 +02:00 committed by Florian Kinder
parent 010b96e0b0
commit b0cedbbe1b

View File

@ -29,7 +29,8 @@ if [ ! -f "$CONFIG/map-settings.json" ]; then
cp /opt/factorio/data/map-settings.example.json "$CONFIG/map-settings.json"
fi
if find -L "$SAVES" -iname \*.tmp.zip -mindepth 1 -print | grep -q .; then
NRTMPSAVES=$( find -L "$SAVES" -iname \*.tmp.zip -mindepth 1 | wc -l )
if [ $NRTMPSAVES -gt 0 ]; then
# Delete incomplete saves (such as after a forced exit)
rm -f "$SAVES/*.tmp.zip"
fi
@ -46,7 +47,8 @@ else
SU_EXEC=""
fi
if ! find -L "$SAVES" -iname \*.zip -mindepth 1 -print | grep -q .; then
NRSAVES=$( find -L "$SAVES" -iname \*.zip -mindepth 1 | wc -l )
if [ $NRSAVES -eq 0 ]; then
# Generate a new map if no save ZIPs exist
$SU_EXEC /opt/factorio/bin/x64/factorio \
--create "$SAVES/_autosave1.zip" \