backuptool: Disregard known bad backup scripts
Keep a blacklist of md5 sums for scripts known to cause issues, and
ignore them when installing new builds
Change-Id: I19a88b58194a32da5eb5fe278f2c5b9a145b57be
diff --git a/config/common.mk b/config/common.mk
index 7689760..b776cd8 100644
--- a/config/common.mk
+++ b/config/common.mk
@@ -74,7 +74,8 @@
PRODUCT_COPY_FILES += \
vendor/cm/prebuilt/common/bin/backuptool.sh:system/bin/backuptool.sh \
vendor/cm/prebuilt/common/bin/backuptool.functions:system/bin/backuptool.functions \
- vendor/cm/prebuilt/common/bin/50-cm.sh:system/addon.d/50-cm.sh
+ vendor/cm/prebuilt/common/bin/50-cm.sh:system/addon.d/50-cm.sh \
+ vendor/cm/prebuilt/common/bin/blacklist:system/addon.d/blacklist
# init.d support
PRODUCT_COPY_FILES += \
diff --git a/prebuilt/common/bin/backuptool.sh b/prebuilt/common/bin/backuptool.sh
index 68b1ff8..c576be3 100755
--- a/prebuilt/common/bin/backuptool.sh
+++ b/prebuilt/common/bin/backuptool.sh
@@ -28,6 +28,17 @@
fi
}
+check_blacklist() {
+ if [ -f /system/addon.d/blacklist ];then
+ ## Discard any known bad backup scripts
+ cd /$1/addon.d/
+ for f in *sh; do
+ s=$(md5sum $f | awk {'print $1'})
+ grep -q $s /system/addon.d/blacklist && rm -f $f
+ done
+ fi
+}
+
# Execute /system/addon.d/*.sh scripts with $1 parameter
run_stage() {
for script in $(find /tmp/addon.d/ -name '*.sh' |sort -n); do
@@ -39,6 +50,7 @@
backup)
mkdir -p $C
check_prereq
+ check_blacklist system
preserve_addon_d
run_stage pre-backup
run_stage backup
@@ -46,6 +58,7 @@
;;
restore)
check_prereq
+ check_blacklist tmp
run_stage pre-restore
run_stage restore
run_stage post-restore
diff --git a/prebuilt/common/bin/blacklist b/prebuilt/common/bin/blacklist
new file mode 100644
index 0000000..03c36c4
--- /dev/null
+++ b/prebuilt/common/bin/blacklist
@@ -0,0 +1,4 @@
+80f99c594f7b82c4cbe533e3f5447729
+29f4bab6bae5959458678869350dc888
+77d73f73da664f3592e712b7e7c107c1
+a5019b358023a3a6ae8be3f3380ba5ca