4 TESTDIR
=$(readlink -f $(dirname $0)) 
   8 configarchitecture 
'native' 
  10 insertpackage 
'unstable' 'unrelated' 'all' '1.0' 'stable' 
  11 insertsource 
'unstable' 'unrelated' 'all' '1.0' 'stable' 
  13 echo 'ni ni ni' > aptarchive
/knights
 
  16 changetowebserver 
-o 'aptwebserver::overwrite::.*::filename=/knights' 
  18 msgtest 
'Acquire test file from the webserver to check' 'overwrite' 
  19 if downloadfile http
://localhost
:${APTHTTPPORT}/holygrail .
/knights
-talking >/dev
/null
; then 
  25 testfileequal knights
-talking 'ni ni ni' 
  27 ensure_n_canary_strings_in_dir
() { 
  29         local CANARY_STRING
="$2" 
  32         msgtest 
"Testing in $DIR for $EXPECTED_N canary" "$CANARY_STRING" 
  33         local N
=$(grep "$CANARY_STRING" $DIR/* 2>/dev/null |wc -l ) 
  34         test "$N" = "$EXPECTED_N" && msgpass 
|| msgfail 
"Expected $EXPECTED_N canaries, got $N" 
  37 LISTS
='rootdir/var/lib/apt/lists' 
  38 rm -rf rootdir
/var
/lib
/apt
/lists
 
  39 testfailure aptget update
 
  40 testsuccess 
grep '^W:.*Clearsigned file .*NOSPLIT.*' rootdir
/tmp
/testfailure.output
 
  42 ensure_n_canary_strings_in_dir 
"$LISTS" 'ni ni ni' 0 
  46 # and again with pre-existing files with "valid data" which should remain 
  47 for f 
in Release Release.gpg main_binary
-amd64_Packages main_source_Sources
; do 
  48         echo 'peng neee-wom' > "$LISTS/localhost:${APTHTTPPORT}_dists_stable_${f}" 
  49         chmod 644 "$LISTS/localhost:${APTHTTPPORT}_dists_stable_${f}" 
  52 testfailure aptget update
 
  53 testsuccess 
grep '^W:.*Clearsigned file .*NOSPLIT.*' rootdir
/tmp
/testfailure.output
 
  55 ensure_n_canary_strings_in_dir 
"$LISTS" 'peng neee-wom' 4 
  56 ensure_n_canary_strings_in_dir 
"$LISTS" 'ni ni ni' 0 
  58 # and now with a pre-existing InRelease file 
  59 echo 'peng neee-wom' > "$LISTS/localhost:${APTHTTPPORT}_dists_stable_InRelease" 
  60 chmod 644 "$LISTS/localhost:${APTHTTPPORT}_dists_stable_InRelease" 
  61 rm -f "$LISTS/localhost:${APTHTTPPORT}_dists_stable_Release" "$LISTS/localhost:${APTHTTPPORT}_dists_stable_Release.gpg" 
  62 msgtest 
'excpected failure of' 'apt-get update' 
  63 testfailure aptget update
 
  64 testsuccess 
grep '^W:.*Clearsigned file .*NOSPLIT.*' rootdir
/tmp
/testfailure.output
 
  66 ensure_n_canary_strings_in_dir 
"$LISTS" 'peng neee-wom' 3 
  67 ensure_n_canary_strings_in_dir 
"$LISTS" 'ni ni ni' 0