generate map as factorio user

This commit is contained in:
David Andersen 2019-02-27 19:45:13 +00:00
parent 3e7c79ab74
commit 8e7bca222a

View File

@ -35,24 +35,24 @@ if find -L $SAVES -iname \*.tmp.zip -mindepth 1 -print | grep -q .; then
rm -f $SAVES/*.tmp.zip rm -f $SAVES/*.tmp.zip
fi fi
if ! find -L $SAVES -iname \*.zip -mindepth 1 -print | grep -q .; then
# Generate a new map if no save ZIPs exist
/opt/factorio/bin/x64/factorio \
--create $SAVES/_autosave1.zip \
--map-gen-settings $CONFIG/map-gen-settings.json \
--map-settings $CONFIG/map-settings.json
fi
if [ "$(id -u)" = '0' ]; then if [ "$(id -u)" = '0' ]; then
# Take ownership of factorio data if running as root # Take ownership of factorio data if running as root
chown -R factorio:factorio $FACTORIO_VOL chown -R factorio:factorio $FACTORIO_VOL
# Make sure we own temp # Make sure we own temp
mkdir -p /opt/factorio/temp #mkdir -p /opt/factorio/temp
chown -R factorio:factorio /opt/factorio/temp #chown -R factorio:factorio /opt/factorio/temp
# Drop to the factorio user # Drop to the factorio user
SU_EXEC="su-exec factorio" SU_EXEC="su-exec factorio"
fi fi
if ! find -L $SAVES -iname \*.zip -mindepth 1 -print | grep -q .; then
# Generate a new map if no save ZIPs exist
${SU_EXEC} /opt/factorio/bin/x64/factorio \
--create $SAVES/_autosave1.zip \
--map-gen-settings $CONFIG/map-gen-settings.json \
--map-settings $CONFIG/map-settings.json
fi
exec ${SU_EXEC} /opt/factorio/bin/x64/factorio \ exec ${SU_EXEC} /opt/factorio/bin/x64/factorio \
--port $PORT \ --port $PORT \
--start-server-load-latest \ --start-server-load-latest \