aboutsummaryrefslogtreecommitdiff
path: root/android-backup
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2017-08-29 08:57:34 -0300
committerSilvio Rhatto <rhatto@riseup.net>2017-08-29 08:57:34 -0300
commitf048e0b620819549e2cf28c2efa57620870928cc (patch)
tree5e3c92c8b54fe2ee8ea202c3c7a0e3bcef3b1da9 /android-backup
parente58cfe72b4af8cfd7f8af14512c9b8a9fe012bcd (diff)
downloadscripts-f048e0b620819549e2cf28c2efa57620870928cc.tar.gz
scripts-f048e0b620819549e2cf28c2efa57620870928cc.tar.bz2
Refactor android-backup
Diffstat (limited to 'android-backup')
-rwxr-xr-xandroid-backup32
1 files changed, 16 insertions, 16 deletions
diff --git a/android-backup b/android-backup
index 873a389..24d79a2 100755
--- a/android-backup
+++ b/android-backup
@@ -3,49 +3,49 @@
# Android backup
#
-# Pasta de trabalho
-cd ~/load
-
-# Parâmetros
+# Parameters
date="`date +%Y%m%d`"
base="/storage/emulated/0"
storage="/var/backups/remote/celular.`facter domain`/"
previous="`sudo ls -1 $storage | tac | head -n 1`"
+# Work folder
+cd ~/load || exit 1
+mkdir -p $date && cd $date
+
# Check
if [ -d "$storage/$date" ]; then
echo "backup for $date already exists"
exit 1
fi
-mkdir -p $date && cd $date
-
-# Se você tiver um backup antigo e quiser aproveitá-lo com hardlinks:
-sudo cp -alf $storage/$previous/files files
+# If you have a previous backup you might want to use it with hardlinks
+if [ -e "$storage/$previous/files" ]; then
+ sudo cp -alf $storage/$previous/files files
+fi
-# Garante a existência da pasta de arquivos
+# Ensure we have a files folder
mkdir -p files
-# Contatos
-# Exportar também para .vcf direto do aplicativo de contatos
+# Contacts. Export also to a .vcf directly from the contact app
adb-export.sh -e content://com.android.contacts/contacts
adb shell content query --uri content://com.android.contacts/contacts > contacts.rows
-# Configurações
+# Configurations
adb backup -all
-# Arquivos: cópia completa
+# Files: full copy
#adb pull $base files/
-# Remover cache multimídia do backup
+# Remove multimedia cache from backup
#rm -rf files/Music
-# Arquivos: cópia completa básica
+# Files: full basic copy
#adb shell ls -1 $base | grep -v ^Music | while read file; do
# adb pull $base/$file files/
#done
-# Arquivos: cópia incremental básica
+# Files: incremental basic copy
adb shell ls -1 $base | grep -v ^Music | while read file; do
adb-sync --delete --reverse $base/$file files/
done