forked from pool/sysuser-tools
25 lines
496 B
Plaintext
25 lines
496 B
Plaintext
|
#!/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 '^[ug]' "$i" >> "$tmpfile"
|
||
|
done
|
||
|
|
||
|
lines=`wc -l < "$tmpfile"`
|
||
|
|
||
|
echo '#!/bin/bash'
|
||
|
echo "tail -n $lines \$0 | /usr/bin/systemd-sysusers - || :"
|
||
|
echo "exit 0"
|
||
|
echo '######## data below ########'
|
||
|
cat "$tmpfile"
|