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
This commit is contained in:
parent
5ae470e24a
commit
129989b172
3 changed files with 19 additions and 1 deletions
|
@ -74,7 +74,8 @@ PRODUCT_COPY_FILES += \
|
||||||
PRODUCT_COPY_FILES += \
|
PRODUCT_COPY_FILES += \
|
||||||
vendor/cm/prebuilt/common/bin/backuptool.sh:system/bin/backuptool.sh \
|
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/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
|
# init.d support
|
||||||
PRODUCT_COPY_FILES += \
|
PRODUCT_COPY_FILES += \
|
||||||
|
|
|
@ -28,6 +28,17 @@ if ( ! grep -q "^ro.cm.version=$V.*" /system/build.prop ); then
|
||||||
fi
|
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
|
# Execute /system/addon.d/*.sh scripts with $1 parameter
|
||||||
run_stage() {
|
run_stage() {
|
||||||
for script in $(find /tmp/addon.d/ -name '*.sh' |sort -n); do
|
for script in $(find /tmp/addon.d/ -name '*.sh' |sort -n); do
|
||||||
|
@ -39,6 +50,7 @@ case "$1" in
|
||||||
backup)
|
backup)
|
||||||
mkdir -p $C
|
mkdir -p $C
|
||||||
check_prereq
|
check_prereq
|
||||||
|
check_blacklist system
|
||||||
preserve_addon_d
|
preserve_addon_d
|
||||||
run_stage pre-backup
|
run_stage pre-backup
|
||||||
run_stage backup
|
run_stage backup
|
||||||
|
@ -46,6 +58,7 @@ case "$1" in
|
||||||
;;
|
;;
|
||||||
restore)
|
restore)
|
||||||
check_prereq
|
check_prereq
|
||||||
|
check_blacklist tmp
|
||||||
run_stage pre-restore
|
run_stage pre-restore
|
||||||
run_stage restore
|
run_stage restore
|
||||||
run_stage post-restore
|
run_stage post-restore
|
||||||
|
|
4
prebuilt/common/bin/blacklist
Normal file
4
prebuilt/common/bin/blacklist
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
80f99c594f7b82c4cbe533e3f5447729
|
||||||
|
29f4bab6bae5959458678869350dc888
|
||||||
|
77d73f73da664f3592e712b7e7c107c1
|
||||||
|
a5019b358023a3a6ae8be3f3380ba5ca
|
Loading…
Reference in a new issue