]>
Commit | Line | Data |
---|---|---|
515d18c9 MV |
1 | #!/bin/sh |
2 | set -e | |
3 | ||
3abb6a6a DK |
4 | TESTDIR="$(readlink -f "$(dirname "$0")")" |
5 | . "$TESTDIR/framework" | |
515d18c9 MV |
6 | |
7 | setupenvironment | |
8 | configarchitecture "i386" | |
9 | ||
10 | buildaptarchive | |
11 | setupflataptarchive | |
12 | changetowebserver | |
13 | ||
14 | prepare() { | |
15 | local DATE="${2:-now}" | |
16 | if [ "$DATE" = 'now' -a "$1" = "${PKGFILE}-new" ]; then | |
17 | DATE='now + 6 days' | |
18 | fi | |
19 | for release in $(find rootdir/var/lib/apt/lists 2> /dev/null); do | |
3abb6a6a | 20 | touch -d 'now - 6 hours' "$release" |
515d18c9 | 21 | done |
3abb6a6a | 22 | cp "$1" aptarchive/Packages |
515d18c9 | 23 | find aptarchive -name 'Release' -delete |
276e51dd | 24 | compressfile aptarchive/Packages |
515d18c9 MV |
25 | # create Release file with incorret checksums |
26 | cat > aptarchive/Release <<EOF | |
27 | Date: Fri, 05 Aug 2011 09:22:08 UTC | |
28 | MD5Sum: | |
29 | x15c483ac486f5dbe95095c7ec08626f 760 Packages | |
30 | x0579797df4792164a17305fb0b317e9 546 Packages.bz2 | |
31 | xc532a82873d2206b4e4503e92d167bd 489 Packages.gz | |
32 | x4d1d25661377dd4bb95a1736e2624d3 527 Packages.lzma | |
33 | xf1cc221194edbaa943d2375d6f44a88 572 Packages.xz | |
34 | SHA1: | |
35 | x0d3317839cf68cd40c28f0bddca8d2ce5a29cad 760 Packages | |
36 | xffddf046ad8dfd8338a355d76fb08d143c8b636 546 Packages.bz2 | |
37 | xa27a3df51ca4474b880a6594c4811957079b613 489 Packages.gz | |
38 | x9d7bba4e6fa927a34dcd797694c2893c21f1004 527 Packages.lzma | |
39 | x7d988fe59cf67298828e5299a15d329c0f00f1b 572 Packages.xz | |
40 | SHA256: | |
41 | x5a47d72f6b97bfa164b23326b6ad3cb019b5c6cc73769f8c0187616933d1b2b 760 Packages | |
42 | x617252f5bfe3e9126352c7c2f8122d9c3b2c5e1a6c8a9616d62adc0ed164172 546 Packages.bz2 | |
43 | xc6abc6fe9a4fcf0758ec5366dfd19bcba90af026a7017c3f6198c59eccd8ef5 489 Packages.gz | |
44 | xb306e66e5e6a7169c8d281a888539d1fdca9cecc99ae605717df579d5b9c166 527 Packages.lzma | |
45 | x9585d0e66b74c9385727fbea11fea9ab33c716b18a32f3036f037a2b9b57120 572 Packages.xz | |
46 | EOF | |
515d18c9 MV |
47 | } |
48 | ||
515d18c9 MV |
49 | PKGFILE="${TESTDIR}/$(echo "$(basename $0)" | sed 's#^test-#Packages-#')" |
50 | ||
51 | runtest() { | |
3abb6a6a | 52 | prepare "${PKGFILE}" |
515d18c9 MV |
53 | rm -rf rootdir/var/lib/apt/lists |
54 | signreleasefiles 'Joe Sixpack' | |
515d18c9 | 55 | |
87d6947d DK |
56 | # test signed release file |
57 | msgtest 'apt-get update gets the expected hashsum mismatch' | |
58 | testfailure aptget update | |
59 | testsuccess grep "Hash Sum mismatch" rootdir/tmp/testfailure.output | |
60 | msgtest 'No package from the source available' | |
61 | testfailureequal --nomsg 'N: Unable to locate package apt | |
62 | E: No packages found' aptcache show apt | |
5a23c56d DK |
63 | msgtest 'No Packages file in /var/lib/apt/lists' |
64 | testempty find rootdir/var/lib/apt/lists -maxdepth 1 -name '*Package*' | |
65 | ||
3568a640 MV |
66 | # now with the unsigned Release file |
67 | rm -rf rootdir/var/lib/apt/lists | |
5a23c56d | 68 | rm -f aptarchive/InRelease aptarchive/Release.gpg |
87d6947d DK |
69 | msgtest 'unsigned apt-get update gets the expected hashsum mismatch' |
70 | testfailure --nomsg aptget update --allow-insecure-repositories | |
71 | testsuccess grep "Hash Sum mismatch" rootdir/tmp/testfailure.output | |
515d18c9 MV |
72 | } |
73 | ||
ca7fd76c MV |
74 | for COMPRESSEDINDEXES in 'false' 'true'; do |
75 | echo "Acquire::GzipIndexes \"$COMPRESSEDINDEXES\";" > rootdir/etc/apt/apt.conf.d/compressindexes | |
76 | if $COMPRESSEDINDEXES; then | |
77 | msgmsg 'Run tests with GzipIndexes enabled' | |
78 | else | |
79 | msgmsg 'Run tests with GzipIndexes disabled' | |
80 | fi | |
ca7fd76c MV |
81 | runtest |
82 | done |