mirror of
https://github.com/bol-van/zapret.git
synced 2024-11-26 20:20:53 +03:00
sysv init: make compatible with absent nogroup
This commit is contained in:
parent
aa6cbfe03c
commit
de7a2f9be9
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user