blob: 4e96b4f41e3f7c5bae786c00becbf81d812ef6ac [file] [log] [blame]
Andrew Geissler517393d2023-01-13 08:55:19 -06001# Copyright (c) 2021 Koninklijke Philips N.V.
2#
3# SPDX-License-Identifier: MIT
4#
5SUMMARY = "USBGuard daemon for blacklisting and whitelisting of USB devices"
6DESCRIPTION = "The USBGuard software framework helps to protect your computer against \
7rogue USB devices (a.k.a. Bad USB) by implementing basic whitelisting and blacklisting \
8capabilities based on device attributes. This recipe takes OpenSSL as crypto-backend for \
9computing device hashes (Supported values are sodium, gcrypt, openssl)."
10HOMEPAGE = "https://usbguard.github.io/"
11LICENSE = "GPL-2.0-only"
12LIC_FILES_CHKSUM = "file://LICENSE;md5=b234ee4d69f5fce4486a80fdaf4a4263"
13
14SRC_URI = "https://github.com/USBGuard/usbguard/releases/download/${BPN}-${PV}/${BPN}-${PV}.tar.gz \
Patrick Williamsb9af8752023-01-30 13:28:01 -060015 file://0001-include-missing-cstdint.patch \
Andrew Geissler517393d2023-01-13 08:55:19 -060016 file://0001-Add-and-use-pkgconfig-instead-of-libgcrypt-config.patch"
17
18SRC_URI[sha256sum] = "dcf5c90f3f93030e04df1baeb8d388b678c40dd48b135ea12a7be7dee8944934"
19
20inherit autotools-brokensep bash-completion pkgconfig systemd github-releases
21
22DEPENDS = "glib-2.0-native libcap-ng libqb libxml2-native libxslt-native protobuf protobuf-native xmlto-native"
23
24UPSTREAM_CHECK_REGEX = "releases/tag/usbguard-(?P<pver>\d+(\.\d+)+)"
25
26EXTRA_OECONF += "\
27 --with-bundled-catch \
28 --with-bundled-pegtl \
29"
30
31PACKAGECONFIG ?= "\
32 openssl \
33 ${@bb.utils.filter('DISTRO_FEATURES', 'polkit', d)} \
34 ${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)} \
35"
36
37# USBGuard has made polkit mandatory to configure with-dbus
38PACKAGECONFIG[dbus] = "--with-dbus,--without-dbus,dbus-glib polkit"
39PACKAGECONFIG[libgcrypt] = "--with-crypto-library=gcrypt,,libgcrypt,,,libsodium openssl"
40PACKAGECONFIG[libsodium] = "--with-crypto-library=sodium,,libsodium,,,libgcrypt openssl"
41PACKAGECONFIG[openssl] = "--with-crypto-library=openssl,,openssl,,,libgcrypt libsodium"
42PACKAGECONFIG[polkit] = "--with-polkit,--without-polkit,polkit"
43PACKAGECONFIG[seccomp] = "--enable-seccomp,--disable-seccomp,libseccomp"
44PACKAGECONFIG[systemd] = "--enable-systemd,--disable-systemd,systemd"
45
46SYSTEMD_PACKAGES = "${PN}"
47
48SYSTEMD_SERVICE:${PN} = "usbguard.service ${@bb.utils.contains('PACKAGECONFIG', 'dbus', 'usbguard-dbus.service', '', d)}"
49
50FILES:${PN} += "\
51 ${systemd_unitdir}/system/usbguard.service \
52 ${systemd_unitdir}/system/usbguard-dbus.service \
53 ${datadir}/polkit-1 \
54 ${datadir}/dbus-1 \
55 ${nonarch_libdir}/tmpfiles.d \
56"
57
58do_install:append() {
59# Create /var/log/usbguard in runtime.
60 if [ "${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)}" ]; then
61 install -d ${D}${nonarch_libdir}/tmpfiles.d
62 echo "d ${localstatedir}/log/${BPN} 0755 root root -" > ${D}${nonarch_libdir}/tmpfiles.d/${BPN}.conf
63 fi
64 if [ "${@bb.utils.filter('DISTRO_FEATURES', 'sysvinit', d)}" ]; then
65 install -d ${D}${sysconfdir}/default/volatiles
66 echo "d root root 0755 ${localstatedir}/log/${BPN} none" > ${D}${sysconfdir}/default/volatiles/99_${BPN}
67 fi
68 rm -rf ${D}${localstatedir}/log
69}