Compare commits

...

5 Commits

Author SHA1 Message Date
Florian Kinder
17ec12cb7f Fix shellcheck warnings in entrypoint scripts
- Add shellcheck disable=SC1091 for dynamic source paths
- Quote INSTALLED_DIRECTORY variables to prevent word splitting
- Resolves all reported shellcheck issues in PR review

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-31 22:31:45 +09:00
Florian Kinder
b8ad6e06ab Fix ARM64 emulation support in all entrypoints
- Add shared setup-exec.sh script to handle ARM64 emulation logic
- Update scenario.sh and scenario2map.sh to use box64 emulation on ARM64
- Refactor docker-entrypoint.sh and docker-entrypoint-rootless.sh to use shared script
- Ensures all factorio binary calls work correctly on ARM64 platforms

Fixes #585

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-31 22:21:22 +09:00
github-actions[bot]
89183f5271 Auto Update Factorio to stable version: 2.0.60 experimental version: 2.0.65 2025-08-22 12:50:33 +00:00
Florian Kinder
4e0c2d0fe9 Fix missing addgroup/adduser commands in Debian slim image (#584)
Replace addgroup/adduser with groupadd/useradd which are available
in the debian:stable-slim base image. The addgroup and adduser commands
are part of the adduser package which is not installed in the slim image.

This fixes the build failure:
/bin/bash: line 1: addgroup: command not found

Continues fix for #582
2025-08-13 22:38:47 +09:00
Florian Kinder
19ca8d8ceb Fix RCON build error by adding _GNU_SOURCE for inet_aton (#583)
The build was failing with 'implicit declaration of function inet_aton'
error in newer GCC versions. Adding _GNU_SOURCE feature test macro
makes inet_aton available. Also fixed unused result warning for fread.

Fixes #582
2025-08-13 22:28:12 +09:00
9 changed files with 48 additions and 20 deletions

View File

@@ -6,7 +6,7 @@
[中文](./README_zh_CN.md) [中文](./README_zh_CN.md)
<!-- start autogeneration tags --> <!-- start autogeneration tags -->
* `latest, 2.0.64` * `latest, 2.0.65`
* `2, 2.0, 2.0.60, stable, stable-2.0.60` * `2, 2.0, 2.0.60, stable, stable-2.0.60`
<!-- end autogeneration tags --> <!-- end autogeneration tags -->

View File

@@ -9,11 +9,11 @@
"2.0.60" "2.0.60"
] ]
}, },
"2.0.64": { "2.0.65": {
"sha256": "729480a81fc3b3bd105bd0c92e108ee1caaac7840cc168cb32b0f9db8759a28a", "sha256": "6b80f0fbeb43753ed7654695ffa427f442496068f2f72129de76cea246a0c63e",
"tags": [ "tags": [
"latest", "latest",
"2.0.64" "2.0.65"
] ]
} }
} }

View File

@@ -54,8 +54,8 @@ RUN apt-get -q update \
fi \ fi \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
RUN addgroup --system --gid "$PGID" "$GROUP" \ RUN groupadd --system --gid "$PGID" "$GROUP" \
&& adduser --system --uid "$PUID" --gid "$PGID" --no-create-home --disabled-password --shell /bin/sh "$USER" && useradd --system --uid "$PUID" --gid "$PGID" --no-create-home --shell /bin/sh "$USER"
# version checksum of the archive to download # version checksum of the archive to download
ARG VERSION ARG VERSION

View File

@@ -53,10 +53,9 @@ fi
# In rootless mode, we don't need to handle user switching or chown # In rootless mode, we don't need to handle user switching or chown
# The container runs as the specified user from the start # The container runs as the specified user from the start
EXEC="" EXEC=""
if [[ -f /bin/box64 ]]; then # Setup ARM64 emulation support
# Use emulator for ARM hosts # shellcheck disable=SC1091
EXEC="/bin/box64" source "${INSTALLED_DIRECTORY}/setup-exec.sh"
fi
# Update config path # Update config path
sed -i '/write-data=/c\write-data=\/factorio/' /opt/factorio/config/config.ini sed -i '/write-data=/c\write-data=\/factorio/' /opt/factorio/config/config.ini

View File

