test-apt-key-net-update 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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:8080/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. testequal 'Checking for new archive signing keys now
  21. gpg: key F68C85A3: public key "Test Automatic Archive Signing Key <ftpmaster@example.com>" imported
  22. gpg: Total number processed: 1
  23. gpg: imported: 1 (RSA: 1)' aptkey --fakeroot net-update
  24. # now try a different one
  25. # setup archive-keyring
  26. mkdir -p aptarchive/ubuntu/project
  27. install -m0644 keys/marvinparanoid.pub aptarchive/ubuntu/project/
  28. echo 'APT::Key::ArchiveKeyringURI "http://localhost:8080/ubuntu/project/marvinparanoid.pub";' >> ./aptconfig.conf
  29. echo 'APT::Key::Net-Update-Enabled "1";' >> ./aptconfig.conf
  30. # test against the "real" webserver
  31. testequal "Checking for new archive signing keys now
  32. Key 'E8525D47528144E2' not added. It is not signed with a master key" aptkey --fakeroot net-update