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
|
# 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() \
|
%sysusers_generate_pre() \
|
||||||
%{_prefix}/lib/rpm/sysusers-generate-pre "%1" > "%2".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
|
Thu May 9 13:23:56 CEST 2019 - kukuk@suse.de
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
|
|
||||||
Name: sysuser-tools
|
Name: sysuser-tools
|
||||||
Version: 2.0
|
Version: 3.0
|
||||||
Release: 0
|
Release: 0
|
||||||
Summary: Auto provides for system users
|
Summary: Auto provides for system users
|
||||||
License: MIT
|
License: MIT
|
||||||
@ -38,7 +38,7 @@ Generate auto provides for system users.
|
|||||||
%package -n sysuser-shadow
|
%package -n sysuser-shadow
|
||||||
Summary: Tool to execute sysusers.d with shadow utilities
|
Summary: Tool to execute sysusers.d with shadow utilities
|
||||||
Group: System/Packages
|
Group: System/Packages
|
||||||
Requires: shadow
|
Requires: useradd_or_adduser_dep
|
||||||
|
|
||||||
%description -n sysuser-shadow
|
%description -n sysuser-shadow
|
||||||
This package contians a tool, which expects as input a sysusers.d
|
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
|
if [ ! -z "${arr[2]}" -a "${arr[2]}" != "-" ]; then
|
||||||
ARGUMENTS="-g ${arr[2]} $ARGUMENTS"
|
ARGUMENTS="-g ${arr[2]} $ARGUMENTS"
|
||||||
fi
|
fi
|
||||||
echo "groupadd -r $ARGUMENTS"
|
if [ -x /usr/sbin/groupadd ]; then
|
||||||
/usr/bin/getent group "${arr[1]}" >> /dev/null || /usr/sbin/groupadd -r $ARGUMENTS || exit $?
|
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*)
|
u*)
|
||||||
eval arr=( $LINE )
|
eval arr=( $LINE )
|
||||||
@ -25,19 +33,36 @@ do
|
|||||||
else
|
else
|
||||||
ARGUMENTS="-d / $ARGUMENTS"
|
ARGUMENTS="-d / $ARGUMENTS"
|
||||||
fi
|
fi
|
||||||
/usr/bin/getent group ${arr[1]} >> /dev/null
|
/usr/bin/getent group ${arr[1]} >> /dev/null
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
ARGUMENTS="-g ${arr[1]} $ARGUMENTS"
|
ARGUMENTS="-g ${arr[1]} $ARGUMENTS"
|
||||||
else
|
else
|
||||||
ARGUMENTS="-U $ARGUMENTS"
|
ARGUMENTS="-U $ARGUMENTS"
|
||||||
fi
|
fi
|
||||||
echo "useradd -r -s /sbin/nologin -c \"${arr[3]}\" $ARGUMENTS"
|
if [ -x /usr/sbin/useradd ]; then
|
||||||
/usr/bin/getent passwd ${arr[1]} >> /dev/null || /usr/sbin/useradd -r -s /sbin/nologin -c "${arr[3]}" $ARGUMENTS || exit $?
|
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*)
|
m*)
|
||||||
eval arr=( $LINE )
|
eval arr=( $LINE )
|
||||||
echo "usermod -a -G ${arr[2]} ${arr[1]}"
|
if [ -x /usr/sbin/usermod ] ; then
|
||||||
/usr/sbin/usermod -a -G ${arr[2]} ${arr[1]} || exit $?
|
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*)
|
r*)
|
||||||
echo "range option ignored: \"$LINE\""
|
echo "range option ignored: \"$LINE\""
|
||||||
|
Loading…
Reference in New Issue
Block a user