1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
#!/bin/sh
set -euo pipefail
CHROOTDIR="$AUTOPKGTEST_TMP/root"
mkdir -p "$CHROOTDIR/etc"
cp /etc/passwd /etc/group /etc/login.defs "$CHROOTDIR/etc"
if grep -q opensysusers-test-root /etc/passwd
then
printf 'test user already exists\n'
exit 1
fi
PATH="$PATH:/usr/sbin" ./sysusers --root="$CHROOTDIR" --inline 'u opensysusers-test-root - - - -'
grep opensysusers-test-root "$CHROOTDIR/etc/passwd"
if grep -q opensysusers-test-root /etc/passwd
then
printf 'test user should not exist outside the chroot\n'
exit 1
fi
|