blob: 633c197c03b97b5d5954290627a02a0d12ab7a7a (
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
|
#!/bin/sh
set -e
TESTDIR=$(readlink -f $(dirname $0))
. $TESTDIR/framework
setupenvironment
configarchitecture 'i386'
buildsimplenativepackage 'cool' 'i386' '1.0' 'unstable'
setupaptarchive --no-update
testfileexists() {
msgtest 'Test for existance of file' "$1"
test -e "$1" && msgpass || msgfail
rm -f "$1"
}
testfilemissing() {
msgtest 'Test for non-existance of file' "$1"
test -e "$1" && msgfail || msgpass
rm -f "$1"
}
testrun() {
rm -rf rootdir/var/lib/apt
testsuccess aptget update
if [ "$1" = 'trusted' ]; then
testsuccess aptget download cool
testfileexists 'cool_1.0_i386.deb'
testsuccess aptget download cool --allow-unauthenticated
testfileexists 'cool_1.0_i386.deb'
else
testfailure aptget download cool
testfilemissing 'cool_1.0_i386.deb'
testsuccess aptget download cool --allow-unauthenticated
testfileexists 'cool_1.0_i386.deb'
fi
mv aptarchive/pool/cool_1.0_i386.deb aptarchive/pool/cool_1.0_i386.deb.bak
echo 'this is not a good package' > aptarchive/pool/cool_1.0_i386.deb
testfailure aptget download cool
testfilemissing cool_1.0_i386.deb
testfailure aptget download cool --allow-unauthenticated # unauthenticated doesn't mean unchecked
testfilemissing cool_1.0_i386.deb
rm -f aptarchive/pool/cool_1.0_i386.deb
mv aptarchive/pool/cool_1.0_i386.deb.bak aptarchive/pool/cool_1.0_i386.deb
testsuccess aptget download cool --allow-unauthenticated
testfileexists 'cool_1.0_i386.deb'
}
testrun 'trusted'
find aptarchive/ \( -name 'Release.gpg' -o -name 'InRelease' \) -delete
testrun 'untrusted'
changetowebserver
testrun 'untrusted'
|