blob: 5e7823a6d1b99088368f6310e9348452fd278531 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
#!/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"
EXCLUDES="--exclude=Music"
# 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 Signal and Molly backups (to the Backups folder)."
echo "4. Run a local backup to the internal storage (to the .SeedVaultAndroidBackup 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
# Mount
go-mtpfs $SHARED &
# Check if mount was successful
if [ "$?" != "0" ]; then
echo "$BASENAME: error: unable to mount profile $PROFILE from phone $PHONE"
exit 1
fi
# Wait a bit
sleep 1
# Sync
time rsync -av --delete $EXCLUDES $SHARED/ $SYNCED/
# Umount
fusermount -u $SHARED
|