@@ -81,11 +81,12 @@ bkp() {
81
81
| sed -E ' s/ +//; s/:.*//' > $BKP_DIR /${line% * } /runtime_perms
82
82
}
83
83
84
- [ ! -f $SSAID ] || {
84
+ # backup ssaid
85
+ if grep -q ' ^\<\?xml version=' $SSAID ; then
85
86
grep \" ${line% * } \" $SSAID > $BKP_DIR /${line% * } /ssaid \
86
87
&& echo " ssaid" \
87
88
|| rm $BKP_DIR /${line% * } /ssaid
88
- } 2> /dev/null || :
89
+ fi 2> /dev/null || :
89
90
90
91
} || :
91
92
@@ -128,7 +129,7 @@ bkp_r() {
128
129
}
129
130
130
131
# 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
132
133
echo " ssaid"
133
134
(set -- $( cat $BKP_DIR /${line% * } /ssaid)
134
135
name=$( stat -c %u /mnt/expand/* /user/0/${line% * } /data/data/${line% * } 2> /dev/null || :)
@@ -382,7 +383,7 @@ flag() {
382
383
383
384
help () {
384
385
cat << EOF | more
385
- Tarb, a backup solution for Android
386
+ Tarb, A Backup Solution for Android, With Recovery Mode Support
386
387
Copyright (C) $1 , $AUTHOR
387
388
License: GPLv3+
388
389
$2
@@ -398,7 +399,7 @@ All required binaries/executables are included: busybox for general tools, opens
398
399
NOTICE
399
400
400
401
This 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.
402
403
One can do whatever they want with those programs, as long as they follow the terms of each license.
403
404
404
405
The binaries are provided by @osm0sis and @Zackptg5 -- credits to them, other contributors, and original authors.
@@ -464,6 +465,8 @@ Flags
464
465
465
466
c custom (paths)
466
467
468
+ C exclude all *[cC]ache* files/directories globally (alternative to -X '*[cC]ache*')
469
+
467
470
d data (user and user_de)
468
471
469
472
D exclude device encrypted data (data_de, from /data/user_de/)
@@ -555,6 +558,8 @@ Examples
555
558
556
559
Notes/tips
557
560
561
+ NO WARRANTIES, use at your own risk!
562
+
558
563
Tarb copies itself to the backup directory, as needed (filename: ".tarb" (hidden)).
559
564
Currently using $BKP_DIR /.
560
565
@@ -576,6 +581,13 @@ Notes/tips
576
581
Recovery mode support depends on whether the recovery can mount and decrypt the target storage devices (including adopted storage).
577
582
System settings and app runtime permissions cannot be backed up from recovery.
578
583
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
+
579
591
Each app is paused before data backup, and stopped prior to restore.
580
592
For obvious reasons, this does not apply to terminal emulators.
581
593
@@ -595,9 +607,7 @@ Notes/tips
595
607
596
608
If a backup/restore fails, the old data is preserved.
597
609
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.
601
611
EOF
602
612
}
603
613
@@ -912,8 +922,8 @@ PASSF=$TMPDIR/.pass
912
922
913
923
AUTHOR=" VR-25 @ GitHub"
914
924
COPYRIGHT_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 "
917
927
918
928
[ -z " ${LINENO-} " ] || export PS4=' $LINENO: '
919
929
mkdir -p ${BKP_DIR##* } $BIN_DIR
949
959
exec 3< & 0 4>&1
950
960
FLAGS=${1# -?}
951
961
962
+ # no cache?
963
+ ! flag C && : > $X || {
964
+ echo " *[cC]ache*" > $X
965
+ FLAGS=$( echo " $FLAGS " | tr -d C)
966
+ }
967
+
952
968
# zstd compression level
953
969
COMP_LEVEL=1
954
- ! match $FLAGS " * [0-9]* " || {
970
+ ! flag " [0-9]" || {
955
971
COMP_LEVEL=$( echo $FLAGS | grep -Eo ' [0-9]+' )
956
972
FLAGS=$( echo $FLAGS | sed -E ' s/[0-9]+//' )
957
973
}
958
974
959
- ! match " $FLAGS " " * [nx]* " || FLAGS=ad$FLAGS
975
+ ! flag " [nx]" || FLAGS=ad$FLAGS
960
976
! match " ${2-} " " */*" || FLAGS=c$FLAGS
961
977
[ -n " $FLAGS " ] || FLAGS=ad
962
978
@@ -1028,7 +1044,7 @@ adb/magisk.db
1028
1044
com.google.android.gms.appid.xml
1029
1045
com.termux/files/home/shift
1030
1046
com.termux/files/home/storage
1031
- no_backup" > $X
1047
+ no_backup" >> $X
1032
1048
1033
1049
# if flag "c*|*m"; then
1034
1050
# sed -Ei '/(art|dex|oat|lib)$/d' $X
0 commit comments