@@ -81,11 +81,12 @@ bkp() {
8181 | sed -E ' s/ +//; s/:.*//' > $BKP_DIR /${line% * } /runtime_perms
8282 }
8383
84- [ ! -f $SSAID ] || {
84+ # backup ssaid
85+ if grep -q ' ^\<\?xml version=' $SSAID ; then
8586 grep \" ${line% * } \" $SSAID > $BKP_DIR /${line% * } /ssaid \
8687 && echo " ssaid" \
8788 || rm $BKP_DIR /${line% * } /ssaid
88- } 2> /dev/null || :
89+ fi 2> /dev/null || :
8990
9091 } || :
9192
@@ -128,7 +129,7 @@ bkp_r() {
128129 }
129130
130131 # restore ssaid
131- if [ -f $SSAID ] && [ -f $ BKP_DIR /${line% * } /ssaid ]; then
132+ if [ -f $BKP_DIR /${line% * } /ssaid ] && grep -q ' ^\<\?xml version= ' $SSAID ; then
132133 echo " ssaid"
133134 (set -- $( cat $BKP_DIR /${line% * } /ssaid)
134135 name=$( stat -c %u /mnt/expand/* /user/0/${line% * } /data/data/${line% * } 2> /dev/null || :)
@@ -382,7 +383,7 @@ flag() {
382383
383384help () {
384385 cat << EOF | more
385- Tarb, a backup solution for Android
386+ Tarb, A Backup Solution for Android, With Recovery Mode Support
386387Copyright (C) $1 , $AUTHOR
387388License: GPLv3+
388389$2
@@ -398,7 +399,7 @@ All required binaries/executables are included: busybox for general tools, opens
398399NOTICE
399400
400401This program, along with all included binaries (busybox, openssl, tar and zstd), are free and open source software.
401- They are provided as-is , and come with absolutely no warranties.
402+ They are provided "as is" , and come with absolutely no warranties.
402403One can do whatever they want with those programs, as long as they follow the terms of each license.
403404
404405The binaries are provided by @osm0sis and @Zackptg5 -- credits to them, other contributors, and original authors.
@@ -464,6 +465,8 @@ Flags
464465
465466 c custom (paths)
466467
468+ C exclude all *[cC]ache* files/directories globally (alternative to -X '*[cC]ache*')
469+
467470 d data (user and user_de)
468471
469472 D exclude device encrypted data (data_de, from /data/user_de/)
@@ -555,6 +558,8 @@ Examples
555558
556559Notes/tips
557560
561+ NO WARRANTIES, use at your own risk!
562+
558563 Tarb copies itself to the backup directory, as needed (filename: ".tarb" (hidden)).
559564 Currently using $BKP_DIR /.
560565
@@ -576,6 +581,13 @@ Notes/tips
576581 Recovery mode support depends on whether the recovery can mount and decrypt the target storage devices (including adopted storage).
577582 System settings and app runtime permissions cannot be backed up from recovery.
578583
584+ Regular (legacy) Android ID is backed up and restored as part of generic system settings (the s flag).
585+ If $SSAID is encrypted, SSAIDs are not backed up / restored.
586+ SSAIDs seem to be tied to Google Play Services -- meaning, alterntives such as MicroG don't have this "problem".
587+
588+ While Google email accounts can be backed up manually, restoring those is not guaranteed to work.
589+ Android seems to be going the iOS way of things -- too many limitations.
590+
579591 Each app is paused before data backup, and stopped prior to restore.
580592 For obvious reasons, this does not apply to terminal emulators.
581593
@@ -595,9 +607,7 @@ Notes/tips
595607
596608 If a backup/restore fails, the old data is preserved.
597609
598- When reporting issues, one should provide as many details as possible, along with a copy of $TMPDIR /log.
599-
600- NO WARRANTIES, use at your own risk!
610+ When reporting issues, one shall provide as much information as possible, along with a copy of $TMPDIR /log.
601611EOF
602612}
603613
@@ -912,8 +922,8 @@ PASSF=$TMPDIR/.pass
912922
913923AUTHOR=" VR-25 @ GitHub"
914924COPYRIGHT_YEAR=2022
915- DESCRIPTION=" Backup/restore apps and respective data, SSAIDs, runtime permissions, system settings, Magisk modules, and more."
916- VERSION=" v2022.may.9 202205090 "
925+ DESCRIPTION=" Backup/restore apps and respective data, SSAIDs, runtime permissions, generic system settings, Magisk modules, and more."
926+ VERSION=" v2022.5.12 202205120 "
917927
918928[ -z " ${LINENO-} " ] || export PS4=' $LINENO: '
919929mkdir -p ${BKP_DIR##* } $BIN_DIR
949959 exec 3< & 0 4>&1
950960 FLAGS=${1# -?}
951961
962+ # no cache?
963+ ! flag C && : > $X || {
964+ echo " *[cC]ache*" > $X
965+ FLAGS=$( echo " $FLAGS " | tr -d C)
966+ }
967+
952968 # zstd compression level
953969 COMP_LEVEL=1
954- ! match $FLAGS " * [0-9]* " || {
970+ ! flag " [0-9]" || {
955971 COMP_LEVEL=$( echo $FLAGS | grep -Eo ' [0-9]+' )
956972 FLAGS=$( echo $FLAGS | sed -E ' s/[0-9]+//' )
957973 }
958974
959- ! match " $FLAGS " " * [nx]* " || FLAGS=ad$FLAGS
975+ ! flag " [nx]" || FLAGS=ad$FLAGS
960976 ! match " ${2-} " " */*" || FLAGS=c$FLAGS
961977 [ -n " $FLAGS " ] || FLAGS=ad
962978
@@ -1028,7 +1044,7 @@ adb/magisk.db
10281044com.google.android.gms.appid.xml
10291045com.termux/files/home/shift
10301046com.termux/files/home/storage
1031- no_backup" > $X
1047+ no_backup" >> $X
10321048
10331049 # if flag "c*|*m"; then
10341050 # sed -Ei '/(art|dex|oat|lib)$/d' $X
0 commit comments