#!/bin/sh set -e TESTDIR="$(readlink -f "$(dirname "$0")")" . "$TESTDIR/framework" setupenvironment configarchitecture 'amd64' configcompression '.' 'gz' buildsimplenativepackage 'unrelated' 'all' '0.5~squeeze1' 'unstable' setupaptarchive --no-update changetowebserver webserverconfig 'aptwebserver::redirect::replace::/redirectme/' "http://0.0.0.0:${APTHTTPPORT}/" rewritesourceslist "http://localhost:${APTHTTPPORT}/redirectme" testsuccessequal "Get:1 http://0.0.0.0:${APTHTTPPORT} unstable InRelease [$(stat -c %s aptarchive/dists/unstable/InRelease) B] Get:2 http://0.0.0.0:${APTHTTPPORT} unstable/main Sources [$(stat -c %s aptarchive/dists/unstable/main/source/Sources.gz) B] Get:3 http://0.0.0.0:${APTHTTPPORT} unstable/main all Packages [$(stat -c %s aptarchive/dists/unstable/main/binary-all/Packages.gz) B] Get:4 http://0.0.0.0:${APTHTTPPORT} unstable/main Translation-en [$(stat -c %s aptarchive/dists/unstable/main/i18n/Translation-en.gz) B] Reading package lists..." aptget update # ensure we asked the redirector only once testsuccessequal "Location: http://0.0.0.0:${APTHTTPPORT}/dists/unstable/InRelease" grep '^Location:' aptarchive/webserver.log testsuccessequal "Hit:1 http://0.0.0.0:${APTHTTPPORT} unstable InRelease Reading package lists..." aptget update testsuccessequal "Location: http://0.0.0.0:${APTHTTPPORT}/dists/unstable/InRelease Location: http://0.0.0.0:${APTHTTPPORT}/dists/unstable/InRelease" grep '^Location:' aptarchive/webserver.log rm -rf rootdir/var/lib/apt/lists testsuccess apt update -o Debug::Acquire::http=1 -o Acquire::SameMirrorForAllIndexes=0 testsuccessequal "Location: http://0.0.0.0:${APTHTTPPORT}/dists/unstable/InRelease Location: http://0.0.0.0:${APTHTTPPORT}/dists/unstable/InRelease Location: http://0.0.0.0:${APTHTTPPORT}/dists/unstable/InRelease Location: http://0.0.0.0:${APTHTTPPORT}/dists/unstable/main/source/Sources.gz Location: http://0.0.0.0:${APTHTTPPORT}/dists/unstable/main/binary-all/Packages.gz Location: http://0.0.0.0:${APTHTTPPORT}/dists/unstable/main/i18n/Translation-en.gz" grep '^Location:' aptarchive/webserver.log