blob: 952260322f61597dce2532d5e27da68b107ddbcb (
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
|
#!/bin/sh
set -e
deb=$1
verify_deb() {
[ "$deb" = "" ] && return
md5sum_1=$(LD_LIBRARY_PATH=../../../bin ../../../bin/apt-cache show `dpkg -I "$deb" | sed -n "s/Package: //p"` | sed -n "s/MD5sum: //p")
md5sum_2=$(md5sum "$deb" | gawk '{print $1}')
for s1 in $md5sum_1; do
for s2 in $md5sum_2; do
#echo "$s1 $s2"
if [ $s1 = $s2 ]; then
echo "[OK] $deb"
exit 0
fi
done
done
echo "[NOT OK] $deb"
exit 1;
}
usage() {
echo "Usage: test-signature <deb-file> <debdelta-file>"
}
make_deb() {
if [ "$2" = "" ]; then
usage
exit 1
fi
result_deb=$(LD_LIBRARY_PATH=../../../bin ../../../bin/methods/debdelta $1 $2 | sed -n "s/Filename: //p")
deb=$result_deb
verify_deb
}
testmethod() {
path="/var/cache/apt/archives/"
for d in $(dir $path); do
deb=$path$d
[ -d $deb ] && continue
runtest
done
}
#testmethod
make_deb $1 $2
|