]>
Commit | Line | Data |
---|---|---|
50d98a1b MV |
1 | #!/bin/sh |
2 | set -e | |
3 | ||
4 | TESTDIR=$(readlink -f $(dirname $0)) | |
5 | . $TESTDIR/framework | |
6 | ||
7 | setupenvironment | |
8 | configarchitecture "i386" | |
9 | ||
10 | insertpackage 'unstable' 'foo' 'all' '1.0' | |
11 | ||
12 | setupaptarchive --no-update | |
13 | ||
3a8776a3 | 14 | # make Packages *only* accessible by-hash for this test |
a2fdb57f MV |
15 | mkdir -p aptarchive/dists/unstable/main/binary-i386/by-hash/SHA512 |
16 | (cd aptarchive/dists/unstable/main/binary-i386/by-hash/SHA512 && | |
17 | mv ../../Packages* . && | |
18 | ln -s Packages.gz $(sha512sum Packages.gz|cut -f1 -d' ') ) | |
50d98a1b MV |
19 | |
20 | # add sources | |
a2fdb57f MV |
21 | mkdir -p aptarchive/dists/unstable/main/source/by-hash/SHA512 |
22 | (cd aptarchive/dists/unstable/main/source/by-hash/SHA512 && | |
23 | ln -s ../../Sources.gz $(sha512sum ../../Sources.gz|cut -f1 -d' ') | |
50d98a1b MV |
24 | ) |
25 | ||
a2fdb57f | 26 | # we moved the Packages file away, normal update won't work |
1e0f0f28 | 27 | testfailure aptget update |
50d98a1b MV |
28 | |
29 | # ensure we do not know about "foo" | |
25b86db1 | 30 | testfailureequal "Reading package lists... |
50d98a1b MV |
31 | Building dependency tree... |
32 | E: Unable to locate package foo" aptget install -q -s foo | |
33 | ||
34 | # ensure we can apt-get update by hash | |
4fa34122 | 35 | testsuccess aptget update -o APT::Acquire::By-Hash=1 -o Acquire::Languages=none |
50d98a1b | 36 | |
1e0f0f28 DK |
37 | ensureitworks() { |
38 | testsuccessequal "Inst foo (1.0 unstable [all]) | |
a2fdb57f | 39 | Conf foo (1.0 unstable [all])" aptget install -qq -s foo |
1e0f0f28 DK |
40 | } |
41 | ensureitworks | |
a2fdb57f MV |
42 | |
43 | # add magic string to Release file ... | |
44 | MAGIC="Acquire-By-Hash: true" | |
45 | sed -i "s#Suite: unstable#Suite: unstable\n$MAGIC#" aptarchive/dists/unstable/Release | |
46 | signreleasefiles | |
47 | # ... and verify that it fetches by hash now | |
1e0f0f28 | 48 | rm -rf rootdir/var/lib/apt/lists |
4fa34122 | 49 | testsuccess aptget update -o Acquire::Languages=none |
a2fdb57f | 50 | |
1e0f0f28 | 51 | ensureitworks |