mirror of
https://github.com/ukui/apt.git
synced 2026-03-09 09:35:45 -07:00
To prevent accidents like adding http-sources while using tor+http it can make sense to allow disabling methods. It might even make sense to allow "redirections" and adding "symlinked" methods via configuration. This could e.g. allow using different options for certain sources by adding and configuring a "virtual" new method which picks up the config based on the name it was called with like e.g. http does if called as tor+http.
36 lines
1.3 KiB
Bash
Executable File
36 lines
1.3 KiB
Bash
Executable File
#!/bin/sh
|
|
set -e
|
|
|
|
TESTDIR="$(readlink -f "$(dirname "$0")")"
|
|
. "$TESTDIR/framework"
|
|
setupenvironment
|
|
configarchitecture 'amd64'
|
|
|
|
insertpackage 'stable' 'foo' 'all' '1'
|
|
insertsource 'stable' 'foo' 'all' '1'
|
|
setupaptarchive --no-update
|
|
|
|
changetowebserver
|
|
webserverconfig 'aptwebserver::redirect::replace::/redirectme/' "http://localhost:${APTHTTPPORT}/"
|
|
|
|
echo 'Dir::Bin::Methods::http-ng "http";' > rootdir/etc/apt/apt.conf.d/99add-http-ng-method
|
|
sed -i -e 's# http:# http-ng:#' $(find rootdir/etc/apt/sources.list.d -name '*-deb-src.list')
|
|
|
|
testsuccess apt update -o Debug::Acquire::http-ng=1
|
|
cp rootdir/tmp/testsuccess.output update.log
|
|
# all requests are folded into the first Release file
|
|
testsuccess grep ' http-ng://' update.log
|
|
testfailure grep ' http://' update.log
|
|
# see if method-specific debug was enabled
|
|
testsuccess grep '^Answer for: http-ng:' update.log
|
|
|
|
rm -rf rootdir/var/lib/apt/lists
|
|
sed -i -e "s#:${APTHTTPPORT}/#:${APTHTTPPORT}/redirectme#" rootdir/etc/apt/sources.list.d/*
|
|
testsuccess apt update -o Debug::Acquire::http-ng=1
|
|
cp rootdir/tmp/testsuccess.output update.log
|
|
# all requests are folded into the first Release file
|
|
testsuccess grep ' http-ng://' update.log
|
|
testfailure grep '^[^L].* http://' update.log
|
|
# see if method-specific debug was enabled
|
|
testsuccess grep '^Answer for: http-ng:' update.log
|