]> git.saurik.com Git - apt.git/blob - test/integration/test-apt-get-update-unauth-warning
eipp: make no difference between remove & purge
[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 echo 'Acquire::Progress::Ignore::ShowErrorText "false";' > rootdir/etc/apt/apt.conf.d/99show-no-ignore-errors.conf
15
16 # a "normal" package with source and binary
17 buildsimplenativepackage 'foo' 'all' '2.0'
18
19 setupaptarchive --no-update
20
21 APTARCHIVE="$(readlink -f ./aptarchive)"
22 find "$APTARCHIVE/dists/unstable" \( -name 'InRelease' -o -name 'Release.gpg' \) -delete
23 sed -i -n '/^SHA1:$/q;p' "${APTARCHIVE}/dists/unstable/Release"
24 testwarning aptget update
25
26
27 rm -rf rootdir/var/lib/apt/lists
28 find "$APTARCHIVE/dists/unstable" -name '*Release*' -delete
29 # update without authenticated files leads to warning
30 testfailureequal "Get:1 file:$APTARCHIVE unstable InRelease
31 Ign:1 file:$APTARCHIVE unstable InRelease
32 Get:2 file:$APTARCHIVE unstable Release
33 Err:2 file:$APTARCHIVE unstable Release
34 File not found - ${APTARCHIVE}/dists/unstable/Release (2: No such file or directory)
35 Reading package lists...
36 E: The repository 'file:$APTARCHIVE unstable Release' does not have a Release file.
37 N: Updating from such a repository can't be done securely, and is therefore disabled by default.
38 N: See apt-secure(8) manpage for repository creation and user configuration details." aptget update --no-allow-insecure-repositories
39
40 # no package foo
41 testsuccessequal 'Listing...' apt list foo
42 testequal 'lock
43 partial' ls rootdir/var/lib/apt/lists
44
45 filesize() {
46 local CREATEDBY="$1"
47 shift
48 stat -c%s "$(aptget indextargets --no-release-info --format '$(URI)' "Created-By: $CREATEDBY" "$@" | cut -d'/' -f 3- ).gz"
49 }
50 # allow override
51 #aptget update --allow-insecure-repositories -o Debug::pkgAcquire::worker=1
52 #exit
53 testwarningequal "Get:1 file:$APTARCHIVE unstable InRelease
54 Ign:1 file:$APTARCHIVE unstable InRelease
55 Get:2 file:$APTARCHIVE unstable Release
56 Ign:2 file:$APTARCHIVE unstable Release
57 Get:3 file:$APTARCHIVE unstable/main Sources
58 Ign:3 file:$APTARCHIVE unstable/main Sources
59 Get:4 file:$APTARCHIVE unstable/main i386 Packages
60 Ign:4 file:$APTARCHIVE unstable/main i386 Packages
61 Get:5 file:$APTARCHIVE unstable/main all Packages
62 Ign:5 file:$APTARCHIVE unstable/main all Packages
63 Get:6 file:$APTARCHIVE unstable/main Translation-en
64 Ign:6 file:$APTARCHIVE unstable/main Translation-en
65 Get:3 file:$APTARCHIVE unstable/main Sources
66 Ign:3 file:$APTARCHIVE unstable/main Sources
67 Get:4 file:$APTARCHIVE unstable/main i386 Packages
68 Ign:4 file:$APTARCHIVE unstable/main i386 Packages
69 Get:5 file:$APTARCHIVE unstable/main all Packages
70 Ign:5 file:$APTARCHIVE unstable/main all Packages
71 Get:6 file:$APTARCHIVE unstable/main Translation-en
72 Ign:6 file:$APTARCHIVE unstable/main Translation-en
73 Get:3 file:$APTARCHIVE unstable/main Sources
74 Ign:3 file:$APTARCHIVE unstable/main Sources
75 Get:4 file:$APTARCHIVE unstable/main i386 Packages
76 Ign:4 file:$APTARCHIVE unstable/main i386 Packages
77 Get:5 file:$APTARCHIVE unstable/main all Packages
78 Ign:5 file:$APTARCHIVE unstable/main all Packages
79 Get:6 file:$APTARCHIVE unstable/main Translation-en
80 Ign:6 file:$APTARCHIVE unstable/main Translation-en
81 Get:3 file:$APTARCHIVE unstable/main Sources [$(filesize 'Sources') B]
82 Get:4 file:$APTARCHIVE unstable/main i386 Packages [$(filesize 'Packages' 'Architecture: i386') B]
83 Get:5 file:$APTARCHIVE unstable/main all Packages [$(filesize 'Packages' 'Architecture: all') B]
84 Get:6 file:$APTARCHIVE unstable/main Translation-en [$(filesize 'Translations') B]
85 Reading package lists...
86 W: The repository 'file:$APTARCHIVE unstable Release' does not have a Release file.
87 N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
88 N: See apt-secure(8) manpage for repository creation and user configuration details." aptget update --allow-insecure-repositories
89 # ensure we can not install the package
90 testfailureequal "WARNING: The following packages cannot be authenticated!
91 foo
92 E: There were unauthenticated packages and -y was used without --allow-unauthenticated" aptget install -qq -y foo