summaryrefslogtreecommitdiff
path: root/archive/bin/dionysusbk
blob: 410ea91a16634d444d82ba84a968156a209e82f4 (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
#!/usr/bin/env bash

DIONYSUS="/media/usb0"
DEST="$HOME/lib/annex/old/androidbk"

# check we can go ahead setup the temporary directory

if ! [ -d "$DIONYSUS/DCIM" ]; then
    echo "$(basename $0): phone microsd doesn't look to be mounted"
    exit 1
fi

cd $(TMPDIR=~/tmp mktemp -d)
mkdir temp-tar

# backup photos

mkdir incoming-photos
if rsync -qavc $DIONYSUS/DCIM/ incoming-photos; then
    rm -r $DIONYSUS/DCIM/*
fi

mkdir incoming-img
if rsync -qavc $DIONYSUS/Pictures/ incoming-img; then
    rm -r $DIONYSUS/Pictures
fi

# backup Kakao

if rsync -qavc $DIONYSUS/Chats/ temp-tar; then
    rm -r $DIONYSUS/Chats
fi

# backup contacts CSV file

if rsync -qavc $DIONYSUS/Backup.Contacts.*.csv temp-tar; then
    rm $DIONYSUS/Backup.Contacts.*.csv
fi

# tar it all up
cd temp-tar
tar cf $DEST/$(date +dionysus_%F.tar) *
cd ..

# conclusion: output instructions for backup procedure

echo "Done in $(pwd).  Now see backup procedure notes in Emacs."

# echo "Go there and open up the tar file and check everything is there."
# echo "Then move the tar file into annex, check through and move photos,"
# echo "into annex and nuke $(pwd)/temp-tar and Dropbox photos."