2017-02-16 16:08:58 +01:00
|
|
|
#!/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
|
2017-03-15 14:47:36 +01:00
|
|
|
grep -e '^[ugmr]' "$i" >> "$tmpfile"
|
2017-02-16 16:08:58 +01:00
|
|
|
done
|
|
|
|
|
|
|
|
lines=`wc -l < "$tmpfile"`
|
|
|
|
|
|
|
|
echo '#!/bin/bash'
|
2017-05-30 10:58:34 +02:00
|
|
|
echo "tail -n $lines \$0 | /usr/bin/systemd-sysusers -"
|
2017-02-16 16:08:58 +01:00
|
|
|
echo "exit 0"
|
|
|
|
echo '######## data below ########'
|
|
|
|
cat "$tmpfile"
|