usbguard-0.7.4.ebuild 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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 qt4 qt5 +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. systemd? ( sys-apps/systemd )
  28. dbus? ( sys-apps/dbus
  29. dev-libs/dbus-glib )
  30. policykit? ( sys-auth/polkit )
  31. qt4? ( dev-qt/qtgui:4
  32. dev-qt/qtsvg:4
  33. dev-qt/qtcore:4 )
  34. qt5? ( dev-qt/qtgui:5
  35. dev-qt/qtsvg:5
  36. dev-qt/qtwidgets:5
  37. dev-qt/qtcore:5 )
  38. crypt? (
  39. crypt_gcrypt? ( dev-libs/libgcrypt )
  40. crypt_sodium? ( dev-libs/libsodium )
  41. )"
  42. RDEPEND="${DEPEND}
  43. virtual/udev"
  44. REQUIRED_USE="
  45. crypt? (
  46. ^^ (
  47. crypt_sodium
  48. crypt_gcrypt
  49. )
  50. )
  51. ?? ( qt4 qt5 )"
  52. #PATCHES=(
  53. # "${FILESDIR}/openrc-support.patch"
  54. #)
  55. src_prepare() {
  56. default
  57. eautoreconf
  58. #eapply "${WORKDIR}"/openrc-support.patch
  59. }
  60. src_configure() {
  61. local myconf=()
  62. if use crypt_gcrypt; then
  63. myconf+=( --with-crypto-library=gcrypt )
  64. elif use crypt_sodium; then
  65. myconf+=( --with-crypto-library=sodium )
  66. fi
  67. if use qt5; then
  68. myconf+=( --with-gui-qt=qt5 )
  69. elif use qt4; then
  70. myconf+=( --with-gui-qt=qt4 )
  71. fi
  72. if use policykit; then
  73. myconf+=( --with-polkit )
  74. fi
  75. econf \
  76. $(use_enable systemd) \
  77. $(use_with dbus) \
  78. --with-bundled-catch \
  79. --with-bundled-pegtl \
  80. "${myconf[@]}" \
  81. LIBS=-lpthread
  82. }
  83. src_compile() {
  84. if use qt5; then
  85. export QT_SELECT=qt5
  86. elif use qt4; then
  87. export QT_SELECT=qt4
  88. fi
  89. emake
  90. }
  91. src_install() {
  92. emake DESTDIR="${D}" install
  93. if use systemd; then
  94. systemd_dounit usbguard.service
  95. fi
  96. doinitd "${FILESDIR}"/openRC/usbguard
  97. doinitd "${FILESDIR}"/openRC/usbguard-dbus
  98. doconfd "${FILESDIR}"/openRC/conf.d/usbguard
  99. doconfd "${FILESDIR}"/openRC/conf.d/usbguard-dbus
  100. insinto "/etc/usbguard"
  101. doins usbguard-daemon.conf
  102. }
  103. pkg_postinst() {
  104. elog "You will need to allow access to your user for accessing the QT gui."
  105. elog "Execute as root. usbguard add-user YOUR_USERNAME --devices ALL --exceptions ALL"
  106. }