forked from pool/sysuser-tools
Accepting request 1099442 from home:olh:branches:Base:System
- Version 3.2 - update sysusers_requires to request sysuser-shadow 3.2 - Use TAB consistently for indention in sysusers2shadow.sh - This pkg needs to follow behavior which is described in sysusers.d(5). Always create a system group of the same name as the system user, even if the user already exists. (bsc#1205161, bsc#1207778, bsc#1213240) - Disable systemd-sysuser on SLE15 to stay compatible (disable-systemd-sysusers.patch) OBS-URL: https://build.opensuse.org/request/show/1099442 OBS-URL: https://build.opensuse.org/package/show/Base:System/sysuser-tools?expand=0&rev=54
This commit is contained in:
parent
59868ddda3
commit
a509a811ad
24
disable-systemd-sysusers.patch
Normal file
24
disable-systemd-sysusers.patch
Normal file
@ -0,0 +1,24 @@
|
||||
# Disable usage of systemd-sysusers for SLE15 to stay compatible
|
||||
|
||||
--- sysusers2shadow.sh.old 2021-09-08 15:06:18.000000000 +0200
|
||||
+++ sysusers2shadow.sh 2021-11-26 10:37:20.911541368 +0100
|
||||
@@ -7,14 +7,6 @@
|
||||
"$@"
|
||||
}
|
||||
|
||||
-if [ -x /usr/bin/systemd-sysusers ] && [ -e /proc/version ]; then
|
||||
-
|
||||
- if [ -n "$1" ] && [ "$1" != "%3" ]; then
|
||||
- REPLACE_ARG="--replace=/usr/lib/sysusers.d/$1" ||:
|
||||
- fi
|
||||
- # Use systemd-sysusers and let it read the input directly from stdin
|
||||
- run /usr/bin/systemd-sysusers $REPLACE_ARG -
|
||||
-else
|
||||
|
||||
# Absolute path to busybox, if found
|
||||
busybox=
|
||||
@@ -115,4 +115,3 @@
|
||||
;;
|
||||
esac
|
||||
done
|
||||
-fi
|
@ -18,7 +18,7 @@
|
||||
#
|
||||
###
|
||||
|
||||
%sysusers_requires Requires(pre): sysuser-shadow >= 3.1
|
||||
%sysusers_requires Requires(pre): sysuser-shadow >= 3.2
|
||||
|
||||
%sysusers_generate_pre() \
|
||||
%{_prefix}/lib/rpm/sysusers-generate-pre "%1" "%3" >> "%2".pre
|
||||
|
@ -1,3 +1,13 @@
|
||||
-------------------------------------------------------------------
|
||||
Tue Jul 18 18:18:18 UTC 2023 - olaf@aepfle.de
|
||||
|
||||
- Version 3.2
|
||||
- update sysusers_requires to request sysuser-shadow 3.2
|
||||
- Use TAB consistently for indention in sysusers2shadow.sh
|
||||
- This pkg needs to follow behavior which is described in sysusers.d(5).
|
||||
Always create a system group of the same name as the system user,
|
||||
even if the user already exists. (bsc#1205161, bsc#1207778, bsc#1213240)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Jul 17 17:17:17 UTC 2023 - olaf@aepfle.de
|
||||
|
||||
@ -15,6 +25,12 @@ Tue Feb 1 12:58:30 UTC 2022 - Dirk Müller <dmueller@suse.com>
|
||||
|
||||
- invoke bash for bash scripts (bsc#1195391)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Nov 26 09:43:02 UTC 2021 - Thorsten Kukuk <kukuk@suse.com>
|
||||
|
||||
- Disable systemd-sysuser on SLE15 to stay compatible
|
||||
(disable-systemd-sysusers.patch)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Sep 8 09:12:05 UTC 2021 - Thorsten Kukuk <kukuk@suse.com>
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
|
||||
Name: sysuser-tools
|
||||
Version: 3.1
|
||||
Version: 3.2
|
||||
Release: 0
|
||||
Summary: Auto provides for system users
|
||||
License: MIT
|
||||
@ -27,6 +27,7 @@ Source1: sysusers.attr
|
||||
Source2: sysusers-generate-pre
|
||||
Source3: macros.sysusers
|
||||
Source4: sysusers2shadow.sh
|
||||
Patch: disable-systemd-sysusers.patch
|
||||
BuildArch: noarch
|
||||
Requires: sysuser-shadow
|
||||
#!BuildIgnore: sysuser-shadow
|
||||
@ -56,6 +57,9 @@ and groups from it like systemd-sysusers would do.
|
||||
|
||||
%prep
|
||||
%setup -qcT
|
||||
%if 0%{?suse_version} <= 1500
|
||||
patch < %_sourcedir/disable-systemd-sysusers.patch %_sourcedir/sysusers2shadow.sh
|
||||
%endif
|
||||
|
||||
%build
|
||||
|
||||
|
@ -9,100 +9,108 @@ run() {
|
||||
|
||||
if [ -x /usr/bin/systemd-sysusers ] && [ -e /proc/version ]; then
|
||||
|
||||
if [ -n "$1" ] && [ "$1" != "%3" ]; then
|
||||
REPLACE_ARG="--replace=/usr/lib/sysusers.d/$1" ||:
|
||||
fi
|
||||
# Use systemd-sysusers and let it read the input directly from stdin
|
||||
run /usr/bin/systemd-sysusers $REPLACE_ARG -
|
||||
if [ -n "$1" ] && [ "$1" != "%3" ]; then
|
||||
REPLACE_ARG="--replace=/usr/lib/sysusers.d/$1" ||:
|
||||
fi
|
||||
# Use systemd-sysusers and let it read the input directly from stdin
|
||||
run /usr/bin/systemd-sysusers $REPLACE_ARG -
|
||||
else
|
||||
|
||||
# Absolute path to busybox, if found
|
||||
busybox=
|
||||
for i in /bin/busybox /usr/bin/busybox; do [ -x "$i" ] && busybox=$i; done
|
||||
# Absolute path to busybox, if found
|
||||
busybox=
|
||||
for i in /bin/busybox /usr/bin/busybox; do [ -x "$i" ] && busybox=$i; done
|
||||
|
||||
while read LINE
|
||||
do
|
||||
# "eval set" to do proper splitting while respecting quotes
|
||||
eval set -- $LINE
|
||||
case "${1-}" in
|
||||
\#*|"")
|
||||
;;
|
||||
g)
|
||||
shift
|
||||
ARGUMENTS="$1"
|
||||
if [ -n "${2-}" ] && [ "$2" != "-" ]; then
|
||||
ARGUMENTS="-g $2 $ARGUMENTS"
|
||||
fi
|
||||
|
||||
if ! /usr/bin/getent group "$1" >> /dev/null; then
|
||||
if [ -x "/usr/sbin/groupadd" ]; then
|
||||
run /usr/sbin/groupadd -r $ARGUMENTS
|
||||
elif [ -x "$busybox" ]; then
|
||||
run $busybox addgroup -S $ARGUMENTS
|
||||
else
|
||||
echo "ERROR: neither groupadd nor busybox found!"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
while read LINE
|
||||
do
|
||||
# "eval set" to do proper splitting while respecting quotes
|
||||
eval set -- $LINE
|
||||
case "${1-}" in
|
||||
\#*|"")
|
||||
;;
|
||||
u)
|
||||
shift
|
||||
ARGUMENTS="$1"
|
||||
if [ -n "${2-}" ] && [ "$2" != "-" ]; then
|
||||
ARGUMENTS="-u $2 $ARGUMENTS"
|
||||
fi
|
||||
homedir="/" # If null, empty or '-'
|
||||
if [ "${4:--}" != "-" ]; then
|
||||
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
|
||||
if /usr/bin/getent group "$1" >> /dev/null; then
|
||||
ARGUMENTS="-g $1 $ARGUMENTS"
|
||||
else
|
||||
ARGUMENTS="-U $ARGUMENTS"
|
||||
g)
|
||||
shift
|
||||
ARGUMENTS="$1"
|
||||
if [ -n "${2-}" ] && [ "$2" != "-" ]; then
|
||||
ARGUMENTS="-g $2 $ARGUMENTS"
|
||||
fi
|
||||
|
||||
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 group "$1" >> /dev/null; then
|
||||
if [ -x "/usr/sbin/groupadd" ]; then
|
||||
run /usr/sbin/groupadd -r $ARGUMENTS
|
||||
elif [ -x "$busybox" ]; then
|
||||
run $busybox addgroup -S $ARGUMENTS
|
||||
else
|
||||
echo "ERROR: neither groupadd nor busybox found!"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
u)
|
||||
shift
|
||||
ARGUMENTS="$1"
|
||||
if [ -n "${2-}" ] && [ "$2" != "-" ]; then
|
||||
ARGUMENTS="-u $2 $ARGUMENTS"
|
||||
fi
|
||||
homedir="/" # If null, empty or '-'
|
||||
if [ "${4:--}" != "-" ]; then
|
||||
homedir="$4"
|
||||
fi
|
||||
|
||||
if ! /usr/bin/getent passwd "$1" >> /dev/null; then
|
||||
run $busybox adduser -S -H -g "$3" -G "$1" -h "${homedir}" $ARGUMENTS
|
||||
fi
|
||||
else
|
||||
echo "ERROR: neither useradd nor busybox found!"
|
||||
exit 1
|
||||
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
|
||||
if /usr/bin/getent group "$1" >> /dev/null; then
|
||||
ARGUMENTS="-g $1 $ARGUMENTS"
|
||||
else
|
||||
ARGUMENTS="-U $ARGUMENTS"
|
||||
fi
|
||||
|
||||
run /usr/sbin/useradd -r -c "$3" -d "${homedir}" $ARGUMENTS
|
||||
fi
|
||||
if ! /usr/bin/getent group "$1" >> /dev/null; then
|
||||
if [ -x /usr/sbin/groupadd ]; then
|
||||
run /usr/sbin/groupadd -r "$1"
|
||||
else
|
||||
echo "ERROR: groupadd not found!"
|
||||
exit 1
|
||||
fi
|
||||
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 -g "$3" -G "$1" -h "${homedir}" $ARGUMENTS
|
||||
fi
|
||||
else
|
||||
echo "ERROR: neither useradd nor busybox found!"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
m)
|
||||
shift
|
||||
if [ -x /usr/sbin/usermod ] ; then
|
||||
run /usr/sbin/usermod -a -G $2 $1
|
||||
elif [ -x "$busybox" ]; then
|
||||
run $busybox addgroup $1 $2
|
||||
else
|
||||
echo "ERROR: neither usermod nor busybox found!"
|
||||
exit 1
|
||||
fi
|
||||
m)
|
||||
shift
|
||||
if [ -x /usr/sbin/usermod ] ; then
|
||||
run /usr/sbin/usermod -a -G $2 $1
|
||||
elif [ -x "$busybox" ]; then
|
||||
run $busybox addgroup $1 $2
|
||||
else
|
||||
echo "ERROR: neither usermod nor busybox found!"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
r)
|
||||
echo "range option ignored: \"$LINE\""
|
||||
r)
|
||||
echo "range option ignored: \"$LINE\""
|
||||
;;
|
||||
*)
|
||||
echo "Syntax Error: \"$LINE\""
|
||||
exit 1
|
||||
*)
|
||||
echo "Syntax Error: \"$LINE\""
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user