Skip to content

Commit 8d21fc1

Browse files
committed
Don't halt on custom user on restarts
1 parent dcebd47 commit 8d21fc1

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

  • root/etc/s6-overlay/s6-rc.d/init-adduser

root/etc/s6-overlay/s6-rc.d/init-adduser/run

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/with-contenv bash
22
# shellcheck shell=bash
33

4-
if [[ -n "$USER_NAME" ]] && [[ "$USER_NAME" != "abc" ]] && grep -q "^${USER_NAME}" /etc/passwd; then
4+
if [[ ! -f "/usermod" ]] && [[ -n "${USER_NAME}" ]] && [[ "${USER_NAME}" != "abc" ]] && grep -q "^${USER_NAME}" /etc/passwd; then
55
echo "*** USER_NAME cannot be set to an user that already exists in /etc/passwd. Halting init. ***"
66
sleep infinity
77
else
@@ -14,6 +14,7 @@ PGID=${PGID:-911}
1414
if [[ "$USER_NAME" != "abc" ]]; then
1515
usermod -l "$USER_NAME" abc
1616
groupmod -n "$USER_NAME" abc
17+
touch /usermod
1718
fi
1819

1920
groupmod -o -g "$PGID" "$USER_NAME"

0 commit comments

Comments
 (0)