Align runtime with Ptero steamcmd entrypoint (eval startup, AUTO_UPDATE); fix install SteamCMD login and Linux platform.
Some checks failed
Build and Publish Docker Image (Gitea Registry) / docker (push) Failing after 21s

This commit is contained in:
alexveley
2026-04-25 01:53:24 -04:00
parent b0ce346577
commit e4a65359c7
4 changed files with 461 additions and 7 deletions

View File

@@ -1,5 +1,7 @@
#!/bin/bash
set -euo pipefail
# NSS wrapper for Avorion getpwuid(); then match upstream Ptero steamcmd entrypoint behavior
# (see https://github.com/Ptero-Eggs/yolks/blob/main/steamcmd/entrypoint.sh )
set -eo pipefail
export USER=container
export LOGNAME=container
@@ -36,7 +38,7 @@ else
echo "[entrypoint] WARNING: libnss_wrapper not found; UID/GID passthrough may fail for Avorion." >&2
fi
cd /home/container
cd /home/container || exit 1
echo "[entrypoint] uid=${uid} gid=${gid} home=${HOME} user=${USER}" >&2
echo "[entrypoint] NSS wrapper passwd=${NSS_WRAPPER_PASSWD} group=${NSS_WRAPPER_GROUP}" >&2
@@ -45,9 +47,53 @@ if ! getent passwd "$uid" >/dev/null 2>&1; then
echo "[entrypoint] WARNING: getent cannot resolve uid ${uid} prior to exec." >&2
fi
if [ -n "${STARTUP:-}" ]; then
echo ":/home/container$ ${STARTUP}"
exec /bin/bash -c "${STARTUP}"
# --- below: adapted from Ptero-Eggs/yolks steamcmd/entrypoint.sh ---
sleep 1
TZ=${TZ:-UTC}
export TZ
INTERNAL_IP=$(ip route get 1 | awk '{print $(NF-2);exit}')
export INTERNAL_IP
# Set environment for Steam Proton (unchanged from upstream)
if [ -f "/usr/local/bin/proton" ]; then
if [ -n "${SRCDS_APPID:-}" ]; then
mkdir -p "/home/container/.steam/steam/steamapps/compatdata/${SRCDS_APPID}"
export STEAM_COMPAT_CLIENT_INSTALL_PATH="/home/container/.steam/steam"
export STEAM_COMPAT_DATA_PATH="/home/container/.steam/steam/steamapps/compatdata/${SRCDS_APPID}"
export PATH="${PATH}:/root/.local/bin"
else
echo -e "----------------------------------------------------------------------------------"
echo -e "WARNING!!! SRCDS_APPID is missing and must be set when using Proton"
echo -e "Server will now terminate"
echo -e "----------------------------------------------------------------------------------"
exit 1
fi
fi
exec "$@"
STEAM_USER=${STEAM_USER:-anonymous}
if [ "${STEAM_USER}" == "anonymous" ]; then
STEAM_PASS=""
STEAM_AUTH=""
fi
if [ -z "${AUTO_UPDATE}" ] || [ "${AUTO_UPDATE}" == "1" ]; then
if [ -n "${SRCDS_APPID:-}" ] && [ -x "./steamcmd/steamcmd.sh" ]; then
# shellcheck disable=SC2046,SC2086
./steamcmd/steamcmd.sh +force_install_dir /home/container \
$([[ "${WINDOWS_INSTALL:-}" == "1" ]] && printf %s '+@sSteamCmdForcePlatformType windows' || printf %s '+@sSteamCmdForcePlatformType linux') \
+login "${STEAM_USER}" "${STEAM_PASS}" "${STEAM_AUTH}" \
$([[ -z ${HLDS_GAME:-} ]] || printf %s "+app_set_config 90 mod ${HLDS_GAME}") \
"+app_update ${SRCDS_APPID} $([[ -z ${SRCDS_BETAID:-} ]] || printf %s "-beta ${SRCDS_BETAID}") $([[ -z ${SRCDS_BETAPASS:-} ]] || printf %s "-betapassword ${SRCDS_BETAPASS}") ${INSTALL_FLAGS:-} $([[ "${VALIDATE:-}" == "1" ]] && printf %s 'validate')" \
$([[ "${UPDATE_STEAMWORKS:-}" == "1" ]] && printf %s '+app_update 1007') +quit
fi
fi
# Replace {{VAR}} with ${VAR} then eval (required for Pterodactyl egg startup strings)
MODIFIED_STARTUP=$(echo "${STARTUP}" | sed -e 's/{{/${/g' -e 's/}}/}/g')
echo -e ":/home/container$ ${MODIFIED_STARTUP}"
# shellcheck disable=SC2086
eval ${MODIFIED_STARTUP}