]> git.saurik.com Git - apt.git/blame - test/integration/test-apt-update-unauth
Use Acquire::Allow{InsecureRepositories,DowngradeToInsecureRepositories}
[apt.git] / test / integration / test-apt-update-unauth
CommitLineData
ca7fd76c
MV
1#!/bin/sh
2#
3# Ensure that when going from unauthenticated to authenticated all
4# files are checked again
5#
6set -e
7
8TESTDIR=$(readlink -f $(dirname $0))
9. $TESTDIR/framework
10
e1bd768b
MV
11umask 022
12
ca7fd76c
MV
13setupenvironment
14configarchitecture "i386"
15
16insertpackage 'unstable' 'foo' 'all' '1.0'
17insertsource 'unstable' 'foo' 'all' '1.0'
18
19setupaptarchive
20changetowebserver
21
c8aa88aa
MV
22# FIXME:
23# - also check the unauth -> auth success case, i.e. that all files are
24# reverified
ca7fd76c
MV
25runtest() {
26 # start unauthenticated
27 find rootdir/var/lib/apt/lists/ -type f | xargs rm -f
28 rm -f aptarchive/dists/unstable/*Release*
c8aa88aa
MV
29 # remove uncompressed version
30 find aptarchive/ -name Packages | xargs rm -f
c99fe2e1 31 aptget update -qq --allow-insecure-repositories
ca7fd76c
MV
32
33 # become authenticated
34 generatereleasefiles
35 signreleasefiles
36
c8aa88aa
MV
37 # and ensure we re-check the downloaded data
38 msgtest "Check rollback on going from unauth -> auth"
39
40 # change the local packages file
41 PKGS=$(ls rootdir/var/lib/apt/lists/*Packages*)
42 echo "meep" > $PKGS
43 ls -l rootdir/var/lib/apt/lists > lists.before
44
45 # update and ensure all is reverted on the hashsum failure
46 aptget update -o Debug::Acquire::Transaction=1 -o Debug::pkgAcquire::Auth=1 -o Debug::pkgAcquire::worker=0 > output.log 2>&1 || true
47
48 # ensure we have before what we have after
49 ls -l rootdir/var/lib/apt/lists > lists.after
50 if diff -u lists.before lists.after; then
ca7fd76c 51 msgpass
c8aa88aa
MV
52 else
53 #cat output.log
54 msgfail
ca7fd76c 55 fi
c8aa88aa 56
ca7fd76c
MV
57}
58
59for COMPRESSEDINDEXES in 'false' 'true'; do
60 echo "Acquire::GzipIndexes \"$COMPRESSEDINDEXES\";" > rootdir/etc/apt/apt.conf.d/compressindexes
61 if $COMPRESSEDINDEXES; then
62 msgmsg 'Run tests with GzipIndexes enabled'
63 else
64 msgmsg 'Run tests with GzipIndexes disabled'
65 fi
66
67 runtest
68done