From 0bd5365440d500fe4357293d7a880a95a8642e18 Mon Sep 17 00:00:00 2001 From: Aaron Ball Date: Wed, 25 Oct 2017 00:08:19 -0600 Subject: Fixed bug in non-existent apks Prevoiusly, we didn't check if the apk destination backup directory existed before trying to copy it in. That means that new applications will fail backup of the installer apk. Now we create the parent directory first. Also, now we check if the apk is available on the system itself. In some cases such as with system apps, the installer apk is not in an expected location. Backing up installers for system apks is pointless anyways because /system is mounted as readonly most of the time, so re-installation at a later date couldn't happen without some workarounds. --- andbackup.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/andbackup.sh b/andbackup.sh index 51b41eb..86fdefa 100755 --- a/andbackup.sh +++ b/andbackup.sh @@ -124,10 +124,10 @@ backup_app() { # No need to stop the application because we're in recovery mode # Create backup destination if not exist - [ ! -d "${backups}" ] && mkdir -p "${backups}" + [ ! -d "${backups}/${app}" ] && mkdir -p "${backups}/${app}" # Backup the apk file if it exists - if [ ! -z "${apk}" ]; then + if [ ! -z "${apk}" ] && [ -f "${apk}" ]; then # Delete the old backup first # There is a permissions issue querk when the backup was originall taken in # recovery mode, but later is taken in android (Permission denied for no -- cgit v1.2.3