enabling backup before debloating

This commit is contained in:
w1nst0n 2019-03-30 19:39:12 +01:00
parent 33e77cd10f
commit 311eb5897e

View file

@ -12,10 +12,10 @@ function debloat {
bloat=("${!name}") bloat=("${!name}")
for i in "${bloat[@]}"; do for i in "${bloat[@]}"; do
adb shell " adb shell "
printf '${RED}$i${NC} --> ' printf '${RED}$i${NC} --> '
pm uninstall --user 0 $i pm uninstall --user 0 $i
" "
done done
} }
@ -49,6 +49,17 @@ function restore {
adb shell "restore backup.ab" adb shell "restore backup.ab"
} }
function check_backup {
set -o pipefail
for a in *.adb; do
echo "Vérification de la sauvegarde ($a)";
dd if="$a" bs=24 skip=1 | zlib-flate -uncompress | tar tf - >/dev/null;
if [ $? = 0 ]; then
printf "${RED}${bold}La sauvegarde généré est intègre${normal}${NC}\n"
else printf "${RED}${bold}La sauvegarde généré est corrompue ! ${normal}${NC}\n"
fi
done
}
clear clear
printf "\n ================================================\n" printf "\n ================================================\n"
@ -63,10 +74,16 @@ printf " ================================================\n"
sleep 1 sleep 1
echo echo
adb devices adb devices
# printf "${RED}${bold}Sauvegarde des données du téléphone...${normal}${NC}\n"
# adb backup '-apk -shared -all -f backup.ab' printf "${RED}${bold}Voulez vous faire une sauvegarde du téléphone (recommandé) ? ${normal}${NC}\n"
# echo "Vous avez peut-être besoin de confirmer cette sauvegarde depuis votre téléphone" read -p "YES / NO : "
# printf "${RED}${bold}Sauvegarde effectuée !${normal}${NC}\n" if [[ $REPLY =~ [Yy]*[Ee]*[Ss]* ]]; then
echo
adb backup -apk -all -system -f "${PHONE:-phone}-`date +%Y%m%d-%H%M%S`.adb" # -noshare option is default
check_backup;
else printf "${RED}${bold}Pas de sauvegarde${normal}${NC}\n"
fi
# marque=$(adb shell getprop | grep manufacturer) # marque=$(adb shell getprop | grep manufacturer)
@ -91,19 +108,19 @@ while true; do
echo echo
case $action in case $action in
1) list ;; 1) list ;;
2) remove ;; 2) remove ;;
3) install ;; 3) install ;;
4) debloat google_bloat ;; 4) debloat google_bloat ;;
5) debloat samsung_bloat ;; 5) debloat samsung_bloat ;;
6) debloat T_Mobile_bloat ;; 6) debloat T_Mobile_bloat ;;
7) debloat amazon_bloat ;; 7) debloat amazon_bloat ;;
8) debloat facebook_bloat ;; 8) debloat facebook_bloat ;;
9) debloat microsoft_bloat ;; 9) debloat microsoft_bloat ;;
10) debloat misc_bloat ;; 10) debloat misc_bloat ;;
11) debloat huawei_bloat;; 11) debloat huawei_bloat;;
12) debloat generic_bloat ;; 12) debloat generic_bloat ;;
13) debloat xiaomi_bloat ;; 13) debloat xiaomi_bloat ;;
"exit") break ;; "exit") break ;;
esac esac
done done