Don't need to duplicate error checking

This commit is contained in:
Bob Mottram 2015-09-13 14:16:26 +01:00
parent 179b3d1adb
commit 1d98ff06a8
1 changed files with 14 additions and 13 deletions

View File

@ -2418,19 +2418,20 @@ function get_mariadb_owncloud_admin_password {
function backup_directory_to_usb {
if [[ $BACKUP_TYPE == 'rsync' ]]; then
echo "rsyncrypto -v -r ${1} $USB_MOUNT/backup/${2} $USB_MOUNT/backup/${2}.keys $BACKUP_CERTIFICATE" >> /usr/bin/$BACKUP_SCRIPT_NAME
echo 'if [ ! "$?" = "0" ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo " umount $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME
echo " rm -rf $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME
if [[ ${1} == "/root/temp"* ]]; then
echo " shred -zu ${1}/*" >> /usr/bin/$BACKUP_SCRIPT_NAME
echo " rm -rf ${1}" >> /usr/bin/$BACKUP_SCRIPT_NAME
fi
echo ' exit 853' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
if [[ ${1} == "/root/temp"* ]]; then
echo "shred -zu ${1}/*" >> /usr/bin/$BACKUP_SCRIPT_NAME
echo "rm -rf ${1}" >> /usr/bin/$BACKUP_SCRIPT_NAME
fi
fi
echo 'if [ ! "$?" = "0" ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo " umount $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME
echo " rm -rf $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME
if [[ ${1} == "/root/temp"* ]]; then
echo " shred -zu ${1}/*" >> /usr/bin/$BACKUP_SCRIPT_NAME
echo " rm -rf ${1}" >> /usr/bin/$BACKUP_SCRIPT_NAME
fi
echo ' exit 853' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
if [[ ${1} == "/root/temp"* || ${1} == *"tempbackup"* ]]; then
echo "shred -zu ${1}/*" >> /usr/bin/$BACKUP_SCRIPT_NAME
echo "rm -rf ${1}" >> /usr/bin/$BACKUP_SCRIPT_NAME
fi
}