diff --git a/man/freedombone-backup-local.1.gz b/man/freedombone-backup-local.1.gz index ef937397..9a66ea2c 100644 Binary files a/man/freedombone-backup-local.1.gz and b/man/freedombone-backup-local.1.gz differ diff --git a/src/freedombone-backup-local b/src/freedombone-backup-local index fc7416ea..9dc856b9 100755 --- a/src/freedombone-backup-local +++ b/src/freedombone-backup-local @@ -197,17 +197,6 @@ function make_backup_directory { fi } -function remove_backup_directory { - if [ $1 ]; then - if [[ $1 == "remove" ]]; then - if [ ! -d $USB_MOUNT/backup ]; then - rm -rf $USB_MOUNT/backup - echo $'Existing backup directory removed' - fi - fi - fi -} - function check_storage_space_remaining { # Check space remaining on the usb drive used_percent=$(df -k $USB_MOUNT | tail -n 1 | awk -F ' ' '{print $5}' | awk -F '%' '{print $1}') @@ -342,8 +331,27 @@ function backup_directories { done } +function remove_backup_directory { + if [ $1 ]; then + if [[ $1 == "remove" ]]; then + if [ ! -d $USB_MOUNT/backup ]; then + rm -rf $USB_MOUNT/backup + echo $'Existing backup directory removed' + unmount_drive + exit 0 + fi + fi + fi +} + +# has the remove option been set ? +remove_option=$2 +if [[ $1 == "remove" ]]; then + remove_option=$1 +fi + mount_drive $1 $2 -remove_backup_directory $2 +remove_backup_directory $remove_option make_backup_directory check_storage_space_remaining backup_users