]> git.saurik.com Git - apt.git/blob - test/integration/test-apt-get-update-unauth-warning
centralize unlink checks in acquire-item
[apt.git] / test / integration / test-apt-get-update-unauth-warning
1 #!/bin/sh
2 #
3 # ensure we print warnings for unauthenticated repositories
4 #
5 set -e
6
7 TESTDIR=$(readlink -f $(dirname $0))
8 . $TESTDIR/framework
9
10 setupenvironment
11 configarchitecture "i386"
12 configcompression '.' 'gz'
13
14 # a "normal" package with source and binary
15 buildsimplenativepackage 'foo' 'all' '2.0'
16
17 setupaptarchive --no-update
18
19 APTARCHIVE="$(readlink -f ./aptarchive)"
20 find "$APTARCHIVE/dists/unstable" -name '*Release*' -delete
21
22 # update without authenticated files leads to warning
23 testfailureequal "Get:1 file:$APTARCHIVE unstable InRelease
24 Ign:1 file:$APTARCHIVE unstable InRelease
25 File not found
26 Get:2 file:$APTARCHIVE unstable Release
27 Err:2 file:$APTARCHIVE unstable Release
28 File not found
29 Reading package lists...
30 E: The repository 'file:$APTARCHIVE unstable Release' does not have a Release file.
31 N: Updating such a repository securily is impossible and therefore disabled by default.
32 N: See apt-secure(8) manpage for repository creation and user configuration details." aptget update --no-allow-insecure-repositories -q=0
33
34 # no package foo
35 testsuccessequal 'Listing...' apt list foo
36 testequal 'lock
37 partial' ls rootdir/var/lib/apt/lists
38
39 filesize() {
40 stat -c%s "$(aptget indextargets --no-release-info --format '$(URI)' "Created-By: $1" | cut -d'/' -f 3- ).gz"
41 }
42 # allow override
43 #aptget update --allow-insecure-repositories -o Debug::pkgAcquire::worker=1
44 #exit
45 testwarningequal "Get:1 file:$APTARCHIVE unstable InRelease
46 Ign:1 file:$APTARCHIVE unstable InRelease
47 File not found
48 Get:2 file:$APTARCHIVE unstable Release
49 Ign:2 file:$APTARCHIVE unstable Release
50 File not found
51 Get:3 file:$APTARCHIVE unstable/main Sources
52 Ign:3 file:$APTARCHIVE unstable/main Sources
53 File not found
54 Get:4 file:$APTARCHIVE unstable/main i386 Packages
55 Ign:4 file:$APTARCHIVE unstable/main i386 Packages
56 File not found
57 Get:5 file:$APTARCHIVE unstable/main Translation-en
58 Ign:5 file:$APTARCHIVE unstable/main Translation-en
59 File not found
60 Get:3 file:$APTARCHIVE unstable/main Sources
61 Ign:3 file:$APTARCHIVE unstable/main Sources
62 File not found
63 Get:4 file:$APTARCHIVE unstable/main i386 Packages
64 Ign:4 file:$APTARCHIVE unstable/main i386 Packages
65 File not found
66 Get:5 file:$APTARCHIVE unstable/main Translation-en
67 Ign:5 file:$APTARCHIVE unstable/main Translation-en
68 File not found
69 Get:3 file:$APTARCHIVE unstable/main Sources
70 Ign:3 file:$APTARCHIVE unstable/main Sources
71 File not found
72 Get:4 file:$APTARCHIVE unstable/main i386 Packages
73 Ign:4 file:$APTARCHIVE unstable/main i386 Packages
74 File not found
75 Get:5 file:$APTARCHIVE unstable/main Translation-en
76 Ign:5 file:$APTARCHIVE unstable/main Translation-en
77 File not found
78 Get:3 file:$APTARCHIVE unstable/main Sources [$(filesize 'Sources') B]
79 Get:4 file:$APTARCHIVE unstable/main i386 Packages [$(filesize 'Packages') B]
80 Get:5 file:$APTARCHIVE unstable/main Translation-en [$(filesize 'Translations') B]
81 Reading package lists...
82 W: The repository 'file:$APTARCHIVE unstable Release' does not have a Release file.
83 N: Data from such a repository can not be authenticated and is therefore potentially dangerous to use.
84 N: See apt-secure(8) manpage for repository creation and user configuration details." aptget update --allow-insecure-repositories -q=0
85 # ensure we can not install the package
86 testfailureequal "WARNING: The following packages cannot be authenticated!
87 foo
88 E: There were unauthenticated packages and -y was used without --allow-unauthenticated" aptget install -qq -y foo