@@ -41,10 +41,10 @@ if [[ $NRTMPSAVES -gt 0 ]]; then
fi fi
if [[ ${UPDATE_MODS_ON_START:-} == "true" ]]; then if [[ ${UPDATE_MODS_ON_START:-} == "true" ]]; then
${INSTALLED_DIRECTORY}/docker-update-mods.sh "${INSTALLED_DIRECTORY}"/docker-update-mods.sh
fi fi
${INSTALLED_DIRECTORY}/docker-dlc.sh "${INSTALLED_DIRECTORY}"/docker-dlc.sh
EXEC="" EXEC=""
if [[ $(id -u) == 0 ]]; then if [[ $(id -u) == 0 ]]; then
@@ -56,11 +56,10 @@ if [[ $(id -u) == 0 ]]; then
# Drop to the factorio user # Drop to the factorio user
EXEC="runuser -u factorio -g factorio --" EXEC="runuser -u factorio -g factorio --"
fi fi
if [[ -f /bin/box64 ]]; then
# Use an emulator to run on ARM hosts # Setup ARM64 emulation support
# this only gets installed when the target docker platform is linux/arm64 # shellcheck disable=SC1091
EXEC="$EXEC /bin/box64" source "${INSTALLED_DIRECTORY}/setup-exec.sh"
fi
sed -i '/write-data=/c\write-data=\/factorio/' /opt/factorio/config/config.ini sed -i '/write-data=/c\write-data=\/factorio/' /opt/factorio/config/config.ini

View File

@@ -1,5 +1,6 @@
#!/bin/bash #!/bin/bash
set -eoux pipefail set -eoux pipefail
INSTALLED_DIRECTORY=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
if [[ -z ${1:-} ]]; then if [[ -z ${1:-} ]]; then
echo "No argument supplied" echo "No argument supplied"
@@ -31,7 +32,12 @@ 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
exec /opt/factorio/bin/x64/factorio \ # Setup ARM64 emulation support
EXEC=""
# shellcheck disable=SC1091
source "${INSTALLED_DIRECTORY}/setup-exec.sh"
exec $EXEC /opt/factorio/bin/x64/factorio \
--port "$PORT" \ --port "$PORT" \
--start-server-load-scenario "$SERVER_SCENARIO" \ --start-server-load-scenario "$SERVER_SCENARIO" \
--preset "$PRESET" \ --preset "$PRESET" \

View File

@@ -1,5 +1,6 @@
#!/bin/bash #!/bin/bash
set -eoux pipefail set -eoux pipefail
INSTALLED_DIRECTORY=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
if [[ -z ${1:-} ]]; then if [[ -z ${1:-} ]]; then
echo "No argument supplied" echo "No argument supplied"
@@ -23,5 +24,10 @@ 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
exec /opt/factorio/bin/x64/factorio \ # Setup ARM64 emulation support
EXEC=""
# shellcheck disable=SC1091
source "${INSTALLED_DIRECTORY}/setup-exec.sh"
exec $EXEC /opt/factorio/bin/x64/factorio \
--scenario2map "$SERVER_SCENARIO" --scenario2map "$SERVER_SCENARIO"

View File

@@ -0,0 +1,16 @@
#!/bin/bash
# Setup EXEC variable for running Factorio with ARM64 emulation support
# This script handles ARM64 emulation and can be combined with user switching as needed
# If EXEC is not already set, initialize it
if [[ -z "${EXEC:-}" ]]; then
EXEC=""
fi
if [[ -f /bin/box64 ]]; then
# Use an emulator to run on ARM hosts
# this only gets installed when the target docker platform is linux/arm64
EXEC="$EXEC /bin/box64"
fi
export EXEC

View File

@@ -1,3 +1,4 @@
#define _GNU_SOURCE
#include <stdio.h> #include <stdio.h>
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
@@ -107,7 +108,8 @@ char* read_password(const char* conf_dir) {
fseek(fptr, 0, SEEK_SET); /* same as rewind(f); */ fseek(fptr, 0, SEEK_SET); /* same as rewind(f); */
char *password = malloc(fsize + 1); char *password = malloc(fsize + 1);
fread(password, fsize, 1, fptr); size_t bytes_read = fread(password, fsize, 1, fptr);
(void)bytes_read; // Suppress unused warning
fclose(fptr); fclose(fptr);
password[fsize] = 0; password[fsize] = 0;