blob: ca3c56f5a5a4208a2d1c0a26a17990219b3e11c4 (
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
#!/bin/bash
#
# This file can be used to check that fastback and fastback-unload-receipt
# are working IF you can write a script that fetches the file back from
# the remote ftp server: see ./fetch-from-remote
#
# You must rewrite fetch-from-remote for this to work correctly
#
#
# ./fastback-check FILE [encrypt] [TICKET]
#
# where
# FILE is the name of the file to test with
# TICKET is the name of the ticket or the string "new" to
# indicate that you what to specify "-n" to fastback
# if specified as the second argument "encrypt" will cause -e to be
# passed to fastback
# the second and third arguments are optional
#
ORIG=$1
if [ ! -e $ORIG ]; then
echo >&2 "Error: no such file $ORIG"
exit 2
fi
if [ "$2" = "encrypt" ]; then
DO_ENCRYPT="-e"
shift
else
DO_ENCRYPT=""
fi
if [ "$2" = "" ]; then
DO_TICKET=
elif [ "$2" = "new" ]; then
DO_TICKET="-n"
else
DO_TICKET="-t $2"
fi
RECEIPT=GLRK-receipt
fastback $DO_TICKET $DO_ENCRYPT $ORIG >$RECEIPT
if [ ! -e $RECEIPT ]; then
echo >&2 "Error: no such file $RECEIPT"
exit 2
fi
cat $RECEIPT | while read FIRST REST ; do
#echo "FIRST:" $FIRST
#echo "REST:" $REST
if [ "$FIRST" = "FILE:" ]; then
export FILE=$REST
if [ -z "$FILE" ]; then
echo >&2 "Error: file name missing from \"FILE:\" line"
exit 2
fi
#echo found FILE: $FILE
fi
if [ "$FIRST" = "END:" ]; then
if [ -z "$FILE" ]; then
echo >&2 "Error: no file name found in receipt: $RECEIPT"
exit 2
fi
./fetch-from-remote $FILE
fastback-unload-receipt $RECEIPT
FETCHED=${FILE%.aes}
# if the fetched file has a trailing .gz
# but the orig doesn't then assume fastback did compression
# and use zdiff to do compare
if [ "$FETCHED" != "${FETCHED%.gz}" -a "$ORIG" = "${ORIG%.gz}" ]; then
if ! zdiff $ORIG $FETCHED ; then
echo "differ: ORIG ($ORIG) and FETCHED ($FETCHED)"
else
echo "same: ORIG: ($ORIG) and FETCHED ($FETCHED)"
rm GLRK*
fi
else
# otherwize just use diff
if ! diff $ORIG $FETCHED ; then
echo "differ: ORIG ($ORIG) and FETCHED ($FETCHED)"
else
echo "same: ORIG: ($ORIG) and FETCHED ($FETCHED)"
rm GLRK*
fi
fi
fi
done
|