From c43187863353c33e1a50aa3dadad47e7881c6c9f Mon Sep 17 00:00:00 2001 From: Paul Date: Fri, 23 Feb 2024 15:18:50 +0100 Subject: [PATCH] Use default configuration if none defined --- bin/entrypoint.sh | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/bin/entrypoint.sh b/bin/entrypoint.sh index 6c587c6..2d4bcaa 100755 --- a/bin/entrypoint.sh +++ b/bin/entrypoint.sh @@ -1,15 +1,23 @@ -#!/bin/bash -set -e +#!/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 ${WORLDNAME} ] && ${FACTORIO_BIN} --create ${WORLDNAME} "$@" +[ ! -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}