You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
906 B
26 lines
906 B
10 months ago
|
#!/bin/bash
|
||
|
# Author: Iain Douglas <centos@1n6.org.uk>
|
||
|
|
||
|
t_Log "Running $0"
|
||
|
echo "*****************************************************************"
|
||
|
echo "Note: The original /etc/passwd and /etc/shadow files are saved to"
|
||
|
echo "directory /var/tmp/pwconv".
|
||
|
echo "*****************************************************************"
|
||
|
|
||
|
cleanup(){
|
||
|
echo "Reverting files to original state"
|
||
|
[[ -d /var/tmp/pwconv ]] && cp /var/tmp/pwconv/* /etc
|
||
|
t_CheckExitStatus $?
|
||
|
}
|
||
|
|
||
|
# check that /etc/passwd and /etc/shadow exist before continuing.
|
||
|
[[ -e /etc/passwd && -e /etc/shadow ]] || { t_Log "FAIL: missing source file"; exit $FAIL; }
|
||
|
|
||
|
mkdir -p /var/tmp/pwconv || { t_Log "FAIL: Unable to create directory to save source files in "; exit $FAIL; }
|
||
|
cp /etc/passwd /etc/shadow /var/tmp/pwconv || { t_Log "FAIL: Unable to save source files"; exit $FAIL; }
|
||
|
trap cleanup EXIT
|
||
|
echo "Running pwconv"
|
||
|
pwconv
|
||
|
t_CheckExitStatus $?
|
||
|
|