PKGBUILD 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. # SPDX-License-Identifier: CC0-1.0
  2. # Maintainer: Parabola Hackers <dev@lists.parabola.nu>
  3. # NOTE: This PKGBUILD does not need to be edited manually.
  4. # You do not need to build it, nor `librerelease` it.
  5. # The package is built automatically by autobuilder,
  6. # upon a `git push` to the 'master' branch of hackers.git.
  7. # The autobuilder will modify this PKGBUILD, replacing $pkgver and $_gitrev,
  8. # build and publish the package, and commit the modified PKGBUILD to abslibre.
  9. #
  10. # To generate a new keyring:
  11. # $ KEY_ID=<YOUR_40_CHAR_KEY_ID> # 'pgp_keyid' in your hackers.git YAML file
  12. # $ cd /path/to/hackers.git/
  13. # $ gpg --armor --no-emit-version --export $KEY_ID > keys/$KEY_ID.asc
  14. # $ git commit -S -m 'update my key' keys/$KEY_ID.asc
  15. # $ git push parabola master
  16. pkgname=parabola-keyring
  17. pkgver=20241022
  18. _gitrev=9912b4f19e97fceb04ce02c287b8e55c241c2fa9
  19. pkgrel=1
  20. pkgdesc="Parabola GNU/Linux-libre PGP keyring"
  21. arch=(any)
  22. url=https://wiki.parabola.nu/Parabola_Keyring
  23. license=(CC0-1.0)
  24. makedepends=(git parabola-hackers)
  25. install=${pkgname}.install
  26. source=(hackers-${_gitrev}-git::git://git.parabola.nu/hackers.git#commit=${_gitrev})
  27. sha512sums=(SKIP)
  28. build()
  29. {
  30. collect_keyids() # (sed_rx)
  31. {
  32. export PARABOLA_HACKERS_YAMLDIR="${srcdir}"/hackers-${_gitrev}-git/users
  33. /usr/lib/parabola-hackers/pgp-list-keyids | sed --quiet --regexp-extended "$1"
  34. }
  35. # prep
  36. rm -rf build/ ; mkdir -p build/ ; touch build/parabola{.gpg,-{revoked,trusted}} ;
  37. cd "${srcdir}"/build
  38. # collect key IDs
  39. collect_keyids 's|^revoked/\S+ ||p' >> parabola-revoked # lines like: <KEY_ID>
  40. collect_keyids 's|^trusted/\S+ (\S+)|\1:4:|p' >> parabola-trusted # lines like: <KEY_ID>:4:
  41. # generate keyring data file
  42. local keys_dir="${srcdir}"/hackers-${_gitrev}-git/keys
  43. local key_begin='-----BEGIN PGP PUBLIC KEY BLOCK-----'
  44. local key_end='-----END PGP PUBLIC KEY BLOCK-----'
  45. local key_id
  46. local key_file
  47. for key_id in $(cut -d: -f1 parabola-trusted)
  48. do key_file="${keys_dir}"/${key_id}.asc
  49. if [[ -f "${key_file}" ]]
  50. then if (( $(grep --count -- "${key_begin}" "${key_file}") == 1 &&
  51. $(grep --count -- "${key_end}" "${key_file}") == 1 ))
  52. then echo "certifying trusted key_id: ${key_id}"
  53. cat "${key_file}" >> parabola.gpg # concatenated ASCII keys
  54. else echo "invalid key_file: ${key_id}.asc"
  55. fi
  56. else echo "key_file missing for trusted key_id: ${key_id}"
  57. fi
  58. done
  59. # verify collected keys
  60. local n_trusted_keys=$( grep --count ':' parabola-trusted)
  61. local n_certified_keys=$(grep --count -- "${key_end}" parabola.gpg )
  62. if (( n_certified_keys ))
  63. then echo "certified (${n_certified_keys}/${n_trusted_keys}) keys"
  64. elif (( n_trusted_keys ))
  65. then echo "ERROR: no keys were certifed" ; return 1 ;
  66. else echo "ERROR: no trusted keys found" ; return 1 ;
  67. fi
  68. }
  69. package()
  70. {
  71. cd "${srcdir}"/build
  72. install -Dm644 parabola-revoked "${pkgdir}"/usr/share/pacman/keyrings/parabola-revoked
  73. install -Dm644 parabola-trusted "${pkgdir}"/usr/share/pacman/keyrings/parabola-trusted
  74. install -Dm644 parabola.gpg "${pkgdir}"/usr/share/pacman/keyrings/parabola.gpg
  75. }