opkg-keyrings_1.0.bb 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. SUMMARY = "Keyrings for verifying opkg packages and feeds"
  2. LICENSE = "MIT"
  3. LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
  4. # Distro-specific keys can be added to this package in two ways:
  5. #
  6. # 1) In a .bbappend, add .gpg and/or .asc files to SRC_URI and install them to
  7. # ${D}${datadir}/opkg/keyrings/ in a do_install_append function. These
  8. # files should not be named 'key-$name.gpg' to ensure they don't conflict
  9. # with keys exported as per (2).
  10. #
  11. # 2) In a .bbappend, distro config or local.conf, override the variable
  12. # OPKG_KEYRING_KEYS to contain a space-separated list of key names. For
  13. # each name, 'gpg --export $name' will be ran to export the public key to a
  14. # file named 'key-$name.gpg'. The public key must therefore be in the gpg
  15. # keyrings on the build machine.
  16. OPKG_KEYRING_KEYS ?= ""
  17. do_compile() {
  18. for name in ${OPKG_KEYRING_KEYS}; do
  19. gpg --export ${name} > ${B}/key-${name}.gpg
  20. done
  21. }
  22. do_install () {
  23. install -d ${D}${datadir}/opkg/keyrings/
  24. for name in ${OPKG_KEYRING_KEYS}; do
  25. install -m 0644 ${B}/key-${name}.gpg ${D}${datadir}/opkg/keyrings/
  26. done
  27. }
  28. FILES_${PN} = "${datadir}/opkg/keyrings"
  29. # We need 'opkg-key' to run the postinst script
  30. RDEPENDS_${PN} = "opkg"
  31. pkg_postinst_ontarget_${PN} () {
  32. if test -x ${bindir}/opkg-key
  33. then
  34. ${bindir}/opkg-key populate
  35. fi
  36. }