merged from debian-apt
[ntk/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 aptget update -qq
16 }
17
18 PKGTEXT="$(aptget install cool --assume-no -d | head -n 7)"
19 DEBFILE='rootdir/etc/apt/sources.list.d/apt-test-unstable-deb.list'
20
21 testequal "$PKGTEXT
22 Download complete and in download only mode" aptget install cool --assume-no -d
23
24 sed -i -e 's#deb#deb [trusted=no]#' $DEBFILE
25 aptgetupdate
26
27 testequal "$PKGTEXT
28 WARNING: The following packages cannot be authenticated!
29 cool
30 Install these packages without verification [y/N]? N
31 E: Some packages could not be authenticated" aptget install cool --assume-no -d
32
33 find aptarchive/ \( -name 'Release.gpg' -o -name 'InRelease' \) -delete
34 sed -i -e 's#deb \[trusted=no\]#deb#' $DEBFILE
35 aptgetupdate
36
37 testequal "$PKGTEXT
38 WARNING: The following packages cannot be authenticated!
39 cool
40 Install these packages without verification [y/N]? N
41 E: Some packages could not be authenticated" aptget install cool --assume-no -d
42
43 sed -i -e 's#deb#deb [trusted=yes]#' $DEBFILE
44 aptgetupdate
45
46 testequal "$PKGTEXT
47 Download complete and in download only mode" aptget install cool --assume-no -d