test-apt-key-net-update 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. testequalor2 'Checking for new archive signing keys now
  22. gpg: key F68C85A3: public key "Test Automatic Archive Signing Key <ftpmaster@example.com>" imported
  23. gpg: Total number processed: 1
  24. gpg: imported: 1 (RSA: 1)' 'Checking for new archive signing keys now
  25. gpg: key F68C85A3: public key "Test Automatic Archive Signing Key <ftpmaster@example.com>" imported
  26. gpg: Total number processed: 1
  27. gpg: imported: 1' cat rootdir/tmp/testsuccess.output
  28. testaptkeys 'oldarchive' 'newarchive'
  29. # now try a different one
  30. # setup archive-keyring
  31. mkdir -p aptarchive/ubuntu/project
  32. install -m0644 keys/marvinparanoid.pub aptarchive/ubuntu/project/
  33. echo "APT::Key::ArchiveKeyringURI \"http://localhost:${APTHTTPPORT}/ubuntu/project/marvinparanoid.pub\";" >> ./aptconfig.conf
  34. echo 'APT::Key::Net-Update-Enabled "1";' >> ./aptconfig.conf
  35. # test against the "real" webserver
  36. testsuccessequal "Checking for new archive signing keys now
  37. Key 'DE66AECA9151AFA1877EC31DE8525D47528144E2' not added. It is not signed with a master key" aptkey --fakeroot net-update
  38. testaptkeys 'oldarchive' 'newarchive'