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