From 81802b47121b6d85c3c995e254b5e258d4032f813436d581ca483763153cc4e0 Mon Sep 17 00:00:00 2001 From: Thorsten Kukuk Date: Tue, 17 Mar 2020 14:34:59 +0000 Subject: [PATCH] Accepting request 785867 from home:favogt:branches:openSUSE:Factory - Drop use of tail from the generated %pre scriptlets I'll try dropping the bash dep next. A pure lua implementation is possible, but would require some work and is IMO not really necessary. If any of those users are needed, there's very likely also a shell available. For system-user-root it's already pure lua. OBS-URL: https://build.opensuse.org/request/show/785867 OBS-URL: https://build.opensuse.org/package/show/Base:System/sysuser-tools?expand=0&rev=22 --- sysuser-tools.changes | 5 +++++ sysuser-tools.spec | 2 +- sysusers-generate-pre | 26 ++++---------------------- 3 files changed, 10 insertions(+), 23 deletions(-) diff --git a/sysuser-tools.changes b/sysuser-tools.changes index 1c3f2ad..5435114 100644 --- a/sysuser-tools.changes +++ b/sysuser-tools.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Tue Mar 17 10:12:15 UTC 2020 - Fabian Vogt + +- Drop use of tail from the generated %pre scriptlets + ------------------------------------------------------------------- Sun Dec 29 19:16:13 UTC 2019 - kukuk@suse.de diff --git a/sysuser-tools.spec b/sysuser-tools.spec index e687589..e77250c 100644 --- a/sysuser-tools.spec +++ b/sysuser-tools.spec @@ -1,7 +1,7 @@ # # spec file for package sysuser-tools # -# Copyright (c) 2019 SUSE LLC +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed diff --git a/sysusers-generate-pre b/sysusers-generate-pre index c79114a..ff32446 100644 --- a/sysusers-generate-pre +++ b/sysusers-generate-pre @@ -1,26 +1,8 @@ #!/bin/bash # pass systemd sysusers config files a as argument to this script. -# It will output a shell script that creates those users by -# appending the data to itself. - -tmpfile=`mktemp -q -t sysusers.XXXXXX` -cleanup() -{ - rm -f "$tmpfile" -} - -trap cleanup EXIT - -for i in "$@"; do - grep -e '^[ugmr]' "$i" >> "$tmpfile" -done - -lines=`wc -l < "$tmpfile"` echo '#!/bin/bash' -echo "tail -n $lines \$0 | /usr/sbin/sysusers2shadow" -echo 'RET=$?' -echo 'test -f /.buildenv && exit 0' -echo 'exit $RET' -echo '######## data below ########' -cat "$tmpfile" +echo 'cat <<"EOF" |' +grep -he '^[ugmr]' "$@" +echo 'EOF' +echo '/usr/sbin/sysusers2shadow || [[ -f /.buildenv ]]' \ No newline at end of file