2016-11-01 21:31:24 +01:00
|
|
|
#!/bin/sh -x
|
2016-02-26 14:59:01 +01:00
|
|
|
|
2016-10-27 01:15:09 +02:00
|
|
|
set -e
|
|
|
|
|
2016-11-01 21:31:24 +01:00
|
|
|
SAVES=/factorio/saves
|
|
|
|
CONFIG=/factorio/config
|
2016-10-25 18:49:23 +02:00
|
|
|
|
2016-11-01 21:31:24 +01:00
|
|
|
mkdir -p $SAVES
|
2016-10-27 01:15:09 +02:00
|
|
|
mkdir -p /factorio/mods
|
2016-11-01 21:31:24 +01:00
|
|
|
mkdir -p $CONFIG
|
2016-10-27 01:15:09 +02:00
|
|
|
|
2016-11-01 21:31:24 +01:00
|
|
|
if [ ! -f $CONFIG/rconpw ]; then
|
|
|
|
echo $(pwgen 15 1) > $CONFIG/rconpw
|
2016-10-31 20:59:57 +01:00
|
|
|
fi
|
|
|
|
|
2016-11-01 21:31:24 +01:00
|
|
|
if [ ! -f $CONFIG/server-settings.json ]; then
|
|
|
|
cp /opt/factorio/data/server-settings.example.json $CONFIG/server-settings.json
|
2016-10-27 01:15:09 +02:00
|
|
|
fi
|
|
|
|
|
2016-11-01 21:31:24 +01:00
|
|
|
if [ ! -f $CONFIG/map-gen-settings.json ]; then
|
|
|
|
cp /opt/factorio/data/map-gen-settings.example.json $CONFIG/map-gen-settings.json
|
2016-10-27 01:15:09 +02:00
|
|
|
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 \
|
2016-10-31 21:27:11 +01:00
|
|
|
--create $SAVES/_autosave1.zip \
|
2016-11-01 21:31:24 +01:00
|
|
|
--map-gen-settings $CONFIG/map-gen-settings.json
|
2016-02-26 14:59:01 +01:00
|
|
|
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-11-01 21:31:24 +01:00
|
|
|
--server-settings $CONFIG/server-settings.json \
|
2016-10-31 20:59:57 +01:00
|
|
|
--rcon-port 27015 \
|
2016-11-01 21:31:24 +01:00
|
|
|
--rcon-password "$(cat $CONFIG/rconpw)"
|