sysv init: make compatible with absent nogroup

This commit is contained in:
bol-van 2024-03-24 19:12:19 +03:00
parent aa6cbfe03c
commit de7a2f9be9

View File

@ -19,12 +19,14 @@ user_exists()
useradd_compat() useradd_compat()
{ {
# $1 - username # $1 - username
# skip for readonly systems # skip for readonly systems
[ -w "/etc" ] && { [ -w "/etc" ] && {
if exists useradd ; then if exists useradd ; then
useradd --no-create-home --system --shell /bin/false $1 useradd --no-create-home --system --shell /bin/false $1
elif is_linked_to_busybox adduser ; then elif is_linked_to_busybox adduser ; then
# some systems may miss nogroup group in /etc/group
# adduser fails if it's absent and no group is specified
addgroup nogroup 2>/dev/null
# busybox has special adduser syntax # busybox has special adduser syntax
adduser -S -H -D $1 adduser -S -H -D $1
elif exists adduser; then elif exists adduser; then