From b0cedbbe1b65fdf79df0d3b3c5f64262d45bd134 Mon Sep 17 00:00:00 2001 From: Osiris Date: Fri, 10 May 2019 01:27:25 +0200 Subject: [PATCH] Update docker-entrypoint.sh (#253) --- 0.17/files/docker-entrypoint.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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" \