backuptool: Properly unmount system partition
For non AB devices system partition should be unmounted
if check_prereq function fails.
This patch also refactors backuptool a bit for AB devices
in order to look same as backuptool for non AB devices.
Change-Id: Ia1f4ae95c9e4dae4df844853e81c264bc838f177
diff --git a/prebuilt/common/bin/backuptool_ab.sh b/prebuilt/common/bin/backuptool_ab.sh
index 2a8c3d9..d542700 100755
--- a/prebuilt/common/bin/backuptool_ab.sh
+++ b/prebuilt/common/bin/backuptool_ab.sh
@@ -50,10 +50,11 @@
return 0
fi
-grep -q "^ro.omni.version=$V.*" /product/build.prop && return 1
-
-echo "Not backing up files from incompatible version: $V"
-return 0
+if ! grep -q "^ro.omni.version=$V.*" /product/build.prop; then
+ echo "Not backing up files from incompatible version: $V"
+ return 0
+fi
+return 1
}
# Execute /system/addon.d/*.sh scripts with $1 parameter
@@ -78,10 +79,8 @@
case "$1" in
backup)
mkdir -p $C
- if check_prereq; then
- if check_whitelist postinstall/system; then
- exit 127
- fi
+ if ! check_prereq; then
+ exit 127
fi
log -t "update_engine" "backuptool_ab.sh backup"
@@ -91,10 +90,8 @@
run_stage post-backup
;;
restore)
- if check_prereq; then
- if check_whitelist postinstall/tmp; then
- exit 127
- fi
+ if ! check_prereq; then
+ exit 127
fi
log -t "update_engine" "backuptool_ab.sh restore"