#!/bin/sh
set -e
-TESTDIR=$(readlink -f $(dirname $0))
-. $TESTDIR/framework
+TESTDIR="$(readlink -f "$(dirname "$0")")"
+. "$TESTDIR/framework"
setupenvironment
configarchitecture 'amd64' 'i386'
-insertpackage 'unstable' 'apt' 'all' '1.0'
+insertpackage 'unstable' 'apt' 'amd64,i386' '1.0'
setupaptarchive --no-update
# readd arch so its downloaded again…
configarchitecture 'amd64' 'i386'
# … but oh noes, hashsum mismatch!
+ SIZE=$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz')
find aptarchive/dists/unstable/main/binary-amd64/ -type f -delete
cat >> aptarchive/dists/unstable/main/binary-amd64/Packages <<EOF
EOF
compressfile aptarchive/dists/unstable/main/binary-amd64/Packages
testfailureequal "Hit:1 $1 unstable InRelease
-Get:2 $1 unstable/main amd64 Packages [$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') B]
+Get:2 $1 unstable/main amd64 Packages [$SIZE B]
Err:2 $1 unstable/main amd64 Packages
Hash Sum mismatch
-W: Failed to fetch $1/dists/unstable/main/binary-amd64/Packages.gz Hash Sum mismatch
-
+Reading package lists...
+E: Failed to fetch $1/dists/unstable/main/binary-amd64/Packages.gz Hash Sum mismatch
E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update
testfileequal 'listsdir-without-amd64.lst' "$(listcurrentlistsdirectory)"
rm -rf aptarchive/dists
# readd arch so its downloaded again…
configarchitecture 'amd64' 'i386'
# … but oh noes, hashsum mismatch!
+ SIZE=$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz')
find aptarchive/dists/unstable/main/binary-amd64/ -type f -delete
cat >> aptarchive/dists/unstable/main/binary-amd64/Packages <<EOF
testfailureequal "Ign:1 $1 unstable InRelease
404 Not Found
Hit:2 $1 unstable Release
-Get:4 $1 unstable/main amd64 Packages [$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') B]
+Get:4 $1 unstable/main amd64 Packages [$SIZE B]
Err:4 $1 unstable/main amd64 Packages
Hash Sum mismatch
-W: Failed to fetch $1/dists/unstable/main/binary-amd64/Packages.gz Hash Sum mismatch
-
+Reading package lists...
+E: Failed to fetch $1/dists/unstable/main/binary-amd64/Packages.gz Hash Sum mismatch
E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update
testfileequal 'listsdir-without-amd64.lst' "$(listcurrentlistsdirectory)"
rm -rf aptarchive/dists
}
changetowebserver
-methodtest 'http://localhost:8080'
+methodtest "http://localhost:${APTHTTPPORT}"
changetohttpswebserver
-methodtest 'https://localhost:4433'
+methodtest "https://localhost:${APTHTTPSPORT}"