Check that directory exists

This commit is contained in:
Bob Mottram 2015-10-26 21:37:22 +00:00
parent a906d43ea1
commit b1c2bfa0f4
1 changed files with 13 additions and 11 deletions

View File

@ -3418,19 +3418,21 @@ function create_restore_script {
echo ' for d in /home/*/ ; do' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' USERNAME=$(echo "$d" | awk -F '"'"'/'"'"' '"'"'{print $3}'"'"')' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' if [[ $USERNAME != "git" ]]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' echo "Restoring personal settings for $USERNAME"' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' restore_directory_from_usb /root/temppersonal personal/$USERNAME' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' if [ -d /home/$USERNAME/personal ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' rm -rf /home/$USERNAME/personal' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo -n " mv /root/temppersonal/${RESTORE_SUBDIR}" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' if [ -d $USB_MOUNT/backup/personal/$USERNAME ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' echo "Restoring personal settings for $USERNAME"' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' restore_directory_from_usb /root/temppersonal personal/$USERNAME' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' if [ -d /home/$USERNAME/personal ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' rm -rf /home/$USERNAME/personal' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo -n " mv /root/temppersonal/${RESTORE_SUBDIR}" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo '$USERNAME/personal /home/$USERNAME' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' umount $USB_MOUNT' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' rm -rf $USB_MOUNT' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' exit 184' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' umount $USB_MOUNT' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' rm -rf $USB_MOUNT' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' exit 184' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' rm -rf /root/temppersonal' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' rm -rf /root/temppersonal' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' done' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo 'fi' >> /usr/bin/$RESTORE_SCRIPT_NAME