test-apt-key-net-update 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/bin/sh
  2. set -e
  3. TESTDIR="$(readlink -f "$(dirname "$0")")"
  4. . "$TESTDIR/framework"
  5. setupenvironment
  6. configarchitecture "i386"
  7. changetowebserver
  8. # setup env
  9. mkdir -p var/lib/apt/keyrings
  10. mkdir -p usr/share/keyrings
  11. # install the fake master keyring
  12. install -m0644 keys/test-master-keyring.pub usr/share/keyrings
  13. echo "APT::Key::MasterKeyring \"${TMPWORKINGDIRECTORY}/usr/share/keyrings/test-master-keyring.pub\";" >> ./aptconfig.conf
  14. # setup archive-keyring
  15. mkdir -p aptarchive/ubuntu/project
  16. install -m0644 keys/test-archive-keyring.pub aptarchive/ubuntu/project/
  17. echo "APT::Key::ArchiveKeyringURI \"http://localhost:${APTHTTPPORT}/ubuntu/project/test-archive-keyring.pub\";" >> ./aptconfig.conf
  18. echo 'APT::Key::Net-Update-Enabled "1";' >> ./aptconfig.conf
  19. # test against the "real" webserver
  20. testsuccess aptkey --fakeroot net-update
  21. testfailure grep 'not added' rootdir/tmp/testsuccess.output
  22. testaptkeys 'oldarchive' 'newarchive'
  23. # now try a different one
  24. # setup archive-keyring
  25. mkdir -p aptarchive/ubuntu/project
  26. install -m0644 keys/marvinparanoid.pub aptarchive/ubuntu/project/
  27. echo "APT::Key::ArchiveKeyringURI \"http://localhost:${APTHTTPPORT}/ubuntu/project/marvinparanoid.pub\";" >> ./aptconfig.conf
  28. echo 'APT::Key::Net-Update-Enabled "1";' >> ./aptconfig.conf
  29. # test against the "real" webserver
  30. testsuccessequal "Checking for new archive signing keys now
  31. Key 'DE66AECA9151AFA1877EC31DE8525D47528144E2' not added. It is not signed with a master key" aptkey --fakeroot net-update
  32. testaptkeys 'oldarchive' 'newarchive'