diff --git a/0.17/files/docker-entrypoint.sh b/0.17/files/docker-entrypoint.sh index 875745f..19253be 100755 --- a/0.17/files/docker-entrypoint.sh +++ b/0.17/files/docker-entrypoint.sh @@ -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" \