-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_buppy.sh
executable file
·97 lines (77 loc) · 2.69 KB
/
test_buppy.sh
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/opt/bin/bash
function execute_buppy {
sleep 1
($1)
if [ -e "dest/snapLastDiffCpComp.tar.gz.enc" ]; then
openssl enc -aes-256-cbc -d -in dest/snapLastDiffCpComp.tar.gz.enc -out decoded_Comp.tar.gz -k TheSecretKey
fi
if [ -e "dest/snapLastDiffCpUncomp.tar.enc" ]; then
openssl enc -aes-256-cbc -d -in dest/snapLastDiffCpUncomp.tar.enc -out decoded_Uncomp.tar -k TheSecretKey
fi
echo "-------------------------------------------------------------------"
echo "-------------------------------------------------------------------"
echo "-----dest containing copy of src via hard links: ------------------"
ls -l dest/snapLastHlCp/
if [ -e "dest/snapLastDiffCpComp.tar.gz" ]; then
echo "-----archive with files that differed to last backup (Comp): ------"
tar -tf dest/snapLastDiffCpComp.tar.gz
else
echo "No snapLastDiffCpComp.tar.gz found."
fi
if [ -e "dest/snapLastDiffCpUncomp.tar" ]; then
echo "-----archive with files that differed to last backup (UnComp): ----"
tar -tf dest/snapLastDiffCpUncomp.tar
else
echo "No snapLastDiffCpUncomp.tar found."
fi
if [ -e "decoded_Comp.tar.gz" ]; then
echo "-----decrypted (Comp): --------------------------------------------"
tar -tf decoded_Comp.tar.gz
rm decoded_Comp.tar.gz
else
echo "No decoded_Comp.tar.gz found."
fi
if [ -e "decoded_Uncomp.tar" ]; then
echo "-----decrypted (UnComp): ------------------------------------------"
tar -tf decoded_Uncomp.tar
rm decoded_Uncomp.tar
else
echo "No decoded_Uncomp.tar found."
fi
}
mkdir test_buppy
cd "test_buppy"
export PYTHONPATH=.
echo '#!/usr/bin/python' > bup_config.py
echo 'def getDoNotCompress():' >> bup_config.py
echo ' return [".mp3",".7z",".zip",".gz","jpeg","jpg","gif","dng","png","avi","mpeg","mov","wmv","mp4"]' >> bup_config.py
echo 'def getExcludeDirs():' >> bup_config.py
echo ' return ["/i1dir", "/i2dir" ]' >> bup_config.py
#ln -sf `dirname $1`/bup_config.py bup_config.py
cwd=`pwd`
cmd1="$1 -s $cwd/src -d $cwd/dest"
cmd2="$1 -s $cwd/src -d $cwd/dest -t $cwd/usb4targz"
cmd3="$1 -s $cwd/src -d $cwd/dest -t $cwd/usb4targz -c $cwd/cloudsync -k TheSecretKey"
mkdir src
mkdir dest
mkdir usb4targz
mkdir cloudsync
mkdir src/adir
echo a > src/adir/a.txt
mkdir src/bdir
echo b > src/bdir/b.txt
execute_buppy "$cmd1"
mkdir src/cdir
echo c > src/cdir/c.txt
echo c > src/cdir/c.mp3
mkdir src/i1dir
echo i > src/i1dir/i.txt
mkdir src/i2dir
echo i > src/i2dir/i.txt
execute_buppy "$cmd2"
mkdir src/ddir
echo d > src/ddir/d.txt
echo d > src/ddir/d.mp3
echo d > src/ddir/d.MOV
rm -r src/adir
execute_buppy "$cmd3"