factorio-docker/docker-entrypoint.sh

29 lines
780 B
Bash
Raw Normal View History

2016-10-25 18:49:23 +02:00
#!/bin/bash -x
2016-10-27 01:15:09 +02:00
set -e
2016-10-25 18:49:23 +02:00
SAVES=/opt/factorio/saves
2016-10-27 01:15:09 +02:00
mkdir -p /factorio/saves
mkdir -p /factorio/mods
mkdir -p /factorio/config
if [ ! -f /factorio/config/server-settings.json ]; then
cp /opt/factorio/data/server-settings.example.json /factorio/config/server-settings.json
fi
if [ ! -f /factorio/config/map-gen-settings.json ]; then
cp /opt/factorio/data/map-gen-settings.example.json /factorio/config/map-gen-settings.json
fi
2016-10-26 19:26:47 +02:00
if ! find $SAVES -iname \*.zip -mindepth 1 -print | grep -q .; then
2016-10-26 06:57:49 +02:00
/opt/factorio/bin/x64/factorio \
--create $SAVES/save.zip \
--map-gen-settings /opt/factorio/data/map-gen-settings.json
fi
2016-10-26 06:57:49 +02:00
exec /opt/factorio/bin/x64/factorio \
2016-10-26 19:46:34 +02:00
--port 34197 \
2016-10-26 06:57:49 +02:00
--start-server-load-latest \
--server-settings /opt/factorio/data/server-settings.json