mirror of
https://github.com/factoriotools/factorio-docker.git
synced 2024-11-07 03:07:24 +01:00
Switch to test, cleanupm, formatting
This commit is contained in:
parent
65c5833fd9
commit
1b6c8adf28
@ -9,26 +9,26 @@ mkdir -p "$MODS"
|
||||
mkdir -p "$SCENARIOS"
|
||||
mkdir -p "$SCRIPTOUTPUT"
|
||||
|
||||
if [ ! -f "$CONFIG/rconpw" ]; then
|
||||
if [[ ! -f $CONFIG/rconpw ]]; then
|
||||
# Generate a new RCON password if none exists
|
||||
pwgen 15 1 >"$CONFIG/rconpw"
|
||||
fi
|
||||
|
||||
if [ ! -f "$CONFIG/server-settings.json" ]; then
|
||||
if [[ ! -f $CONFIG/server-settings.json ]]; then
|
||||
# Copy default settings if server-settings.json doesn't exist
|
||||
cp /opt/factorio/data/server-settings.example.json "$CONFIG/server-settings.json"
|
||||
fi
|
||||
|
||||
if [ ! -f "$CONFIG/map-gen-settings.json" ]; then
|
||||
if [[ ! -f $CONFIG/map-gen-settings.json ]]; then
|
||||
cp /opt/factorio/data/map-gen-settings.example.json "$CONFIG/map-gen-settings.json"
|
||||
fi
|
||||
|
||||
if [ ! -f "$CONFIG/map-settings.json" ]; then
|
||||
if [[ ! -f $CONFIG/map-settings.json ]]; then
|
||||
cp /opt/factorio/data/map-settings.example.json "$CONFIG/map-settings.json"
|
||||
fi
|
||||
|
||||
NRTMPSAVES=$( find -L "$SAVES" -iname \*.tmp.zip -mindepth 1 | wc -l )
|
||||
if [ "$NRTMPSAVES" -gt 0 ]; then
|
||||
if [[ $NRTMPSAVES -gt 0 ]]; then
|
||||
# Delete incomplete saves (such as after a forced exit)
|
||||
rm -f "$SAVES"/*.tmp.zip
|
||||
fi
|
||||
@ -37,7 +37,7 @@ if [[ ${UPDATE_MODS_ON_START:-} ]]; then
|
||||
./docker-update-mods.sh
|
||||
fi
|
||||
|
||||
if [ "$(id -u)" = '0' ]; then
|
||||
if [[ $(id -u) = 0 ]]; then
|
||||
# Update the User and Group ID based on the PUID/PGID variables
|
||||
usermod -o -u "$PUID" factorio
|
||||
groupmod -o -g "$PGID" factorio
|
||||
@ -50,7 +50,7 @@ else
|
||||
fi
|
||||
|
||||
NRSAVES=$(find -L "$SAVES" -iname \*.zip -mindepth 1 | wc -l)
|
||||
if [ "$NRSAVES" -eq 0 ]; then
|
||||
if [[ $NRSAVES -eq 0 ]]; then
|
||||
# Generate a new map if no save ZIPs exist
|
||||
$SU_EXEC /opt/factorio/bin/x64/factorio \
|
||||
--create "$SAVES/_autosave1.zip" \
|
||||
|
@ -1,12 +1,11 @@
|
||||
#!/bin/bash
|
||||
set -eoux pipefail
|
||||
|
||||
if [[ -z ${1:-} ]]; then
|
||||
echo "No argument supplied"
|
||||
fi
|
||||
|
||||
SERVER_SCENARIO="$1"
|
||||
|
||||
|
||||
id
|
||||
|
||||
mkdir -p "$SAVES"
|
||||
mkdir -p "$CONFIG"
|
||||
mkdir -p "$MODS"
|
||||
@ -14,19 +13,19 @@ mkdir -p "$SCENARIOS"
|
||||
|
||||
#chown -R factorio /factorio
|
||||
|
||||
if [ ! -f "$CONFIG/rconpw" ]; then
|
||||
if [[ ! -f $CONFIG/rconpw ]]; then
|
||||
pwgen 15 1 >"$CONFIG/rconpw"
|
||||
fi
|
||||
|
||||
if [ ! -f "$CONFIG/server-settings.json" ]; then
|
||||
if [[ ! -f $CONFIG/server-settings.json ]]; then
|
||||
cp /opt/factorio/data/server-settings.example.json "$CONFIG/server-settings.json"
|
||||
fi
|
||||
|
||||
if [ ! -f "$CONFIG/map-gen-settings.json" ]; then
|
||||
if [[ ! -f $CONFIG/map-gen-settings.json ]]; then
|
||||
cp /opt/factorio/data/map-gen-settings.example.json "$CONFIG/map-gen-settings.json"
|
||||
fi
|
||||
|
||||
if [ ! -f "$CONFIG/map-settings.json" ]; then
|
||||
if [[ ! -f $CONFIG/map-settings.json ]]; then
|
||||
cp /opt/factorio/data/map-settings.example.json "$CONFIG/map-settings.json"
|
||||
fi
|
||||
|
||||
|
@ -1,27 +1,25 @@
|
||||
#!/bin/bash
|
||||
set -eoux pipefail
|
||||
|
||||
if [[ -z ${1:-} ]]; then
|
||||
echo "No argument supplied"
|
||||
fi
|
||||
|
||||
SERVER_SCENARIO="$1"
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
id
|
||||
|
||||
mkdir -p "$SAVES"
|
||||
mkdir -p "$CONFIG"
|
||||
mkdir -p "$MODS"
|
||||
mkdir -p "$SCENARIOS"
|
||||
|
||||
if [ ! -f "$CONFIG/server-settings.json" ]; then
|
||||
if [[ ! -f $CONFIG/server-settings.json ]]; then
|
||||
cp /opt/factorio/data/server-settings.example.json "$CONFIG/server-settings.json"
|
||||
fi
|
||||
|
||||
if [ ! -f "$CONFIG/map-gen-settings.json" ]; then
|
||||
if [[ ! -f $CONFIG/map-gen-settings.json ]]; then
|
||||
cp /opt/factorio/data/map-gen-settings.example.json "$CONFIG/map-gen-settings.json"
|
||||
fi
|
||||
|
||||
if [ ! -f "$CONFIG/map-settings.json" ]; then
|
||||
if [[ ! -f $CONFIG/map-settings.json ]]; then
|
||||
cp /opt/factorio/data/map-settings.example.json "$CONFIG/map-settings.json"
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user