Accepting request 718841 from home:kukuk:container
- Use suggest shadow to prefer that over busybox in normal systems - Add support for busybox adduser/addgroup - Change requirements from shadow to useradd_or_adduser_dep OBS-URL: https://build.opensuse.org/request/show/718841 OBS-URL: https://build.opensuse.org/package/show/Base:System/sysuser-tools?expand=0&rev=17
This commit is contained in:
parent
aff93c9d23
commit
dc1a70f2b6
@ -14,7 +14,8 @@
|
||||
###
|
||||
|
||||
# This is for useradd/usermod/groupadd
|
||||
%sysusers_requires Requires(pre): shadow sysuser-shadow
|
||||
%sysusers_requires Requires(pre): useradd_or_adduser_dep sysuser-shadow \
|
||||
Suggest: shadow
|
||||
|
||||
%sysusers_generate_pre() \
|
||||
%{_prefix}/lib/rpm/sysusers-generate-pre "%1" > "%2".pre
|
||||
|
@ -1,3 +1,14 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Jul 26 13:28:27 CEST 2019 - kukuk@suse.de
|
||||
|
||||
- Use suggest shadow to prefer that over busybox in normal systems
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Jul 25 16:00:35 CEST 2019 - kukuk@suse.de
|
||||
|
||||
- Add support for busybox adduser/addgroup
|
||||
- Change requirements from shadow to useradd_or_adduser_dep
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu May 9 13:23:56 CEST 2019 - kukuk@suse.de
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
|
||||
Name: sysuser-tools
|
||||
Version: 2.0
|
||||
Version: 3.0
|
||||
Release: 0
|
||||
Summary: Auto provides for system users
|
||||
License: MIT
|
||||
@ -38,7 +38,7 @@ Generate auto provides for system users.
|
||||
%package -n sysuser-shadow
|
||||
Summary: Tool to execute sysusers.d with shadow utilities
|
||||
Group: System/Packages
|
||||
Requires: shadow
|
||||
Requires: useradd_or_adduser_dep
|
||||
|
||||
%description -n sysuser-shadow
|
||||
This package contians a tool, which expects as input a sysusers.d
|
||||
|
@ -11,8 +11,16 @@ do
|
||||
if [ ! -z "${arr[2]}" -a "${arr[2]}" != "-" ]; then
|
||||
ARGUMENTS="-g ${arr[2]} $ARGUMENTS"
|
||||
fi
|
||||
echo "groupadd -r $ARGUMENTS"
|
||||
/usr/bin/getent group "${arr[1]}" >> /dev/null || /usr/sbin/groupadd -r $ARGUMENTS || exit $?
|
||||
if [ -x /usr/sbin/groupadd ]; then
|
||||
echo "groupadd -r $ARGUMENTS"
|
||||
/usr/bin/getent group "${arr[1]}" >> /dev/null || /usr/sbin/groupadd -r $ARGUMENTS || exit $?
|
||||
elif [ -x /usr/bin/busybox ]; then
|
||||
echo "addgroup -S $ARGUMENTS"
|
||||
/usr/bin/getent group "${arr[1]}" >> /dev/null || /usr/bin/busybox addgroup -S $ARGUMENTS || exit $?
|
||||
else
|
||||
echo "ERROR: neither groupadd nor busybox found!"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
u*)
|
||||
eval arr=( $LINE )
|
||||
@ -31,13 +39,30 @@ do
|
||||
else
|
||||
ARGUMENTS="-U $ARGUMENTS"
|
||||
fi
|
||||
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 $?
|
||||
if [ -x /usr/sbin/useradd ]; then
|
||||
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 $?
|
||||
elif [ -x /usr/bin/busybox ]; then
|
||||
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 || /usr/bin/busybox adduser -S -s /sbin/nologin -g "${arr[3]}" $ARGUMENTS || exit $?
|
||||
else
|
||||
echo "ERROR: neither useradd nor busybox found!"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
m*)
|
||||
eval arr=( $LINE )
|
||||
echo "usermod -a -G ${arr[2]} ${arr[1]}"
|
||||
/usr/sbin/usermod -a -G ${arr[2]} ${arr[1]} || exit $?
|
||||
if [ -x /usr/sbin/usermod ] ; then
|
||||
echo "usermod -a -G ${arr[2]} ${arr[1]}"
|
||||
/usr/sbin/usermod -a -G ${arr[2]} ${arr[1]} || exit $?
|
||||
elif [ -x /usr/bin/busybox ]; then
|
||||
echo "addgroup ${arr[1]} ${arr[2]}"
|
||||
/usr/bin/busybox addgroup ${arr[1]} ${arr[2]} || exit $?
|
||||
else
|
||||
echo "ERROR: neither usermod nor busybox found!"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
r*)
|
||||
echo "range option ignored: \"$LINE\""
|
||||
|
Loading…
Reference in New Issue
Block a user