diff options
author | Aaron Ball <nullspoon@oper.io> | 2017-10-25 00:08:19 -0600 |
---|---|---|
committer | Aaron Ball <nullspoon@oper.io> | 2017-10-25 00:08:19 -0600 |
commit | 0bd5365440d500fe4357293d7a880a95a8642e18 (patch) | |
tree | 395f92c6e4b4f5a028122ee82f84281f9e07313f /andbackup.sh | |
parent | b9347c64bc9598150f714ff10e25e1e6825d4958 (diff) | |
download | andbackup-0bd5365440d500fe4357293d7a880a95a8642e18.tar.gz andbackup-0bd5365440d500fe4357293d7a880a95a8642e18.tar.xz |
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.
Diffstat (limited to 'andbackup.sh')
-rwxr-xr-x | andbackup.sh | 4 |
1 files 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 |