]> git.saurik.com Git - apt.git/blob - test/integration/test-bug-596498-trusted-unsigned-repo
debian/gbp.conf: point debian-branch to master
[apt.git] / test / integration / test-bug-596498-trusted-unsigned-repo
1 #!/bin/sh
2 set -e
3
4 TESTDIR=$(readlink -f $(dirname $0))
5 . $TESTDIR/framework
6 setupenvironment
7 configarchitecture 'i386'
8
9 buildsimplenativepackage 'cool' 'i386' '1.0' 'unstable'
10
11 msgmsg 'default setup'
12 setupaptarchive
13
14 aptgetupdate() {
15 rm -rf rootdir/var/lib/apt/ rootdir/var/cache/apt/*.bin
16 ${1:-testwarning} aptget update --allow-insecure-repositories
17 }
18
19 PKGTEXT="$(aptget install cool --assume-no -d | head -n 8)"
20 DOWNLOG="$(echo "$PKGTEXT" | tail -n 1)"
21 PKGTEXT="$(echo "$PKGTEXT" | head -n 7)"
22 DEBFILE='rootdir/etc/apt/sources.list.d/apt-test-unstable-*.list'
23
24 testsuccessequal "$PKGTEXT
25 $DOWNLOG
26 Download complete and in download only mode" aptget install cool --assume-no -d
27
28 testsuccessequal "$PKGTEXT
29 $DOWNLOG
30 Download complete and in download only mode" aptget install cool --assume-no -d --allow-unauthenticated
31
32 msgmsg 'sources marked trusted=no'
33 sed -i -e 's#\(deb\(-src\)\?\) #\1 [trusted=no] #' $DEBFILE
34 aptgetupdate 'testsuccess'
35
36 testfailureequal "$PKGTEXT
37 WARNING: The following packages cannot be authenticated!
38 cool
39 Install these packages without verification? [y/N] N
40 E: Some packages could not be authenticated" aptget install cool --assume-no -d
41
42 configarchitecture 'amd64' 'i386'
43 testequal "$(echo "$PKGTEXT" | sed 's#cool$#cool:i386#g')
44 WARNING: The following packages cannot be authenticated!
45 cool:i386
46 Authentication warning overridden.
47 $DOWNLOG
48 Download complete and in download only mode" aptget install cool:i386 --assume-no -d --allow-unauthenticated
49 configarchitecture 'i386'
50
51 find aptarchive/ \( -name 'Release.gpg' -o -name 'InRelease' \) -delete
52 msgmsg 'unsigned repo'
53 sed -i -e 's#\(deb\(-src\)\?\) \[trusted=no\] #\1 #' $DEBFILE
54 aptgetupdate
55
56 testfailureequal "$PKGTEXT
57 WARNING: The following packages cannot be authenticated!
58 cool
59 Install these packages without verification? [y/N] N
60 E: Some packages could not be authenticated" aptget install cool --assume-no -d
61
62 testsuccessequal "$PKGTEXT
63 WARNING: The following packages cannot be authenticated!
64 cool
65 Authentication warning overridden.
66 $DOWNLOG
67 Download complete and in download only mode" aptget install cool --assume-no -d --allow-unauthenticated
68
69 msgmsg 'sources marked trusted=yes'
70 sed -i -e 's#\(deb\(-src\)\?\) #\1 [trusted=yes] #' $DEBFILE
71 aptgetupdate 'testsuccess'
72
73 testsuccessequal "$PKGTEXT
74 $DOWNLOG
75 Download complete and in download only mode" aptget install cool --assume-no -d