]> gitweb.fluxo.info Git - scripts.git/commitdiff
Feat: android-backup: sync sd cards
authorSilvio Rhatto <rhatto@riseup.net>
Tue, 18 Jul 2023 22:49:58 +0000 (19:49 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Tue, 18 Jul 2023 22:49:58 +0000 (19:49 -0300)
android-backup

index d270ec62b8f4d16426929c259a821820dc63d308..1985f6b37d9f81feb076995d3a837d41d0c8eba1 100755 (executable)
@@ -15,24 +15,30 @@ function android_backup_files {
     USER_ID="0"
   fi
 
-  BASE="/storage/emulated/$USER_ID"
+  BASE="/storage"
+  EMULATED="$BASE/emulated/$USER_ID"
 
   # Files: full copy
-  #adb pull $BASE files/
+  #adb pull $EMULATED files/
 
   # Remove multimedia cache from backup
   #rm -rf files/Music
 
   # Files: full basic copy
-  #adb shell ls -1 $BASE | grep -v ^Music | while read file; do
-  #  adb pull $BASE/$file files/
+  #adb shell ls -1 $EMULATED | grep -v ^Music | while read file; do
+  #  adb pull $EMULATED/$file files/
   #done
 
   mkdir -p files/$USER_ID
 
   # Files: incremental basic copy
-  for file in `adb shell ls -1 $BASE | grep -v '^Music'`; do
-    adb-sync --delete --reverse $BASE/$file files/$USER_ID/
+  for file in `adb shell ls -1 $EMULATED | grep -v '^Music'`; do
+    adb-sync --delete --reverse $EMULATED/$file files/$USER_ID/
+  done
+
+  # SD cards
+  for file in `adb shell ls -1 $BASE | grep -v "^self" | grep -v "^emulated"`; do
+    adb-sync --delete --reverse $BASE/$file files/
   done
 }