diff options
author | Aaron Ball <nullspoon@oper.io> | 2018-07-07 00:33:35 -0600 |
---|---|---|
committer | Aaron Ball <nullspoon@oper.io> | 2018-07-07 00:37:37 -0600 |
commit | d62372d41c04998165104b8ad068beddf8f29b74 (patch) | |
tree | 2b09cc529f9d889b15a814ed50d4abf669a5707f | |
parent | 66c35a714b1c2dc17b740643a5813471b7fdaaa9 (diff) | |
download | andbackup-d62372d41c04998165104b8ad068beddf8f29b74.tar.gz andbackup-d62372d41c04998165104b8ad068beddf8f29b74.tar.xz |
Rewrite app enumeration function
Previously this relied on screenscraping and parsing output from the pm
tool, which changes between android versions. To maintain better
compatibility, we now list installed apps by looking into the /data/app
path.
Note that this includes shell code to parse out a substring that isn't
strictly POSIX compliant. It however does work on three different models
of phones, so is *probably* compatible. This might need to be reverted
if not though.
-rwxr-xr-x | andbackup.sh | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/andbackup.sh b/andbackup.sh index 4296973..6232fe2 100755 --- a/andbackup.sh +++ b/andbackup.sh @@ -174,7 +174,9 @@ backup_app() { list_apps() { - pm list package | cut -d ':' -f 2 | sort + for i in $(ls /data/app); do + printf "%s\n" "${i%-*}" + done } |