diff options
author | Aaron Ball <nullspoon@iohq.net> | 2016-10-07 17:02:48 -0600 |
---|---|---|
committer | Aaron Ball <nullspoon@iohq.net> | 2016-10-07 17:02:48 -0600 |
commit | 317660511a10f92956e78ea3791cdd9dc14de7a4 (patch) | |
tree | ccee753605fe6433dbd63ed61dbcee2c473be647 /andbackup.sh | |
parent | 3b7614f65e01a4f74779f866732dee3e3699dd07 (diff) | |
download | andbackup-317660511a10f92956e78ea3791cdd9dc14de7a4.tar.gz andbackup-317660511a10f92956e78ea3791cdd9dc14de7a4.tar.xz |
Fixed 'already-installed' check on nougat
Nougat's dumpsys command returns an error message to stdout when a
package is checked that is not installed. Marshmallow returns nothing.
This changes the 'already-installed' check to look for positive
confirmation with 'userId' rather than a negative confirmation of line
count of 0.
Diffstat (limited to 'andbackup.sh')
-rw-r--r--[-rwxr-xr-x] | andbackup.sh | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/andbackup.sh b/andbackup.sh index d68fc23..a93ae52 100755..100644 --- a/andbackup.sh +++ b/andbackup.sh @@ -101,7 +101,7 @@ function restore_app { # Install app if it is not yet installed if [[ ! -f "${backups}/${app}/base.apk" ]]; then echo "Installer for ${app} not found. Only restoring data." - elif [[ $(dumpsys package ${app} | wc -l) -eq 0 ]]; then + elif [[ $(dumpsys package ${app} | grep -c userId) -eq 0 ]]; then echo "Installer detected but package ${app} is not installed. Installing" pm install ${backups}/${app}/base.apk fi |