]> git.saurik.com Git - apt.git/blame_incremental - test/integration/test-apt-get-update-unauth-warning
don't ask server if we have entire file in partial/
[apt.git] / test / integration / test-apt-get-update-unauth-warning
... / ...
CommitLineData
1#!/bin/sh
2#
3# ensure we print warnings for unauthenticated repositories
4#
5set -e
6
7TESTDIR="$(readlink -f "$(dirname "$0")")"
8. "$TESTDIR/framework"
9
10setupenvironment
11configarchitecture "i386"
12configcompression '.' 'gz'
13
14echo '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
17buildsimplenativepackage 'foo' 'all' '2.0'
18
19setupaptarchive --no-update
20
21APTARCHIVE="$(readlink -f ./aptarchive)"
22find "$APTARCHIVE/dists/unstable" \( -name 'InRelease' -o -name 'Release.gpg' \) -delete
23sed -i -n '/^SHA1:$/q;p' "${APTARCHIVE}/dists/unstable/Release"
24testwarning aptget update
25
26
27rm -rf rootdir/var/lib/apt/lists
28find "$APTARCHIVE/dists/unstable" -name '*Release*' -delete
29# update without authenticated files leads to warning
30testfailureequal "Get:1 file:$APTARCHIVE unstable InRelease
31Ign:1 file:$APTARCHIVE unstable InRelease
32Get:2 file:$APTARCHIVE unstable Release
33Err:2 file:$APTARCHIVE unstable Release
34 File not found - ${APTARCHIVE}/dists/unstable/Release (2: No such file or directory)
35Reading package lists...
36E: The repository 'file:$APTARCHIVE unstable Release' does not have a Release file.
37N: Updating from such a repository can't be done securely, and is therefore disabled by default.
38N: See apt-secure(8) manpage for repository creation and user configuration details." aptget update --no-allow-insecure-repositories
39
40# no package foo
41testsuccessequal 'Listing...' apt list foo
42testequal 'lock
43partial' ls rootdir/var/lib/apt/lists
44
45filesize() {
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
53testwarningequal "Get:1 file:$APTARCHIVE unstable InRelease
54Ign:1 file:$APTARCHIVE unstable InRelease
55Get:2 file:$APTARCHIVE unstable Release
56Ign:2 file:$APTARCHIVE unstable Release
57Get:3 file:$APTARCHIVE unstable/main Sources
58Ign:3 file:$APTARCHIVE unstable/main Sources
59Get:4 file:$APTARCHIVE unstable/main i386 Packages
60Ign:4 file:$APTARCHIVE unstable/main i386 Packages
61Get:5 file:$APTARCHIVE unstable/main all Packages
62Ign:5 file:$APTARCHIVE unstable/main all Packages
63Get:6 file:$APTARCHIVE unstable/main Translation-en
64Ign:6 file:$APTARCHIVE unstable/main Translation-en
65Get:3 file:$APTARCHIVE unstable/main Sources
66Ign:3 file:$APTARCHIVE unstable/main Sources
67Get:4 file:$APTARCHIVE unstable/main i386 Packages
68Ign:4 file:$APTARCHIVE unstable/main i386 Packages
69Get:5 file:$APTARCHIVE unstable/main all Packages
70Ign:5 file:$APTARCHIVE unstable/main all Packages
71Get:6 file:$APTARCHIVE unstable/main Translation-en
72Ign:6 file:$APTARCHIVE unstable/main Translation-en
73Get:3 file:$APTARCHIVE unstable/main Sources
74Ign:3 file:$APTARCHIVE unstable/main Sources
75Get:4 file:$APTARCHIVE unstable/main i386 Packages
76Ign:4 file:$APTARCHIVE unstable/main i386 Packages
77Get:5 file:$APTARCHIVE unstable/main all Packages
78Ign:5 file:$APTARCHIVE unstable/main all Packages
79Get:6 file:$APTARCHIVE unstable/main Translation-en
80Ign:6 file:$APTARCHIVE unstable/main Translation-en
81Get:3 file:$APTARCHIVE unstable/main Sources [$(filesize 'Sources') B]
82Get:4 file:$APTARCHIVE unstable/main i386 Packages [$(filesize 'Packages' 'Architecture: i386') B]
83Get:5 file:$APTARCHIVE unstable/main all Packages [$(filesize 'Packages' 'Architecture: all') B]
84Get:6 file:$APTARCHIVE unstable/main Translation-en [$(filesize 'Translations') B]
85Reading package lists...
86W: The repository 'file:$APTARCHIVE unstable Release' does not have a Release file.
87N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
88N: 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
90testfailureequal "WARNING: The following packages cannot be authenticated!
91 foo
92E: There were unauthenticated packages and -y was used without --allow-unauthenticated" aptget install -qq -y foo