2024-02-23 15:18:50 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -ex
|
2017-04-30 21:58:44 +02:00
|
|
|
|
2017-09-05 00:07:33 +02:00
|
|
|
BASE_DIR=/opt/factorio
|
|
|
|
RUN_DIR=${BASE_DIR}/headless/factorio
|
|
|
|
|
|
|
|
FACTORIO_BIN=${RUN_DIR}/bin/x64/factorio
|
|
|
|
WORLDNAME=${BASE_DIR}/saves/world.zip
|
2024-02-23 15:18:50 +01:00
|
|
|
MAP_GEN_SETTINGS=${BASE_DIR}/settings/map-gen-settings.json
|
|
|
|
MAP_SETTINGS=${BASE_DIR}/settings/map-settings.json
|
|
|
|
SERVER_SETTINGS=${BASE_DIR}/settings/server-settings.json
|
2017-04-30 21:58:44 +02:00
|
|
|
# Create savefile, if none exists
|
2024-02-23 15:18:50 +01:00
|
|
|
[ ! -f ${MAP_GEN_SETTINGS} ] && wget -O ${MAP_GEN_SETTINGS} "https://raw.githubusercontent.com/wube/factorio-data/master/map-gen-settings.example.json"
|
|
|
|
[ ! -f ${MAP_SETTINGS} ] && wget -O ${MAP_SETTINGS} "https://raw.githubusercontent.com/wube/factorio-data/master/map-settings.example.json"
|
|
|
|
[ ! -f ${SERVER_SETTINGS} ] && wget -O ${SERVER_SETTINGS} "https://github.com/wube/factorio-data/blob/master/server-settings.example.json"
|
|
|
|
|
|
|
|
[ ! -f ${WORLDNAME} ] && \
|
|
|
|
${FACTORIO_BIN} --create ${WORLDNAME} --map-gen-settings ${MAP_GEN_SETTINGS} --map-settings ${MAP_SETTINGS}
|
|
|
|
|
|
|
|
# "$@"
|
2017-04-30 21:58:44 +02:00
|
|
|
|
2017-09-05 00:07:33 +02:00
|
|
|
cd ${RUN_DIR}
|
|
|
|
|
2017-04-30 21:58:44 +02:00
|
|
|
exec ${FACTORIO_BIN} --start-server ${WORLDNAME} "$@"
|