Accepting request 871208 from home:kukuk:etc

- Use systemd-sysusers only if /proc is mounted, don't require it
- Set --replace option for systemd-sysusers

OBS-URL: https://build.opensuse.org/request/show/871208
OBS-URL: https://build.opensuse.org/package/show/Base:System/sysuser-tools?expand=0&rev=40
This commit is contained in:
Thorsten Kukuk 2021-02-11 12:54:07 +00:00 committed by Git OBS Bridge
parent 24d67490c3
commit c81af58db0
5 changed files with 23 additions and 7 deletions

View File

@ -7,7 +7,12 @@
#
# add %sysusers_requires in the package section
#
# add "%sysusers_generate_pre <source file> <account>" to build section
# add "%sysusers_generate_pre <source file> <account> [<config>]" to build section
#
## <source file> is the source file as defined in the spec file header
## <account> is just a random name, th output file will be "<account>.pre"
## <config> is the name of the configuration file as stored in
## /usr/lib/sysusers.d/<config>
#
# add "%pre -f <account>.pre" to spec file
#
@ -16,4 +21,4 @@
%sysusers_requires Requires(pre): sysuser-shadow
%sysusers_generate_pre() \
%{_prefix}/lib/rpm/sysusers-generate-pre "%1" > "%2".pre
%{_prefix}/lib/rpm/sysusers-generate-pre "%1" "%3" > "%2".pre

View File

@ -1,3 +1,13 @@
-------------------------------------------------------------------
Fri Jan 29 13:36:08 UTC 2021 - Thorsten Kukuk <kukuk@suse.com>
- Use systemd-sysusers only if /proc is mounted, don't require it
-------------------------------------------------------------------
Wed Jan 27 13:02:13 UTC 2021 - Thorsten Kukuk <kukuk@suse.com>
- Set --replace option for systemd-sysusers
-------------------------------------------------------------------
Wed Jan 20 15:06:51 UTC 2021 - Thorsten Kukuk <kukuk@suse.com>

View File

@ -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(pre): (/usr/sbin/useradd or busybox or /usr/bin/systemd-sysusers)
Requires(pre): (/usr/sbin/useradd or busybox)
# prefer original shadow over busybox by default
Suggests: shadow

View File

@ -1,6 +1,6 @@
#!/bin/sh
# pass systemd sysusers config paths as argument to this script.
echo '/usr/sbin/sysusers2shadow <<"EOF" || [ -f /.buildenv ]'
echo "/usr/sbin/sysusers2shadow $3 <<\"EOF\" || [ -f /.buildenv ]"
grep -he '^[ugmr]' "$@"
echo 'EOF'

View File

@ -7,10 +7,11 @@ run() {
"$@"
}
if [ -x /usr/bin/systemd-sysusers ]; then
if [ -x /usr/bin/systemd-sysusers ] && [ -e /proc/version ]; then
test -n "$1" && REPLACE_ARG="--replace=/usr/lib/sysusers.d/$1" ||:
# Use systemd-sysusers and let it read the input directly from stdin
/usr/bin/systemd-sysusers -
/usr/bin/systemd-sysusers $REPLACE_ARG -
# We need to clear the nscd cache, as systemd-sysusers could have
# triggered a negative cache entry
if [ -x /usr/sbin/nscd ]; then