Accepting request 759948 from home:kukuk:ei-demo
- Look for /bin/busybox, too - Add special handling for busybox and groups OBS-URL: https://build.opensuse.org/request/show/759948 OBS-URL: https://build.opensuse.org/package/show/Base:System/sysuser-tools?expand=0&rev=20
This commit is contained in:
parent
68942d50f7
commit
a19c937597
@ -1,3 +1,9 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Sun Dec 29 19:16:13 UTC 2019 - kukuk@suse.de
|
||||||
|
|
||||||
|
- Look for /bin/busybox, too
|
||||||
|
- Add special handling for busybox and groups
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Fri Jul 26 13:28:27 CEST 2019 - kukuk@suse.de
|
Fri Jul 26 13:28:27 CEST 2019 - kukuk@suse.de
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package sysuser-tools
|
# spec file for package sysuser-tools
|
||||||
#
|
#
|
||||||
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
|
# Copyright (c) 2019 SUSE LLC
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
|
@ -17,6 +17,9 @@ do
|
|||||||
elif [ -x /usr/bin/busybox ]; then
|
elif [ -x /usr/bin/busybox ]; then
|
||||||
echo "addgroup -S $ARGUMENTS"
|
echo "addgroup -S $ARGUMENTS"
|
||||||
/usr/bin/getent group "${arr[1]}" >> /dev/null || /usr/bin/busybox addgroup -S $ARGUMENTS || exit $?
|
/usr/bin/getent group "${arr[1]}" >> /dev/null || /usr/bin/busybox addgroup -S $ARGUMENTS || exit $?
|
||||||
|
elif [ -x /bin/busybox ]; then
|
||||||
|
echo "addgroup -S $ARGUMENTS"
|
||||||
|
/usr/bin/getent group "${arr[1]}" >> /dev/null || /bin/busybox addgroup -S $ARGUMENTS || exit $?
|
||||||
else
|
else
|
||||||
echo "ERROR: neither groupadd nor busybox found!"
|
echo "ERROR: neither groupadd nor busybox found!"
|
||||||
exit 1
|
exit 1
|
||||||
@ -33,19 +36,34 @@ do
|
|||||||
else
|
else
|
||||||
ARGUMENTS="-d / $ARGUMENTS"
|
ARGUMENTS="-d / $ARGUMENTS"
|
||||||
fi
|
fi
|
||||||
/usr/bin/getent group ${arr[1]} >> /dev/null
|
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
ARGUMENTS="-g ${arr[1]} $ARGUMENTS"
|
|
||||||
else
|
|
||||||
ARGUMENTS="-U $ARGUMENTS"
|
|
||||||
fi
|
|
||||||
if [ -x /usr/sbin/useradd ]; then
|
if [ -x /usr/sbin/useradd ]; then
|
||||||
|
# this is useradd/shadow specific
|
||||||
|
/usr/bin/getent group ${arr[1]} >> /dev/null
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
ARGUMENTS="-g ${arr[1]} $ARGUMENTS"
|
||||||
|
else
|
||||||
|
ARGUMENTS="-U $ARGUMENTS"
|
||||||
|
fi
|
||||||
echo "useradd -r -s /sbin/nologin -c \"${arr[3]}\" $ARGUMENTS"
|
echo "useradd -r -s /sbin/nologin -c \"${arr[3]}\" $ARGUMENTS"
|
||||||
/usr/bin/getent passwd ${arr[1]} >> /dev/null || /usr/sbin/useradd -r -s /sbin/nologin -c "${arr[3]}" $ARGUMENTS || exit $?
|
/usr/bin/getent passwd ${arr[1]} >> /dev/null || /usr/sbin/useradd -r -s /sbin/nologin -c "${arr[3]}" $ARGUMENTS || exit $?
|
||||||
elif [ -x /usr/bin/busybox ]; then
|
elif [ -x /usr/bin/busybox ]; then
|
||||||
|
/usr/bin/getent group ${arr[1]} >> /dev/null
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
/usr/bin/busybox addgroup ${arr[1]}
|
||||||
|
fi
|
||||||
|
ARGUMENTS="-G ${arr[1]} $ARGUMENTS"
|
||||||
ARGUMENTS=`echo $ARGUMENTS | sed -e 's|-d|-h|g' -e 's|-g|-G|g'`
|
ARGUMENTS=`echo $ARGUMENTS | sed -e 's|-d|-h|g' -e 's|-g|-G|g'`
|
||||||
echo "adduser -S -s /sbin/nologin -g \"${arr[3]}\" $ARGUMENTS"
|
echo "adduser -S -s /sbin/nologin -g \"${arr[3]}\" $ARGUMENTS"
|
||||||
/usr/bin/getent passwd ${arr[1]} >> /dev/null || /usr/bin/busybox adduser -S -s /sbin/nologin -g "${arr[3]}" $ARGUMENTS || exit $?
|
/usr/bin/getent passwd ${arr[1]} >> /dev/null || /usr/bin/busybox adduser -S -s /sbin/nologin -g "${arr[3]}" $ARGUMENTS || exit $?
|
||||||
|
elif [ -x /bin/busybox ]; then
|
||||||
|
/usr/bin/getent group ${arr[1]} >> /dev/null
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
/bin/busybox addgroup ${arr[1]}
|
||||||
|
fi
|
||||||
|
ARGUMENTS="-G ${arr[1]} $ARGUMENTS"
|
||||||
|
ARGUMENTS=`echo $ARGUMENTS | sed -e 's|-d|-h|g' -e 's|-g|-G|g'`
|
||||||
|
echo "adduser -S -s /sbin/nologin -g \"${arr[3]}\" $ARGUMENTS"
|
||||||
|
/usr/bin/getent passwd ${arr[1]} >> /dev/null || /bin/busybox adduser -S -s /sbin/nologin -g "${arr[3]}" $ARGUMENTS || exit $?
|
||||||
else
|
else
|
||||||
echo "ERROR: neither useradd nor busybox found!"
|
echo "ERROR: neither useradd nor busybox found!"
|
||||||
exit 1
|
exit 1
|
||||||
@ -59,6 +77,9 @@ do
|
|||||||
elif [ -x /usr/bin/busybox ]; then
|
elif [ -x /usr/bin/busybox ]; then
|
||||||
echo "addgroup ${arr[1]} ${arr[2]}"
|
echo "addgroup ${arr[1]} ${arr[2]}"
|
||||||
/usr/bin/busybox addgroup ${arr[1]} ${arr[2]} || exit $?
|
/usr/bin/busybox addgroup ${arr[1]} ${arr[2]} || exit $?
|
||||||
|
elif [ -x /bin/busybox ]; then
|
||||||
|
echo "addgroup ${arr[1]} ${arr[2]}"
|
||||||
|
/bin/busybox addgroup ${arr[1]} ${arr[2]} || exit $?
|
||||||
else
|
else
|
||||||
echo "ERROR: neither usermod nor busybox found!"
|
echo "ERROR: neither usermod nor busybox found!"
|
||||||
exit 1
|
exit 1
|
||||||
|
Loading…
Reference in New Issue
Block a user