test-apt-update-unauth 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #!/bin/sh
  2. #
  3. # Ensure that when going from unauthenticated to authenticated all
  4. # files are checked again
  5. #
  6. set -e
  7. TESTDIR=$(readlink -f $(dirname $0))
  8. . $TESTDIR/framework
  9. umask 022
  10. setupenvironment
  11. configarchitecture "i386"
  12. insertpackage 'unstable' 'foo' 'all' '1.0'
  13. insertsource 'unstable' 'foo' 'all' '1.0'
  14. setupaptarchive
  15. changetowebserver
  16. # FIXME:
  17. # - also check the unauth -> auth success case, i.e. that all files are
  18. # reverified
  19. runtest() {
  20. # start unauthenticated
  21. find rootdir/var/lib/apt/lists/ -type f | xargs rm -f
  22. rm -f aptarchive/dists/unstable/*Release*
  23. # remove uncompressed version
  24. find aptarchive/ -name Packages | xargs rm -f
  25. aptget update -qq --allow-unauthenticated
  26. # become authenticated
  27. generatereleasefiles
  28. signreleasefiles
  29. # and ensure we re-check the downloaded data
  30. msgtest "Check rollback on going from unauth -> auth"
  31. # change the local packages file
  32. PKGS=$(ls rootdir/var/lib/apt/lists/*Packages*)
  33. echo "meep" > $PKGS
  34. ls -l rootdir/var/lib/apt/lists > lists.before
  35. # update and ensure all is reverted on the hashsum failure
  36. aptget update -o Debug::Acquire::Transaction=1 -o Debug::pkgAcquire::Auth=1 -o Debug::pkgAcquire::worker=0 > output.log 2>&1 || true
  37. # ensure we have before what we have after
  38. ls -l rootdir/var/lib/apt/lists > lists.after
  39. if diff -u lists.before lists.after; then
  40. msgpass
  41. else
  42. #cat output.log
  43. msgfail
  44. fi
  45. }
  46. for COMPRESSEDINDEXES in 'false' 'true'; do
  47. echo "Acquire::GzipIndexes \"$COMPRESSEDINDEXES\";" > rootdir/etc/apt/apt.conf.d/compressindexes
  48. if $COMPRESSEDINDEXES; then
  49. msgmsg 'Run tests with GzipIndexes enabled'
  50. else
  51. msgmsg 'Run tests with GzipIndexes disabled'
  52. fi
  53. runtest
  54. done