Blame tests/p_shadow-utils/37-grpconv-tests

Athmane Madjoudj 536354
#!/bin/bash
Athmane Madjoudj 536354
# Author: Iain Douglas <centos@1n6.org.uk>
Athmane Madjoudj 536354
Christoph Galuschka 06c925
t_Log "Running $0"
Athmane Madjoudj 536354
# Test grpconv
Athmane Madjoudj 536354
cleanup() {
Athmane Madjoudj 536354
echo "Reverting files to original state"
Athmane Madjoudj 536354
[[ -e /var/tmp/grpconv/gshadow ]] &&  cp /var/tmp/grpconv/* /etc && rm -r /var/tmp/grpconv
Athmane Madjoudj 536354
}
Athmane Madjoudj 536354
Athmane Madjoudj 536354
# Check we have a group file to work with and exit if not
Athmane Madjoudj 536354
[[ -e /etc/group ]] || { t_Log "Fail: /etc/group does not exist"; exit $FAIL; }
Athmane Madjoudj 536354
Athmane Madjoudj 536354
mkdir -p /var/tmp/grpconv &>/dev/null
Athmane Madjoudj 536354
Athmane Madjoudj 536354
# If it exists, save the /etc/gshadow file then delete it
Athmane Madjoudj 536354
[[ -e /etc/gshadow ]] && cp /etc/gshadow /var/tmp/gconv || { t_Log "FAIL: unable to make a safe copy of /etc/gshadow"; exit $FAIL; }
Athmane Madjoudj 536354
Athmane Madjoudj 536354
[[ -e /etc/gshadow ]] && rm /etc/gshadow || { t_Log "FAIL: unable to remove /etc/gshadow"; exit $FAIL;}
Athmane Madjoudj 536354
Athmane Madjoudj 536354
trap cleanup EXIT
Athmane Madjoudj 536354
echo "Test grpconv creates a new /etc/gshadow" 
Athmane Madjoudj 536354
grpconv 
Athmane Madjoudj 536354
t_CheckExitStatus $?
Athmane Madjoudj 536354
echo "Check format is correct with grpck"
Athmane Madjoudj 536354
grpck 
Athmane Madjoudj 536354
t_CheckExitStatus $?
Athmane Madjoudj 536354