]> git.saurik.com Git - apt.git/blame - test/integration/test-apt-get-update-unauth-warning
Report non-transient errors as errors, not as warnings
[apt.git] / test / integration / test-apt-get-update-unauth-warning
CommitLineData
c4ffa042
MV
1#!/bin/sh
2#
3# ensure we print warnings for unauthenticated repositories
4#
5set -e
6
3abb6a6a
DK
7TESTDIR="$(readlink -f "$(dirname "$0")")"
8. "$TESTDIR/framework"
c4ffa042
MV
9
10setupenvironment
11configarchitecture "i386"
ff86d7df 12configcompression '.' 'gz'
c4ffa042 13
f01f5d91
DK
14echo 'Acquire::Progress::Ignore::ShowErrorText "false";' > rootdir/etc/apt/apt.conf.d/99show-no-ignore-errors.conf
15
c4ffa042
MV
16# a "normal" package with source and binary
17buildsimplenativepackage 'foo' 'all' '2.0'
18
19setupaptarchive --no-update
20
63c71412 21APTARCHIVE="$(readlink -f ./aptarchive)"
f01f5d91
DK
22find "$APTARCHIVE/dists/unstable" \( -name 'InRelease' -o -name 'Release.gpg' \) -delete
23sed -i -n '/^SHA1:$/q;p' "${APTARCHIVE}/dists/unstable/Release"
24testwarning aptget update
c4ffa042 25
30c8107e 26
f01f5d91
DK
27rm -rf rootdir/var/lib/apt/lists
28find "$APTARCHIVE/dists/unstable" -name '*Release*' -delete
bca84917 29# update without authenticated files leads to warning
9d2a8a73
DK
30testfailureequal "Get:1 file:$APTARCHIVE unstable InRelease
31Ign:1 file:$APTARCHIVE unstable InRelease
9d2a8a73 32Get:2 file:$APTARCHIVE unstable Release
1eb1836f 33Err:2 file:$APTARCHIVE unstable Release
30c8107e 34 File not found - ${APTARCHIVE}/dists/unstable/Release (2: No such file or directory)
95278287 35Reading package lists...
f18f2338 36E: The repository 'file:$APTARCHIVE unstable Release' does not have a Release file.
83960341 37N: Updating from such a repository can't be done securely, and is therefore disabled by default.
87d6947d 38N: See apt-secure(8) manpage for repository creation and user configuration details." aptget update --no-allow-insecure-repositories
bca84917
MV
39
40# no package foo
25b86db1 41testsuccessequal 'Listing...' apt list foo
546dbfc8
DK
42testequal 'lock
43partial' ls rootdir/var/lib/apt/lists
bca84917 44
ff86d7df 45filesize() {
1dd20368
DK
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"
ff86d7df 49}
bca84917 50# allow override
9d2a8a73
DK
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
9d2a8a73 55Get:2 file:$APTARCHIVE unstable Release
1eb1836f 56Ign:2 file:$APTARCHIVE unstable Release
9d2a8a73
DK
57Get:3 file:$APTARCHIVE unstable/main Sources
58Ign:3 file:$APTARCHIVE unstable/main Sources
9d2a8a73
DK
59Get:4 file:$APTARCHIVE unstable/main i386 Packages
60Ign:4 file:$APTARCHIVE unstable/main i386 Packages
1dd20368
DK
61Get:5 file:$APTARCHIVE unstable/main all Packages
62Ign:5 file:$APTARCHIVE unstable/main all Packages
1dd20368
DK
63Get:6 file:$APTARCHIVE unstable/main Translation-en
64Ign:6 file:$APTARCHIVE unstable/main Translation-en
9d2a8a73
DK
65Get:3 file:$APTARCHIVE unstable/main Sources
66Ign:3 file:$APTARCHIVE unstable/main Sources
9d2a8a73
DK
67Get:4 file:$APTARCHIVE unstable/main i386 Packages
68Ign:4 file:$APTARCHIVE unstable/main i386 Packages
1dd20368
DK
69Get:5 file:$APTARCHIVE unstable/main all Packages
70Ign:5 file:$APTARCHIVE unstable/main all Packages
1dd20368
DK
71Get:6 file:$APTARCHIVE unstable/main Translation-en
72Ign:6 file:$APTARCHIVE unstable/main Translation-en
9d2a8a73
DK
73Get:3 file:$APTARCHIVE unstable/main Sources
74Ign:3 file:$APTARCHIVE unstable/main Sources
9d2a8a73
DK
75Get:4 file:$APTARCHIVE unstable/main i386 Packages
76Ign:4 file:$APTARCHIVE unstable/main i386 Packages
1dd20368
DK
77Get:5 file:$APTARCHIVE unstable/main all Packages
78Ign:5 file:$APTARCHIVE unstable/main all Packages
1dd20368
DK
79Get:6 file:$APTARCHIVE unstable/main Translation-en
80Ign:6 file:$APTARCHIVE unstable/main Translation-en
1eb1836f 81Get:3 file:$APTARCHIVE unstable/main Sources [$(filesize 'Sources') B]
1dd20368
DK
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]
bca84917 85Reading package lists...
f18f2338 86W: The repository 'file:$APTARCHIVE unstable Release' does not have a Release file.
d04e44ac 87N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
87d6947d 88N: See apt-secure(8) manpage for repository creation and user configuration details." aptget update --allow-insecure-repositories
c4ffa042 89# ensure we can not install the package
25b86db1 90testfailureequal "WARNING: The following packages cannot be authenticated!
c4ffa042 91 foo
b381a482 92E: There were unauthenticated packages and -y was used without --allow-unauthenticated" aptget install -qq -y foo