Dirk Mueller
2f5a50dce3
I think this should finally cater to all cases, and still allow us to have proper error handling on actual systems OBS-URL: https://build.opensuse.org/request/show/532757 OBS-URL: https://build.opensuse.org/package/show/Base:System/sysuser-tools?expand=0&rev=13
27 lines
544 B
Bash
27 lines
544 B
Bash
#!/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"
|