1
0
forked from pool/sysuser-tools
sysuser-tools/sysusers-generate-pre
Thorsten Kukuk c35174b874 Accepting request 504523 from home:kukuk:sysusers
- Put helper script into own subpackage
- Convert sysusers config file to shadow arguments and use
  shadow suite to create user and groups. Fixes [bsc#1041497] and
  serveral dependency loops.

OBS-URL: https://build.opensuse.org/request/show/504523
OBS-URL: https://build.opensuse.org/package/show/Base:System/sysuser-tools?expand=0&rev=7
2017-06-19 06:26:55 +00:00

25 lines
491 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 "exit 0"
echo '######## data below ########'
cat "$tmpfile"