Accepting request 788085 from home:favogt:nobash
- Fix bug introduced by simplification of check for useradd -g - Refactor use of sed away OBS-URL: https://build.opensuse.org/request/show/788085 OBS-URL: https://build.opensuse.org/package/show/Base:System/sysuser-tools?expand=0&rev=25
This commit is contained in:
parent
1111c839cc
commit
d7b80fccdd
@ -1,3 +1,9 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed Mar 25 07:53:55 UTC 2020 - Fabian Vogt <fvogt@suse.com>
|
||||||
|
|
||||||
|
- Fix bug introduced by simplification of check for useradd -g
|
||||||
|
- Refactor use of sed away
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Tue Mar 24 10:01:39 UTC 2020 - Fabian Vogt <fvogt@suse.com>
|
Tue Mar 24 10:01:39 UTC 2020 - Fabian Vogt <fvogt@suse.com>
|
||||||
|
|
||||||
|
@ -41,26 +41,27 @@ do
|
|||||||
if [ -n "${2-}" ] && [ "$2" != "-" ]; then
|
if [ -n "${2-}" ] && [ "$2" != "-" ]; then
|
||||||
ARGUMENTS="-u $2 $ARGUMENTS"
|
ARGUMENTS="-u $2 $ARGUMENTS"
|
||||||
fi
|
fi
|
||||||
if [ -n "${4-}" ] && [ "$4" != "-" ]; then
|
homedir="/" # If null, empty or '-'
|
||||||
ARGUMENTS="-d $4 $ARGUMENTS"
|
if [ "${4:--}" != "-" ]; then
|
||||||
else
|
homedir="$4"
|
||||||
ARGUMENTS="-d / $ARGUMENTS"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -x /usr/sbin/useradd ]; then
|
if [ -x /usr/sbin/useradd ]; then
|
||||||
if ! /usr/bin/getent passwd "$1" >> /dev/null; then
|
if ! /usr/bin/getent passwd "$1" >> /dev/null; then
|
||||||
# this is useradd/shadow specific
|
# this is useradd/shadow specific
|
||||||
|
if /usr/bin/getent group "$1" >> /dev/null; then
|
||||||
ARGUMENTS="-g $1 $ARGUMENTS"
|
ARGUMENTS="-g $1 $ARGUMENTS"
|
||||||
/usr/bin/getent group "$1" >> /dev/null || ARGUMENTS="-U $ARGUMENTS"
|
else
|
||||||
|
ARGUMENTS="-U $ARGUMENTS"
|
||||||
|
fi
|
||||||
|
|
||||||
run /usr/sbin/useradd -r -s /sbin/nologin -c "$3" $ARGUMENTS
|
run /usr/sbin/useradd -r -s /sbin/nologin -c "$3" -d "${homedir}" $ARGUMENTS
|
||||||
fi
|
fi
|
||||||
elif [ -x "$busybox" ]; then
|
elif [ -x "$busybox" ]; then
|
||||||
/usr/bin/getent group "$1" >> /dev/null || $busybox addgroup "$1"
|
/usr/bin/getent group "$1" >> /dev/null || $busybox addgroup "$1"
|
||||||
|
|
||||||
if ! /usr/bin/getent passwd $1 >> /dev/null; then
|
if ! /usr/bin/getent passwd "$1" >> /dev/null; then
|
||||||
ARGUMENTS="$(echo -G $1 $ARGUMENTS | sed -e 's|-d|-h|g' -e 's|-g|-G|g')"
|
run $busybox adduser -S -H -s /sbin/nologin -g "$3" -G "$1" -h "${homedir}" $ARGUMENTS
|
||||||
run $busybox adduser -S -H -s /sbin/nologin -g "$3" $ARGUMENTS
|
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "ERROR: neither useradd nor busybox found!"
|
echo "ERROR: neither useradd nor busybox found!"
|
||||||
|
Loading…
Reference in New Issue
Block a user