24 lines
1,019 B
Bash
Executable file
24 lines
1,019 B
Bash
Executable file
#!/usr/bin/env bash
|
|
set -ex
|
|
|
|
BASE_DIR=/opt/factorio
|
|
RUN_DIR=${BASE_DIR}/headless/factorio
|
|
|
|
FACTORIO_BIN=${RUN_DIR}/bin/x64/factorio
|
|
WORLDNAME=${BASE_DIR}/saves/world.zip
|
|
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
|
|
# Create savefile, if none exists
|
|
[ ! -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}
|
|
|
|
# "$@"
|
|
|
|
cd ${RUN_DIR}
|
|
|
|
exec ${FACTORIO_BIN} --start-server ${WORLDNAME} "$@"
|