]> gitweb.fluxo.info Git - utils-android.git/commitdiff
Renames android-{backup,restore} to android-{backup,restore}-adb; adds android-backup-mtp
authorSilvio Rhatto <rhatto@riseup.net>
Fri, 13 Sep 2024 17:01:33 +0000 (14:01 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Fri, 13 Sep 2024 17:01:33 +0000 (14:01 -0300)
android-backup-adb [moved from android-backup with 98% similarity]
android-backup-mtp [new file with mode: 0755]
android-restore [deleted symlink]
android-restore-adb [new symlink]

similarity index 98%
rename from android-backup
rename to android-backup-adb
index 1985f6b37d9f81feb076995d3a837d41d0c8eba1..f6017429d0275b7a9bb833d27a80bf8f3887ac53 100755 (executable)
@@ -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 (executable)
index 0000000..9eda7b6
--- /dev/null
@@ -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 (symlink)
index 6ccc9f5..0000000
+++ /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 (symlink)
index 0000000..41faa6c
--- /dev/null
@@ -0,0 +1 @@
+android-backup-adb
\ No newline at end of file