-# add sources
-mkdir -p aptarchive/dists/unstable/main/source/by-hash
-(cd aptarchive/dists/unstable/main/source/by-hash &&
- ln -s ../Sources.gz $(sha256sum ../Sources.gz|cut -f1 -d' ')
-)
+ensureitworks() {
+ rm -rf rootdir/var/lib/apt/lists
+ testsuccess aptget update "$@" -o Acquire::Languages=none
+ testfailure grep '^Ign' rootdir/tmp/testsuccess.output
+ rm -rf rootdir/var/lib/apt/lists
+ testsuccess aptget update "$@"
+ cp -f rootdir/tmp/testsuccess.output rootdir/tmp/aptupdate.output
+ testsuccess grep '^Ign' rootdir/tmp/aptupdate.output
+ testsuccessequal "Inst foo (1.0 unstable [all])
+Conf foo (1.0 unstable [all])" aptget install -qq -s foo
+ testsuccessequal "Inst bar (1.0 unstable [i386])
+Conf bar (1.0 unstable [i386])" aptget install -qq -s bar
+}
+msgmsg 'Test by-hash via' 'config option'
+ensureitworks -o Acquire::By-Hash=force