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-06-19 08:26:55 +02:00
|
|
|
echo "tail -n $lines \$0 | /usr/sbin/sysusers2shadow"
|
2017-02-16 16:08:58 +01:00
|
|
|
echo "exit 0"
|
|
|
|
echo '######## data below ########'
|
|
|
|
cat "$tmpfile"
|