From 64ff0626a6cf790934fbc7993c47bac1704dc701 Mon Sep 17 00:00:00 2001 From: w1nst0n Date: Sat, 12 Sep 2020 01:05:57 +0200 Subject: [PATCH] Fixed a bug with the CUSTOM_LIST generation from previous commit --- debloat_script.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/debloat_script.sh b/debloat_script.sh index 6fe5b57..b4a1de8 100755 --- a/debloat_script.sh +++ b/debloat_script.sh @@ -111,7 +111,7 @@ main() { printf "\n${BORANGE}%s\n" "==================== $title ====================" printf "%s\n" "# #" printf "%-14s${NC}%s${BORANGE}%14s\n" "#" "1 - $title a package" "#" | awk '{print tolower($0)}' - (( BRAND_SUPPORTED )) && printf "#${NC}%12s n2 - ${BRAND} %$((25-${#BRAND}))s ${BORANGE} #\n" + (( BRAND_SUPPORTED )) && printf "#${NC}%10s 2 - ${BRAND} %$((25-${#BRAND}))s ${BORANGE} #\n" printf "%-14s${NC}%s${BORANGE}%27s\n" "#" "3 - GFAM" "#" printf "%-14s${NC}%s${BORANGE}%23s\n" "#" "4 - Carriers" "#" printf "%-14s${NC}%s${BORANGE}%25s\n" "#" "5 - Others" "#" @@ -143,9 +143,12 @@ main() { generate_custom_list(){ [[ -v "$1" ]] && local -n list=$1 - printf "%s\n" "${list[@]}" >> "list.txt"; - readarray -t CUSTOM_LIST < <(comm -12 <(sort -i list.txt) <(sort -i remaining_packages.txt)) - rm list.txt + if (( RESTORE == 1 )); then + readarray -t CUSTOM_LIST < <(comm -12 <(for p in "${list[@]}"; do echo "${p}"; done|sort -i) \ + <(adb shell 'pm list packages -s -u' | sed -r 's/package://g' | sort -i)) + else + readarray -t CUSTOM_LIST < <(comm -12 <(for p in "${list[@]}"; do echo "${p}"; done|sort -i) <(sort -i remaining_packages.txt)) + fi } debloat_or_restore() {