summaryrefslogtreecommitdiff
path: root/test/integration/test-bug-596498-trusted-unsigned-repo
blob: 06c9c82854e09a198a5aceffa86ef103c7489347 (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
#!/bin/sh
set -e

TESTDIR=$(readlink -f $(dirname $0))
. $TESTDIR/framework
setupenvironment
configarchitecture 'i386'

buildsimplenativepackage 'cool' 'i386' '1.0' 'unstable'

setupaptarchive

aptgetupdate() {
	rm -rf rootdir/var/lib/apt/ rootdir/var/cache/apt/*.bin
	aptget update -qq
}

PKGTEXT="$(aptget install cool --assume-no -d | head -n 7)"
DEBFILE='rootdir/etc/apt/sources.list.d/apt-test-unstable-deb.list'

testequal "$PKGTEXT
Download complete and in download only mode" aptget install cool --assume-no -d

testequal "$PKGTEXT
Download complete and in download only mode" aptget install cool --assume-no -d --allow-unauthenticated

sed -i -e 's#deb#deb [trusted=no]#' $DEBFILE
aptgetupdate

testequal "$PKGTEXT
WARNING: The following packages cannot be authenticated!
  cool
Install these packages without verification? [y/N] N
E: Some packages could not be authenticated" aptget install cool --assume-no -d

find aptarchive/ \( -name 'Release.gpg' -o -name 'InRelease' \) -delete
sed -i -e 's#deb \[trusted=no\]#deb#' $DEBFILE
aptgetupdate

testequal "$PKGTEXT
WARNING: The following packages cannot be authenticated!
  cool
Install these packages without verification? [y/N] N
E: Some packages could not be authenticated" aptget install cool --assume-no -d

testequal "$PKGTEXT
WARNING: The following packages cannot be authenticated!
  cool
Authentication warning overridden.
Download complete and in download only mode" aptget install cool --assume-no -d --allow-unauthenticated

sed -i -e 's#deb#deb [trusted=yes]#' $DEBFILE
aptgetupdate

testequal "$PKGTEXT
Download complete and in download only mode" aptget install cool --assume-no -d