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