aboutsummaryrefslogtreecommitdiff
path: root/android-backup
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2019-08-06 13:17:26 -0300
committerSilvio Rhatto <rhatto@riseup.net>2019-08-06 13:17:26 -0300
commit28ffe99ab5b67f7b3a490775dabb91753b0a00b3 (patch)
treea9c71c6005b0bd1e76348cf8767adffa8cac9618 /android-backup
parentd9b125e1593eeda59c2877e03f9b32d26e97aefa (diff)
downloadscripts-28ffe99ab5b67f7b3a490775dabb91753b0a00b3.tar.gz
scripts-28ffe99ab5b67f7b3a490775dabb91753b0a00b3.tar.bz2
Fixes for android-restore
Diffstat (limited to 'android-backup')
-rwxr-xr-xandroid-backup18
1 files changed, 13 insertions, 5 deletions
diff --git a/android-backup b/android-backup
index ce36f63..d270ec6 100755
--- a/android-backup
+++ b/android-backup
@@ -101,18 +101,26 @@ function android_backup_backup {
function android_backup_restore {
# Check for previous backups
- if [ ! -e "$STORAGE/$PREVIOUS/files" ]; then
+ if [ -z "$PREVIOUS" ]; then
echo "$BASENAME: no previous backups for device $NAME"
exit 1
fi
# Copy files to workfolder
- mkdir -p $WORK && sudo cp -alf $STORAGE/$PREVIOUS $WORK/android-backup-$NAME-$DATE
+ mkdir -p $WORK && sudo cp -alf $STORAGE/$PREVIOUS $WORK/android-backup-$NAME-$DATE && chown -R `whoami`. android-backup-$NAME-$DATE
+
+ # Check if copy was successful
+ if [ ! -e "$WORK/android-backup-$NAME-$DATE" ]; then
+ echo "$BASENAME: could not copy from $STORAGE/$PREVIOUS"
+ exit 1
+ fi
# Restore each user files
- for USER in $USERS; do
- android_restore_files $USER
- done
+ if [ -e "$WORK/android-backup-$NAME-$DATE" ]; then
+ for USER in $USERS; do
+ android_restore_files $USER
+ done
+ fi
# Configurations
adb restore android-backup-$NAME-$DATE/backup.ab