factorio-docker/0.14/docker-entrypoint.sh

35 lines
951 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
2016-10-31 20:59:57 +01:00
if [ ! -f /factorio/config/rconpw ]; then
echo $(pwgen 15 1) > /factorio/config/rconpw
fi
2016-10-27 01:15:09 +02:00
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-27 02:08:21 +02:00
if ! find -L $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 \
2016-10-31 20:59:57 +01:00
--server-settings /opt/factorio/data/server-settings.json \
--rcon-port 27015 \
--rcon-password "$(cat /factorio/config/rconpw)"