summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xandbackup.sh11
1 files changed, 10 insertions, 1 deletions
diff --git a/andbackup.sh b/andbackup.sh
index 70e3552..8df40a5 100755
--- a/andbackup.sh
+++ b/andbackup.sh
@@ -101,7 +101,7 @@ backup_app() {
# Make sure app is installed
if [[ $(dumpsys package ${app} | wc -l) -eq 0 ]]; then
lerror "Package ${app} appears to not be installed."
- return 1
+ return 2
fi
linfo "Backing up ${app}"
@@ -125,6 +125,15 @@ backup_app() {
linfo "${app} apk file could not be found. Skipping apk installer backup."
fi
+ # If the data directory is not found or the data variable is empty, skip
+ # backup. This covers a weird edge case where an application is installed but
+ # hasn't been launched (I think?). The data variable would be empty, causing
+ # this script to backup /*.
+ if [ ! -d "${data:-}" ] || [ -z "${data:-}" ]; then
+ lwarn "No data directory for application '${app}' found. Skipping backup."
+ return 2
+ fi
+
# Copy the user data
cp -rp ${data}/* ${backups}/${app}/data/
# Delete cache directory if it exists

Generated by cgit