Debian Codegraph @

tests/usertools/userdel/08_userdel_usergroup_with_other_members/userdel.test

raw
1 #!/bin/sh
2
3 set -e
4
5 cd $(dirname $0)
6
7 . ../../../common/config.sh
8 . ../../../common/log.sh
9
10 log_start "$0" "userdel does not remove the user's group if is has other members"
11
12 save_config
13
14 # restore the files on exit
15 trap 'log_status "$0" "FAILURE"; restore_config' 0
16
17 change_config
18
19 echo -n "Delete user foo (userdel foo)..."
20 userdel foo 2>tmp/userdel.out
21 echo "OK"
22
23 echo "userdel reported:"
24 echo "======================================================================="
25 cat tmp/userdel.out
26 echo "======================================================================="
27 echo -n "Check the usage message..."
28 diff -au data/userdel.out tmp/userdel.out
29 echo "usage message OK."
30 rm -f tmp/userdel.out
31
32 echo -n "Check the passwd file..."
33 ../../../common/compare_file.pl data/passwd /etc/passwd
34 echo "OK"
35 echo -n "Check the group file..."
36 ../../../common/compare_file.pl data/group /etc/group
37 echo "OK"
38 echo -n "Check the shadow file..."
39 ../../../common/compare_file.pl data/shadow /etc/shadow
40 echo "OK"
41 echo -n "Check the gshadow file..."
42 ../../../common/compare_file.pl data/gshadow /etc/gshadow
43 echo "OK"
44
45 log_status "$0" "SUCCESS"
46 restore_config
47 trap '' 0
48