From 5ee5d8445fc770f8980c75d8117638f0acf4a2a9 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 22 Sep 2015 19:43:02 +0100 Subject: [PATCH] Echo --- src/freedombone | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/freedombone b/src/freedombone index 6bfb8881..19f5d4a2 100755 --- a/src/freedombone +++ b/src/freedombone @@ -2416,10 +2416,9 @@ function get_mariadb_owncloud_admin_password { } function backup_directory_to_usb { - if [ ! -d ${1} ]; then - echo "WARNING: directory does not exist: ${1}" - return - fi + echo "if [ ! -d ${1} ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME + echo " echo \"WARNING: directory does not exist: ${1}\"" >> /usr/bin/$BACKUP_SCRIPT_NAME + echo 'else' >> /usr/bin/$BACKUP_SCRIPT_NAME if [[ $BACKUP_TYPE == 'obnam' ]]; then BACKUP_KEY_EXISTS=$(gpg --list-keys "$MY_NAME (backup key)") @@ -2428,25 +2427,26 @@ function backup_directory_to_usb { exit 43382 fi MY_BACKUP_KEY_ID=$(gpg --list-keys "$MY_NAME (backup key)" | grep 'pub ' | awk -F ' ' '{print $2}' | awk -F '/' '{print $2}') - echo "obnam backup -r $USB_MOUNT/backup/${2} --encrypt-with $MY_BACKUP_KEY_ID ${1}" >> /usr/bin/$BACKUP_SCRIPT_NAME + echo " obnam backup -r $USB_MOUNT/backup/${2} --encrypt-with $MY_BACKUP_KEY_ID ${1}" >> /usr/bin/$BACKUP_SCRIPT_NAME else # For rsyncrypto usage see http://archive09.linux.com/feature/125322 - echo "rsyncrypto -v -r ${1} $USB_MOUNT/backup/${2} $USB_MOUNT/backup/${2}.keys $BACKUP_CERTIFICATE" >> /usr/bin/$BACKUP_SCRIPT_NAME + echo " rsyncrypto -v -r ${1} $USB_MOUNT/backup/${2} $USB_MOUNT/backup/${2}.keys $BACKUP_CERTIFICATE" >> /usr/bin/$BACKUP_SCRIPT_NAME 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 + 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"* || ${1} == *"tempbackup" ]]; 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 - 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 } function backup_database {