Skip to content

Commit e85288a

Browse files
committed
v2022.5.12 202205120
- C flag: exclude all *[cC]ache* files/directories globally (alternative to -X '*[cC]ache*'); - Do not backup/restore SSAIDs if /data/system/users/0/settings_ssaid.xml is encrypted; - Updated info and support texts.
1 parent dbd1f79 commit e85288a

File tree

4 files changed

+38
-16
lines changed

4 files changed

+38
-16
lines changed

CHANGELOG

+5
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
1+
v2022.5.12 202205120
2+
- C flag: exclude all *[cC]ache* files/directories globally (alternative to -X '*[cC]ache*');
3+
- Do not backup/restore SSAIDs if /data/system/users/0/settings_ssaid.xml is encrypted;
4+
- Updated info and support texts.
5+
16
v2022.may.9 202205090
27
- Initial release

NOTICE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
This program, along with all included binaries (busybox, openssl, tar and zstd), are free and open source software.
2-
They are provided as-is, and come with absolutely no warranties.
2+
They are provided "as is", and come with absolutely no warranties.
33
One can do whatever they want with those programs, as long as they follow the terms of each license.
44

55
The binaries are provided by @osm0sis and @Zackptg5 -- credits to them, other contributors, and original authors.

README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Tarb, a backup solution for Android
1+
# Tarb, A Backup Solution for Android, With Recovery Mode Support
22

33

44
---
@@ -13,7 +13,7 @@ All required binaries/executables are included: busybox for general tools, opens
1313
## NOTICE
1414

1515
This program, along with all included binaries (busybox, openssl, tar and zstd), are free and open source software.
16-
They are provided as-is, and come with absolutely no warranties.
16+
They are provided "as is", and come with absolutely no warranties.
1717
One can do whatever they want with those programs, as long as they follow the terms of each license.
1818

1919
The binaries are provided by @osm0sis and @Zackptg5 -- credits to them, other contributors, and original authors.
@@ -66,3 +66,4 @@ Examples:
6666
- [Telegram Profile](https://t.me/vr25xda)
6767

6868
- [Upstream Repository](https://github.com/VR-25/tarb)
69+
- [XDA Thread](https://forum.xda-developers.com/t/tarb-a-backup-solution-for-android-with-recovery-mode-support.4443801)

tarb.sh

+29-13
Original file line numberDiff line numberDiff line change
@@ -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

383384
help() {
384385
cat << EOF | more
385-
Tarb, a backup solution for Android
386+
Tarb, A Backup Solution for Android, With Recovery Mode Support
386387
Copyright (C) $1, $AUTHOR
387388
License: GPLv3+
388389
$2
@@ -398,7 +399,7 @@ All required binaries/executables are included: busybox for general tools, opens
398399
NOTICE
399400
400401
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.
402403
One can do whatever they want with those programs, as long as they follow the terms of each license.
403404
404405
The 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
556559
Notes/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.
601611
EOF
602612
}
603613

@@ -912,8 +922,8 @@ PASSF=$TMPDIR/.pass
912922

913923
AUTHOR="VR-25 @ GitHub"
914924
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"
917927

918928
[ -z "${LINENO-}" ] || export PS4='$LINENO: '
919929
mkdir -p ${BKP_DIR##* } $BIN_DIR
@@ -949,14 +959,20 @@ fi
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
10281044
com.google.android.gms.appid.xml
10291045
com.termux/files/home/shift
10301046
com.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

Comments
 (0)