diff --git a/root/etc/s6-overlay/s6-rc.d/init-adduser/run b/root/etc/s6-overlay/s6-rc.d/init-adduser/run index 2111a58..7bc467e 100755 --- a/root/etc/s6-overlay/s6-rc.d/init-adduser/run +++ b/root/etc/s6-overlay/s6-rc.d/init-adduser/run @@ -1,7 +1,7 @@ #!/usr/bin/with-contenv bash # shellcheck shell=bash -if [[ -n "$USER_NAME" ]] && [[ "$USER_NAME" != "abc" ]] && grep -q "^${USER_NAME}" /etc/passwd; then +if [[ ! -f "/usermod.done" ]] && [[ -n "${USER_NAME}" ]] && [[ "${USER_NAME}" != "abc" ]] && grep -q "^${USER_NAME}" /etc/passwd; then echo "*** USER_NAME cannot be set to an user that already exists in /etc/passwd. Halting init. ***" sleep infinity else @@ -14,6 +14,7 @@ PGID=${PGID:-911} if [[ "$USER_NAME" != "abc" ]]; then usermod -l "$USER_NAME" abc groupmod -n "$USER_NAME" abc + touch /usermod.done fi groupmod -o -g "$PGID" "$USER_NAME"