Files
shadow/tests/cptools/01/run2
nekral-guest 39beb1da3a 105_zn_CN was just applied to upstream repository.
Tag 104_man-sv, 101_ja, and 103_man-de as going to be fixed in 4.0.18.2.
2007-10-27 12:51:13 +00:00

55 lines
989 B
Bash
Executable File

#!/bin/sh
set -e
cd $(dirname $0)
# Rational:
# Test that useradd can add an user and userdel removes it.
save()
{
[ ! -d tmp ] && mkdir tmp
for i in passwd group shadow gshadow
do
[ -f /etc/$i ] && cp /etc/$i tmp/$i
done
true
}
restore()
{
for i in passwd group shadow gshadow
do
[ -f tmp/$i ] && cp tmp/$i /etc/$i && rm tmp/$i
done
rmdir tmp
}
save
# restore the files on exit
trap 'restore' 0
cp data/{passwd,shadow,group,gshadow} /etc/
lines_passwd=$(wc -l /etc/passwd | cut -f1 -d" ")
lines_shadow=$(wc -l /etc/shadow | cut -f1 -d" ")
lines_group=$(wc -l /etc/group | cut -f1 -d" ")
lines_gshadow=$(wc -l /etc/gshadow | cut -f1 -d" ")
echo -n "Copy group.new "
cpgr data/group.new
echo "OK"
echo -n "test if the password file was copied"
diff -au /etc/group data/group.new
echo " OK"
echo -n "check that the other files were not modified"
diff -au /etc/gshadow data/gshadow
diff -au /etc/passwd data/passwd
diff -au /etc/shadow data/shadow
echo " OK"