-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathadb-uninstall
More file actions
executable file
·43 lines (34 loc) · 836 Bytes
/
Copy pathadb-uninstall
File metadata and controls
executable file
·43 lines (34 loc) · 836 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash -eu
#
# Uninstall unwanted packages
#
function adb_uninstall()
{
local serial=$1 pkg=$2
echo "-- $pkg"
adb -s "$serial" uninstall --user 0 "$pkg" </dev/null || true
adb -s "$serial" shell pm uninstall --user 0 "$pkg" </dev/null || true
adb -s "$serial" uninstall "$pkg" </dev/null || true
adb -s "$serial" shell pm uninstall "$pkg" </dev/null || true
}
if [ $# -lt 1 ] ; then
echo "Usage: $(basename "$0") <SERIAL> [PACKAGE...]" >&2
exit 2
fi
serial=$1
shift
model=$(adb -s "$serial" shell getprop ro.product.model | tr ' ' '-')
echo "-- Model: $model"
echo
if [ $# -gt 0 ] ; then
for pkg in "$@" ; do
adb_uninstall "$serial" "$pkg"
done
else
while read -r pkg _ ; do
case "$pkg" in
"#"*|"") ;;
*) adb_uninstall "$serial" "$pkg" ;;
esac
done < "$(dirname "$0")"/android/"$model".packages
fi