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
920 B
26 lines
920 B
12 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/pwunconv".
|
||
|
echo "*****************************************************************"
|
||
|
|
||
|
cleanup(){
|
||
|
echo "Reverting files to original state"
|
||
|
[[ -d /var/tmp/pwunconv ]] && cp /var/tmp/pwunconv/* /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/pwunconv || { t_Log "FAIL: Unable to create directory to save source files in "; exit $FAIL; }
|
||
|
cp /etc/passwd /etc/shadow /var/tmp/pwunconv || { t_Log "FAIL: Unable to save source files"; exit $FAIL; }
|
||
|
trap cleanup EXIT
|
||
|
echo "Running pwunconv"
|
||
|
pwunconv
|
||
|
t_CheckExitStatus $?
|
||
|
|