summaryrefslogtreecommitdiffstats
path: root/test/integration/test-bug-596498-trusted-unsigned-repo
blob: 2cfdc53fcfeef3c44cbc152d1fe2b80801fe24fa (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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/sh
set -e

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

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

msgmsg 'default setup'
setupaptarchive

aptgetupdate() {
	rm -rf rootdir/var/lib/apt/ rootdir/var/cache/apt/*.bin
	${1:-testwarning} aptget update --allow-insecure-repositories
}
PKGSIZE=$(aptcache show cool | awk '/^Size:/ {print $2}')
PKGTEXT="Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
  cool
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/$PKGSIZE B of archives.
After this operation, 11.3 kB of additional disk space will be used."
DOWNLOG="Get:1 file:${TMPWORKINGDIRECTORY}/aptarchive unstable/main i386 cool i386 1.0 [$PKGSIZE B]"
DEBFILE='rootdir/etc/apt/sources.list.d/apt-test-unstable-*.list'

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

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

msgmsg 'sources marked trusted=no'
sed -i -e 's#\(deb\(-src\)\?\) #\1 [trusted=no] #' $DEBFILE
aptgetupdate 'testsuccess'

testfailureequal "$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

configarchitecture 'amd64' 'i386'
testequal "$(echo "$PKGTEXT" | sed 's#cool$#cool:i386#g')
WARNING: The following packages cannot be authenticated!
  cool:i386
Authentication warning overridden.
$DOWNLOG
Download complete and in download only mode" aptget install cool:i386 --assume-no -d --allow-unauthenticated
configarchitecture 'i386'

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

testfailureequal "$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

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

msgmsg 'sources marked trusted=yes'
sed -i -e 's#\(deb\(-src\)\?\) #\1 [trusted=yes] #' $DEBFILE
aptgetupdate 'testsuccess'

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