1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
#!/bin/sh
set -euo pipefail
CHROOTDIR="$AUTOPKGTEST_TMP/uid-gid"
mkdir -p "$CHROOTDIR/etc"
cp /etc/passwd /etc/group /etc/login.defs "$CHROOTDIR/etc"
if grep -q opensysusers-test-uid-gid /etc/passwd
then
printf 'test user already exists\n'
exit 1
fi
PATH="$PATH:/usr/sbin" ./sysusers --root="$CHROOTDIR" --inline 'u opensysusers-test-uid-gid -:nogroup - - -'
gid=$(grep "^nogroup:" "$CHROOTDIR/etc/group" | cut -d : -f 3)
grep opensysusers-test-uid-gid "$CHROOTDIR/etc/passwd" | grep "$gid"
|