1
0
forked from pool/sysuser-tools

Accepting request 917596 from Base:System

- Add support for new shell field [bsc#1189518] (forwarded request 917595 from kukuk)

OBS-URL: https://build.opensuse.org/request/show/917596
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/sysuser-tools?expand=0&rev=20
This commit is contained in:
Dominique Leuenberger 2021-09-10 21:40:35 +00:00 committed by Git OBS Bridge
commit e2411d8fe6
2 changed files with 14 additions and 2 deletions

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed Sep 8 09:12:05 UTC 2021 - Thorsten Kukuk <kukuk@suse.com>
- Add support for new shell field [bsc#1189518]
-------------------------------------------------------------------
Thu Jul 15 06:45:15 UTC 2021 - Thorsten Kukuk <kukuk@suse.com>

View File

@ -56,6 +56,13 @@ else
homedir="$4"
fi
# Set shell only if not null, empty nor '-'
if [ "${5:--}" != "-" ]; then
ARGUMENTS="$ARGUMENTS -s $5"
else
ARGUMENTS="$ARGUMENTS -s /usr/sbin/nologin"
fi
if [ -x /usr/sbin/useradd ]; then
if ! /usr/bin/getent passwd "$1" >> /dev/null; then
# this is useradd/shadow specific
@ -65,13 +72,13 @@ else
ARGUMENTS="-U $ARGUMENTS"
fi
run /usr/sbin/useradd -r -s /usr/sbin/nologin -c "$3" -d "${homedir}" $ARGUMENTS
run /usr/sbin/useradd -r -c "$3" -d "${homedir}" $ARGUMENTS
fi
elif [ -x "$busybox" ]; then
/usr/bin/getent group "$1" >> /dev/null || $busybox addgroup -S "$1"
if ! /usr/bin/getent passwd "$1" >> /dev/null; then
run $busybox adduser -S -H -s /usr/sbin/nologin -g "$3" -G "$1" -h "${homedir}" $ARGUMENTS
run $busybox adduser -S -H -g "$3" -G "$1" -h "${homedir}" $ARGUMENTS
fi
else
echo "ERROR: neither useradd nor busybox found!"