From 317660511a10f92956e78ea3791cdd9dc14de7a4 Mon Sep 17 00:00:00 2001 From: Aaron Ball Date: Fri, 7 Oct 2016 17:02:48 -0600 Subject: 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. --- andbackup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100755 => 100644 andbackup.sh diff --git a/andbackup.sh b/andbackup.sh old mode 100755 new mode 100644 index d68fc23..a93ae52 --- 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 -- cgit v1.2.3