init.d: sysv adduser_compat check readonly /etc

This commit is contained in:
bol-van 2021-11-06 11:45:59 +03:00
parent 0970254a86
commit 9df16b8578

View File

@ -31,6 +31,9 @@ user_exists()
useradd_compat() useradd_compat()
{ {
# $1 - username # $1 - username
# skip for readonly systems
[ -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
@ -39,6 +42,7 @@ useradd_compat()
elif exists adduser; then elif exists adduser; then
adduser --no-create-home --system --disabled-login $1 adduser --no-create-home --system --disabled-login $1
fi fi
}
user_exists $1 user_exists $1
} }
prepare_user() prepare_user()