mirror of
https://github.com/factoriotools/factorio-docker.git
synced 2025-01-13 11:47:13 +01:00
Compare commits
7 Commits
d137f32c2f
...
e37bcf1ed0
Author | SHA1 | Date | |
---|---|---|---|
|
e37bcf1ed0 | ||
|
3defd74c46 | ||
|
dde2761a8c | ||
|
0ec91c3391 | ||
|
f9040c7450 | ||
|
c9957b7d76 | ||
|
89ae20012e |
10
README.md
10
README.md
@ -7,7 +7,7 @@
|
||||
|
||||
<!-- start autogeneration tags -->
|
||||
* `2.0.9`, `latest`
|
||||
* `2`, `2.0`, `2.0.8`, `stable-2.0.8`
|
||||
* `2`, `2.0`, `2.0.8`, `stable`, `stable-2.0.8`
|
||||
* `1`, `1.1`, `1.1.110`, `stable-1.1.110`
|
||||
* `1.0`, `1.0.0`
|
||||
* `0.17`, `0.17.79`
|
||||
@ -262,7 +262,7 @@ The `server-settings.json` file may then contain the variable references like th
|
||||
These are the environment variables which can be specified at container run time.
|
||||
|
||||
| Variable Name | Description | Default | Available in |
|
||||
| - | - | - | - |
|
||||
|----------------------|----------------------------------------------------------------------|----------------|--------------|
|
||||
| GENERATE_NEW_SAVE | Generate a new save if one does not exist before starting the server | false | 0.17+ |
|
||||
| LOAD_LATEST_SAVE | Load latest when true. Otherwise load SAVE_NAME | true | 0.17+ |
|
||||
| PORT | UDP port the server listens on | 34197 | 0.15+ |
|
||||
@ -271,8 +271,10 @@ These are the environment variables which can be specified at container run time
|
||||
| SAVE_NAME | Name to use for the save file | _autosave1 | 0.17+ |
|
||||
| TOKEN | factorio.com token | | 0.17+ |
|
||||
| UPDATE_MODS_ON_START | If mods should be updated before starting the server | | 0.17+ |
|
||||
| USERNAME | factorio.com username | | 0.17+ | |
|
||||
| CONSOLE_LOG_LOCATION | Saves the console log to the specifies location | |
|
||||
| USERNAME | factorio.com username | | 0.17+ |
|
||||
| CONSOLE_LOG_LOCATION | Saves the console log to the specifies location | | |
|
||||
| DLC_SPACE_AGE | Enables or disables the mods for DLC Space Age in mod-list.json | true | 2.0.8+ |
|
||||
| MODS | Mod directory to use | /factorio/mods | 2.0.10+ |
|
||||
|
||||
**Note:** All environment variables are compared as strings
|
||||
|
||||
|
@ -60,6 +60,7 @@
|
||||
"2.0.8": {
|
||||
"sha256": "d9594c4d552a3e4f965b188a4774da8c8b010fc23ddb0efc63b1d94818dde1ca",
|
||||
"tags": [
|
||||
"stable",
|
||||
"stable-2.0.8",
|
||||
"2",
|
||||
"2.0",
|
||||
|
@ -28,7 +28,8 @@ ENV PORT=34197 \
|
||||
SCENARIOS=/factorio/scenarios \
|
||||
SCRIPTOUTPUT=/factorio/script-output \
|
||||
PUID="$PUID" \
|
||||
PGID="$PGID"
|
||||
PGID="$PGID" \
|
||||
DLC_SPACE_AGE="true"
|
||||
|
||||
SHELL ["/bin/bash", "-eo", "pipefail", "-c"]
|
||||
|
||||
|
43
docker/files/docker-dlc.sh
Executable file
43
docker/files/docker-dlc.sh
Executable file
@ -0,0 +1,43 @@
|
||||
#!/bin/bash
|
||||
set -eou pipefail
|
||||
|
||||
# Path to the mod-list.json file
|
||||
MOD_LIST_FILE="$MODS/mod-list.json"
|
||||
|
||||
if [[ ! -f "$MOD_LIST_FILE" ]]; then
|
||||
# Create the mod-list.json file if it doesn't exist
|
||||
echo '{"mods":[{"name":"base","enabled":true}]}' > "$MOD_LIST_FILE"
|
||||
fi
|
||||
|
||||
enable_mod()
|
||||
{
|
||||
echo "Enable mod $1 for DLC"
|
||||
jq --arg mod_name "$1" 'if .mods | map(.name) | index($mod_name) then .mods |= map(if .name == $mod_name and .enabled == false then .enabled = true else . end) else . end' "$MOD_LIST_FILE" > "$MOD_LIST_FILE.tmp"
|
||||
mv "$MOD_LIST_FILE.tmp" "$MOD_LIST_FILE"
|
||||
}
|
||||
|
||||
disable_mod()
|
||||
{
|
||||
echo "Disable mod $1 for DLC"
|
||||
jq --arg mod_name "$1" 'if .mods | map(.name) | index($mod_name) then .mods |= map(if .name == $mod_name and .enabled == true then .enabled = false else . end) else .mods += [{"name": $mod_name, "enabled": false}] end' "$MOD_LIST_FILE" > "$MOD_LIST_FILE.tmp"
|
||||
mv "$MOD_LIST_FILE.tmp" "$MOD_LIST_FILE"
|
||||
}
|
||||
|
||||
# Enable or disable DLCs if configured
|
||||
if [[ ${DLC_SPACE_AGE:-} == "true" ]]; then
|
||||
# Define the DLC mods
|
||||
DLC_MODS=("elevated-rails" "quality" "space-age")
|
||||
|
||||
# Iterate over each DLC mod
|
||||
for MOD in "${DLC_MODS[@]}"; do
|
||||
enable_mod "$MOD"
|
||||
done
|
||||
else
|
||||
# Define the DLC mods
|
||||
DLC_MODS=("elevated-rails" "quality" "space-age")
|
||||
|
||||
# Iterate over each DLC mod
|
||||
for MOD in "${DLC_MODS[@]}"; do
|
||||
disable_mod "$MOD"
|
||||
done
|
||||
fi
|
@ -43,8 +43,10 @@ if [[ ${UPDATE_MODS_ON_START:-} == "true" ]]; then
|
||||
./docker-update-mods.sh
|
||||
fi
|
||||
|
||||
./docker-dlc.sh
|
||||
|
||||
EXEC=""
|
||||
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
|
||||
@ -100,6 +102,7 @@ FLAGS=(\
|
||||
--server-adminlist "$CONFIG/server-adminlist.json" \
|
||||
--rcon-password "$(cat "$CONFIG/rconpw")" \
|
||||
--server-id /factorio/config/server-id.json \
|
||||
--mod-directory "$MODS" \
|
||||
)
|
||||
|
||||
if [ -n "$CONSOLE_LOG_LOCATION" ]; then
|
||||
|
Loading…
Reference in New Issue
Block a user