usbguard-9999.ebuild 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. # Copyright 1999-2016 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. # $Id$
  4. EAPI=7
  5. inherit autotools git-r3 systemd
  6. DESCRIPTION="The USBGuard software framework helps to protect your computer against BadUSB."
  7. HOMEPAGE="https://github.com/dkopecek/usbguard"
  8. MY_AUTHOR="dkopecek"
  9. EGIT_REPO_URI="https://github.com/${MY_AUTHOR}/${PN}.git"
  10. EGIT_SUBMODULES=( src/ThirdParty/Catch src/ThirdParty/PEGTL src/ThirdParty/usbmon )
  11. if [[ ${PV} == "9999" ]] ; then
  12. EGIT_BRANCH="master"
  13. KEYWORDS=""
  14. else
  15. EGIT_COMMIT="usbguard-${PV}"
  16. KEYWORDS="~x86 ~amd64"
  17. fi
  18. LICENSE="GPL-2"
  19. SLOT="0"
  20. IUSE="crypt +dbus +policykit +systemd"
  21. IUSE+=" crypt_gcrypt crypt_sodium"
  22. DEPEND="sys-cluster/libqb
  23. sys-libs/libseccomp
  24. sys-libs/libcap-ng
  25. dev-ruby/asciidoctor
  26. dev-libs/protobuf
  27. >=sys-cluster/libqb-0.16.0
  28. systemd? ( sys-apps/systemd )
  29. dbus? ( sys-apps/dbus
  30. dev-libs/dbus-glib )
  31. policykit? ( sys-auth/polkit )
  32. crypt? (
  33. crypt_gcrypt? ( dev-libs/libgcrypt )
  34. crypt_sodium? ( dev-libs/libsodium )
  35. )"
  36. RDEPEND="${DEPEND}
  37. virtual/udev"
  38. REQUIRED_USE="
  39. crypt? (
  40. ^^ (
  41. crypt_sodium
  42. crypt_gcrypt
  43. )
  44. )"
  45. #PATCHES=(
  46. # "${FILESDIR}/openrc-support.patch"
  47. #)
  48. src_prepare() {
  49. default
  50. eautoreconf
  51. #eapply "${WORKDIR}"/openrc-support.patch
  52. }
  53. src_configure() {
  54. local myconf=()
  55. if use crypt_gcrypt; then
  56. myconf+=( --with-crypto-library=gcrypt )
  57. elif use crypt_sodium; then
  58. myconf+=( --with-crypto-library=sodium )
  59. fi
  60. if use policykit; then
  61. myconf+=( --with-polkit )
  62. fi
  63. econf \
  64. $(use_enable systemd) \
  65. $(use_with dbus) \
  66. --with-bundled-catch \
  67. --with-bundled-pegtl \
  68. "${myconf[@]}"
  69. }
  70. src_install() {
  71. emake DESTDIR="${D}" install
  72. if use systemd; then
  73. systemd_dounit usbguard.service
  74. fi
  75. doinitd "${FILESDIR}"/openRC/usbguard
  76. doinitd "${FILESDIR}"/openRC/usbguard-dbus
  77. doconfd "${FILESDIR}"/openRC/conf.d/usbguard
  78. doconfd "${FILESDIR}"/openRC/conf.d/usbguard-dbus
  79. insinto "/etc/usbguard"
  80. doins usbguard-daemon.conf
  81. }
  82. pkg_postinst() {
  83. elog "You will need to allow access to your user for accessing the QT gui."
  84. elog "Execute as root. usbguard add-user YOUR_USERNAME --devices ALL --exceptions ALL"
  85. }