Skip to content

Commit

Permalink
Merge branch 'StaleLoafOfBread-feat/error/force-root' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
jammsen committed Apr 27, 2024
2 parents af721cd + c6bbf7e commit d8b2aa3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash
# shellcheck disable=SC1091
# https://stackoverflow.com/questions/27669950/difference-between-euid-and-uid

set -e

Expand All @@ -9,14 +10,19 @@ APP_HOME=/home/$APP_USER

source /includes/colors.sh

if [[ "${EUID}" -ne 0 ]]; then
ee ">>> This Docker-Container must be run as root! Please adjust how you started the container, to fix this error."
exit 1
fi

if [[ "${PUID}" -eq 0 ]] || [[ "${PGID}" -eq 0 ]]; then
ee ">>> Running Palworld as root is not supported, please fix your PUID and PGID!"
exit 1
elif [[ "$(id -u steam)" -ne "${PUID}" ]] || [[ "$(id -g steam)" -ne "${PGID}" ]]; then
ew "> Current $APP_USER user PUID is '$(id -u steam)' and PGID is '$(id -g steam)'"
ew "> Setting new $APP_USER user PUID to '${PUID}' and PGID to '${PGID}'"
groupmod -g "${PGID}" "$APP_GROUP" && usermod -u "${PUID}" -g "${PGID}" "$APP_USER"
else
else
ew "> Current $APP_USER user PUID is '$(id -u steam)' and PGID is '$(id -g steam)'"
ew "> PUID and PGID matching what is requested for user $APP_USER"
fi
Expand Down

0 comments on commit d8b2aa3

Please sign in to comment.