Debian Codegraph @

tests/grouptools/chgpasswd/25_chgpasswd-e_no_gshadow_file/chgpasswd.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" "chgpasswd changes the group file if gshadow does not exist"
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 "Remove /etc/gshadow..."
20 rm -f /etc/gshadow
21 echo "OK"
22
23 echo -n "Change nogroup's and lp's password..."
24 echo 'nogroup:test
25 lp:test2' | chgpasswd -e
26 echo "OK"
27
28 echo -n "Check the passwd file..."
29 ../../../common/compare_file.pl config/etc/passwd /etc/passwd
30 echo "OK"
31 echo -n "Check the group file..."
32 ../../../common/compare_file.pl data/group /etc/group
33 echo "OK"
34 echo -n "Check the gshadow file..."
35 ../../../common/compare_file.pl config/etc/shadow /etc/shadow
36 echo "OK"
37 echo -n "Check that gshadow does not exist..."
38 test ! -f /etc/gshadow
39 echo "OK"
40
41 log_status "$0" "SUCCESS"
42 restore_config
43 trap '' 0
44