From c81af58db038865f2ff6eaa21f9ac24d631cab909db9f5229e535ed065473882 Mon Sep 17 00:00:00 2001 From: Thorsten Kukuk Date: Thu, 11 Feb 2021 12:54:07 +0000 Subject: [PATCH 1/3] 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 --- macros.sysusers | 9 +++++++-- sysuser-tools.changes | 10 ++++++++++ sysuser-tools.spec | 2 +- sysusers-generate-pre | 2 +- sysusers2shadow.sh | 7 ++++--- 5 files changed, 23 insertions(+), 7 deletions(-) diff --git a/macros.sysusers b/macros.sysusers index d96156c..394c4af 100644 --- a/macros.sysusers +++ b/macros.sysusers @@ -7,7 +7,12 @@ # # add %sysusers_requires in the package section # -# add "%sysusers_generate_pre " to build section +# add "%sysusers_generate_pre []" to build section +# +## is the source file as defined in the spec file header +## is just a random name, th output file will be ".pre" +## is the name of the configuration file as stored in +## /usr/lib/sysusers.d/ # # add "%pre -f .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 diff --git a/sysuser-tools.changes b/sysuser-tools.changes index 6ec3470..9bae581 100644 --- a/sysuser-tools.changes +++ b/sysuser-tools.changes @@ -1,3 +1,13 @@ +------------------------------------------------------------------- +Fri Jan 29 13:36:08 UTC 2021 - Thorsten Kukuk + +- Use systemd-sysusers only if /proc is mounted, don't require it + +------------------------------------------------------------------- +Wed Jan 27 13:02:13 UTC 2021 - Thorsten Kukuk + +- Set --replace option for systemd-sysusers + ------------------------------------------------------------------- Wed Jan 20 15:06:51 UTC 2021 - Thorsten Kukuk diff --git a/sysuser-tools.spec b/sysuser-tools.spec index 0a9f429..a8505a0 100644 --- a/sysuser-tools.spec +++ b/sysuser-tools.spec @@ -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 diff --git a/sysusers-generate-pre b/sysusers-generate-pre index 4cc2620..9d6897e 100644 --- a/sysusers-generate-pre +++ b/sysusers-generate-pre @@ -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' diff --git a/sysusers2shadow.sh b/sysusers2shadow.sh index 08a7209..ebb9d50 100644 --- a/sysusers2shadow.sh +++ b/sysusers2shadow.sh @@ -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 @@ -29,7 +30,7 @@ else eval set -- $LINE case "${1-}" in \#*|"") - ;; + ;; g) shift ARGUMENTS="$1" From 1877b519f470fb07b0e1890193ed5fad648a8052e03157c7855e9207b5ce01cf Mon Sep 17 00:00:00 2001 From: Thorsten Kukuk Date: Thu, 11 Feb 2021 13:54:52 +0000 Subject: [PATCH 2/3] Accepting request 871218 from home:kukuk:etc - Remove sysusers/nscd workaround OBS-URL: https://build.opensuse.org/request/show/871218 OBS-URL: https://build.opensuse.org/package/show/Base:System/sysuser-tools?expand=0&rev=41 --- sysuser-tools.changes | 5 +++++ sysusers2shadow.sh | 10 +++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/sysuser-tools.changes b/sysuser-tools.changes index 9bae581..167ebe8 100644 --- a/sysuser-tools.changes +++ b/sysuser-tools.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Thu Feb 11 13:54:01 UTC 2021 - Thorsten Kukuk + +- Remove sysusers/nscd workaround + ------------------------------------------------------------------- Fri Jan 29 13:36:08 UTC 2021 - Thorsten Kukuk diff --git a/sysusers2shadow.sh b/sysusers2shadow.sh index ebb9d50..6f2352e 100644 --- a/sysusers2shadow.sh +++ b/sysusers2shadow.sh @@ -9,15 +9,11 @@ run() { if [ -x /usr/bin/systemd-sysusers ] && [ -e /proc/version ]; then - test -n "$1" && REPLACE_ARG="--replace=/usr/lib/sysusers.d/$1" ||: + if [ -n "$1" ]; then + REPLACE_ARG="--replace=/usr/lib/sysusers.d/$1" ||: + fi # Use systemd-sysusers and let it read the input directly from stdin /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 - /usr/sbin/nscd -i passwd ||: - /usr/sbin/nscd -i group ||: - fi else # Absolute path to busybox, if found From cf63454c7bc32f91d6478d3221c4b2095e384bd2c40fa06a2ae7f60dcb5120d5 Mon Sep 17 00:00:00 2001 From: Thorsten Kukuk Date: Mon, 15 Feb 2021 07:31:11 +0000 Subject: [PATCH 3/3] Accepting request 872279 from home:kukuk:etc - Don't abort on unbound first argument OBS-URL: https://build.opensuse.org/request/show/872279 OBS-URL: https://build.opensuse.org/package/show/Base:System/sysuser-tools?expand=0&rev=42 --- sysuser-tools.changes | 5 +++++ sysusers2shadow.sh | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/sysuser-tools.changes b/sysuser-tools.changes index 167ebe8..0c2810d 100644 --- a/sysuser-tools.changes +++ b/sysuser-tools.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Mon Feb 15 07:30:25 UTC 2021 - Thorsten Kukuk + +- Don't abort on unbound first argument + ------------------------------------------------------------------- Thu Feb 11 13:54:01 UTC 2021 - Thorsten Kukuk diff --git a/sysusers2shadow.sh b/sysusers2shadow.sh index 6f2352e..7988133 100644 --- a/sysusers2shadow.sh +++ b/sysusers2shadow.sh @@ -1,5 +1,5 @@ #!/bin/sh -set -eu +set -e # Print the command and run it run() {