Skip to content

Commit

Permalink
Don't halt on custom user on restarts
Browse files Browse the repository at this point in the history
  • Loading branch information
thespad committed Nov 27, 2024
1 parent dcebd47 commit 8d21fc1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion root/etc/s6-overlay/s6-rc.d/init-adduser/run
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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"
Expand Down

0 comments on commit 8d21fc1

Please sign in to comment.