diff options
author | Aaron Kling <webgeek1234@gmail.com> | 2020-04-23 19:53:15 -0500 |
---|---|---|
committer | Aaron Kling <webgeek1234@gmail.com> | 2020-08-12 22:54:34 -0500 |
commit | ecbf3a14162f05ca8647ab83aed3bc2a2c8ce76d (patch) | |
tree | f9e867598f5b22dd8298151466e08e6ec5543d9b | |
parent | 400e4fa40d8a7538d893f1e2a3fc813f95f64df4 (diff) | |
download | external_wget-ecbf3a14162f05ca8647ab83aed3bc2a2c8ce76d.tar.gz external_wget-ecbf3a14162f05ca8647ab83aed3bc2a2c8ce76d.tar.bz2 external_wget-ecbf3a14162f05ca8647ab83aed3bc2a2c8ce76d.zip |
backuptool: Only run functions if check_prereqs succeeds
Based on Ic977dba675df58a228ef4b882b25beb66cc9d2c6
Change-Id: I19ea62c521df285cd3277ba4f385b408f49f6d83
-rwxr-xr-x | prebuilt/common/bin/backuptool.sh | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/prebuilt/common/bin/backuptool.sh b/prebuilt/common/bin/backuptool.sh index 719473e8..7ab703ee 100755 --- a/prebuilt/common/bin/backuptool.sh +++ b/prebuilt/common/bin/backuptool.sh @@ -47,13 +47,13 @@ restore_addon_d() { check_prereq() { # If there is no build.prop file the partition is probably empty. if [ ! -r $S/build.prop ]; then - exit 127 + return 1 fi if ! grep -q "^ro.lineage.version=$V.*" $S/build.prop; then echo "Not backing up files from incompatible version: $V" - exit 127 + return 2 fi -return 1 +return 0 } # Execute /system/addon.d/*.sh scripts with $1 parameter @@ -93,23 +93,25 @@ determine_system_mount case "$1" in backup) mount_system - mkdir -p $C - check_prereq - preserve_addon_d - run_stage pre-backup - run_stage backup - run_stage post-backup + if check_prereq; then + mkdir -p $C + preserve_addon_d + run_stage pre-backup + run_stage backup + run_stage post-backup + fi unmount_system ;; restore) mount_system - check_prereq - run_stage pre-restore - run_stage restore - run_stage post-restore - restore_addon_d - rm -rf $C - sync + if check_prereq; then + run_stage pre-restore + run_stage restore + run_stage post-restore + restore_addon_d + rm -rf $C + sync + fi unmount_system ;; *) |