]> git.saurik.com Git - apt.git/blob - test/integration/test-bug-596498-trusted-unsigned-repo
detect and error out on conflicting Trusted settings
[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 setupaptarchive
12
13 aptgetupdate() {
14 rm -rf rootdir/var/lib/apt/ rootdir/var/cache/apt/*.bin
15 ${1:-testwarning} aptget update --allow-insecure-repositories
16 }
17
18 PKGTEXT="$(aptget install cool --assume-no -d | head -n 8)"
19 DOWNLOG="$(echo "$PKGTEXT" | tail -n 1)"
20 PKGTEXT="$(echo "$PKGTEXT" | head -n 7)"
21 DEBFILE='rootdir/etc/apt/sources.list.d/apt-test-unstable-*.list'
22
23 testsuccessequal "$PKGTEXT
24 $DOWNLOG
25 Download complete and in download only mode" aptget install cool --assume-no -d
26
27 testsuccessequal "$PKGTEXT
28 $DOWNLOG
29 Download complete and in download only mode" aptget install cool --assume-no -d --allow-unauthenticated
30
31 sed -i -e 's#\(deb\(-src\)\?\) #\1 [trusted=no] #' $DEBFILE
32 aptgetupdate 'testsuccess'
33
34 testfailureequal "$PKGTEXT
35 WARNING: The following packages cannot be authenticated!
36 cool
37 Install these packages without verification? [y/N] N
38 E: Some packages could not be authenticated" aptget install cool --assume-no -d
39
40 find aptarchive/ \( -name 'Release.gpg' -o -name 'InRelease' \) -delete
41 sed -i -e 's#\(deb\(-src\)\?\) \[trusted=no\] #\1 #' $DEBFILE
42 aptgetupdate
43
44 testfailureequal "$PKGTEXT
45 WARNING: The following packages cannot be authenticated!
46 cool
47 Install these packages without verification? [y/N] N
48 E: Some packages could not be authenticated" aptget install cool --assume-no -d
49
50 testsuccessequal "$PKGTEXT
51 WARNING: The following packages cannot be authenticated!
52 cool
53 Authentication warning overridden.
54 $DOWNLOG
55 Download complete and in download only mode" aptget install cool --assume-no -d --allow-unauthenticated
56
57 sed -i -e 's#\(deb\(-src\)\?\) #\1 [trusted=yes] #' $DEBFILE
58 aptgetupdate
59
60 testsuccessequal "$PKGTEXT
61 $DOWNLOG
62 Download complete and in download only mode" aptget install cool --assume-no -d