diff --git a/backup.sh b/backup.sh index 2df87a8..ac9cefe 100755 --- a/backup.sh +++ b/backup.sh @@ -83,18 +83,6 @@ fi clear -# Allow the user to exclude specific files -if [ ! -v exclusions ] && [ "$export_method" = "tar" ]; then - cecho "You may optionally choose to exclude certain directories and/or files from being backed up." - cecho "Press Enter to continue." - wait_for_enter - - excluded_files=( 'no' 'yes' ) - select_option_from_list "Do you wish to add any exclusions?" excluded_files[@] exclusions -fi - -clear - if [ ! -v use_hooks ]; then cecho "Would you like to use hooks?" cecho "Choose 'no' if you don't understand this question, or don't want to load hooks." @@ -120,7 +108,18 @@ elif [ "$use_hooks" = "yes" ]; then exit 1 fi +# Allow the user to exclude specific files +# Leaving this block after the hooks integration, as we do not know if the user wants their hooks to operate on only the chosen files or not. +if [ ! -v exclusions ] && [ "$export_method" = "tar" ]; then + cecho "You may optionally choose to exclude certain directories and/or files from being backed up." + cecho "Press Enter to continue." + wait_for_enter + excluded_files=( 'no' 'yes' ) + select_option_from_list "Do you wish to add any exclusions?" excluded_files[@] exclusions +fi + +clear if command -v srm &> /dev/null then diff --git a/functions/backup_func.sh b/functions/backup_func.sh index c23b405..1402561 100644 --- a/functions/backup_func.sh +++ b/functions/backup_func.sh @@ -89,8 +89,6 @@ function backup_func() { # Receive user input # TODO: this could be much less flaky by utilizing 'toybox vi' to edit the exclusions list. Ignoring for now. adb shell printf "Exclusions:\ " && IFS= read -r exclusions_response - # sh will throw an error if this dir does not exist. This line can probably be removed. -# adb shell [ -d "/storage/emulated/0/open-android-backup-temp" ] || mkdir -p /storage/emulated/0/open-android-backup-temp # This command MUST be contained in double quotes, or else adb shell chokes on the input and our 'tar -x' fails. adb shell "echo "$exclusions_response" | sed 's/ /\n/g' > /storage/emulated/0/open-android-backup-temp/exclusions.txt" cecho "Exporting internal storage - this will take a while."