From 8d21fc104e430f16fffe5c5410c41c81d47cae92 Mon Sep 17 00:00:00 2001 From: thespad Date: Wed, 27 Nov 2024 22:13:38 +0000 Subject: [PATCH] Don't halt on custom user on restarts --- root/etc/s6-overlay/s6-rc.d/init-adduser/run | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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..528f0a1 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" ]] && [[ -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 fi groupmod -o -g "$PGID" "$USER_NAME"