#!/usr/bin/ksh
version="PATCH"
function install_patch
{
backup_patch
# cp -rf ${path}/update_${version}/* ${install_home}/
}
function restore_patch
{
echo "Begin to restore file ..."
if [ -d ${path}/update_${version} ]; then
find ${path}/update_${version} -type f > restore.txt
echo "#!/usr/bin/ksh" > restore.sh
while read line
do
echo "rm -rf ${line} " >> restore.sh
done < restore.txt
localpath="${path}/update_${version}"
sed "s:${localpath}:${install_home}:" restore.sh > restore_tmp.sh
mv restore_tmp.sh restore.sh
chmod +x restore.sh
./restore.sh
fi
cp -rf ${path}/backup_${version}/* ${install_home}/
}