aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2024-09-13 14:01:33 -0300
committerSilvio Rhatto <rhatto@riseup.net>2024-09-13 14:01:33 -0300
commit1d5630d6c4d45d8ab2954e6c3b11886a4f268317 (patch)
tree6a185b623100ac1cf62ed6b0a068eb24f3489665
parent7c97d1f94d5774a53892297a1bc4b168595b93a7 (diff)
downloadutils-android-1d5630d6c4d45d8ab2954e6c3b11886a4f268317.tar.gz
utils-android-1d5630d6c4d45d8ab2954e6c3b11886a4f268317.tar.bz2
Renames android-{backup,restore} to android-{backup,restore}-adb; adds android-backup-mtp
-rwxr-xr-xandroid-backup-adb (renamed from android-backup)4
-rwxr-xr-xandroid-backup-mtp54
l---------android-restore1
l---------android-restore-adb1
4 files changed, 57 insertions, 3 deletions
diff --git a/android-backup b/android-backup-adb
index 1985f6b..f601742 100755
--- a/android-backup
+++ b/android-backup-adb
@@ -1,6 +1,6 @@
#!/bin/bash
#
-# Android backup
+# Android backups using ADB
#
# Basic parameters
@@ -152,7 +152,7 @@ sudo mkdir -p $STORAGE
PREVIOUS="`sudo ls -1 $STORAGE | tac | head -n 1`"
# Dispatch
-if [ "$BASENAME" == "android-backup" ]; then
+if [ "$BASENAME" == "android-backup-adb" ]; then
android_backup_backup
else
android_backup_restore
diff --git a/android-backup-mtp b/android-backup-mtp
new file mode 100755
index 0000000..9eda7b6
--- /dev/null
+++ b/android-backup-mtp
@@ -0,0 +1,54 @@
+#!/usr/bin/env bash
+#
+# Android backups using MTP
+#
+# Overall procedure
+#
+# PROFILE="profile-name"
+# PHONE="phone-name"
+# go-mtpfs ~/temp/shared/$PHONE/$PROFILE &
+# time rsync -av --delete ~/temp/shared/$PHONE/$PROFILE/ ~/sync/$PHONE/$PROFILE/
+# fusermount -u ~/temp/shared/$PHONE/$PROFILE
+#
+
+# Parameters
+BASENAME="`basename $0`"
+PHONE="$1"
+PROFILE="$2"
+SHARED="$HOME/temp/shared/$PHONE/$PROFILE"
+SYNCED="$HOME/sync/$PHONE/$PROFILE"
+COMMANDS="go-mtpfs rsync fusermount"
+
+# Syntax check
+if [ -z "$PROFILE" ]; then
+ echo "usage: $BASENAME <phone> <profile>"
+
+ echo ""
+ echo "Overall procedure:"
+ echo ""
+ echo "For each user profile:"
+ echo ""
+ echo "1. Log into the profile on the phone."
+ echo "2. Export the contacts somewhere like Backups/Contacts/contacts.vcf."
+ echo "3. Run a local backup to the internal storage (to the .SeedVaultAndroidBackup folder)."
+ echo "4. Run Signal and Molly backups (to the Backups folder)."
+ echo "4. Mount the profile folder in the computer."
+ echo "5. Sync the profile in the respective folder."
+ echo ""
+ echo "The last two steps are done through $BASENAME commend"
+
+ exit 1
+fi
+
+# Commands check
+for tool in $COMMANDS; do
+ if ! which $tool &> /dev/null; then
+ echo "error: please install $tool"
+ exit 1
+ fi
+done
+
+# Backup
+go-mtpfs $SHARED &
+time rsync -av --delete $SHARED/ $SYNCED/
+fusermount -u $SHARED
diff --git a/android-restore b/android-restore
deleted file mode 120000
index 6ccc9f5..0000000
--- a/android-restore
+++ /dev/null
@@ -1 +0,0 @@
-android-backup \ No newline at end of file
diff --git a/android-restore-adb b/android-restore-adb
new file mode 120000
index 0000000..41faa6c
--- /dev/null
+++ b/android-restore-adb
@@ -0,0 +1 @@
+android-backup-adb \ No newline at end of file