Accepting request 917595 from home:kukuk:tiu

- Add support for new shell field [bsc#1189518]

OBS-URL: https://build.opensuse.org/request/show/917595
OBS-URL: https://build.opensuse.org/package/show/Base:System/sysuser-tools?expand=0&rev=50
This commit is contained in:
Thorsten Kukuk 2021-09-08 14:31:16 +00:00 committed by Git OBS Bridge
parent 7672d970fc
commit e9a36c690b
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!"