blob: c062f27059d4da0ec803cc722482e5a0c7b952a3 [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)} \
Andrew Geissler220dafd2023-10-04 10:18:08 -050034 ${@bb.utils.filter('DISTRO_FEATURES', 'seccomp', d)} \
Andrew Geissler517393d2023-01-13 08:55:19 -060035 ${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)} \
36"
37
38# USBGuard has made polkit mandatory to configure with-dbus
39PACKAGECONFIG[dbus] = "--with-dbus,--without-dbus,dbus-glib polkit"
40PACKAGECONFIG[libgcrypt] = "--with-crypto-library=gcrypt,,libgcrypt,,,libsodium openssl"
41PACKAGECONFIG[libsodium] = "--with-crypto-library=sodium,,libsodium,,,libgcrypt openssl"
42PACKAGECONFIG[openssl] = "--with-crypto-library=openssl,,openssl,,,libgcrypt libsodium"
43PACKAGECONFIG[polkit] = "--with-polkit,--without-polkit,polkit"
44PACKAGECONFIG[seccomp] = "--enable-seccomp,--disable-seccomp,libseccomp"
45PACKAGECONFIG[systemd] = "--enable-systemd,--disable-systemd,systemd"
46
47SYSTEMD_PACKAGES = "${PN}"
48
49SYSTEMD_SERVICE:${PN} = "usbguard.service ${@bb.utils.contains('PACKAGECONFIG', 'dbus', 'usbguard-dbus.service', '', d)}"
50
51FILES:${PN} += "\
52 ${systemd_unitdir}/system/usbguard.service \
53 ${systemd_unitdir}/system/usbguard-dbus.service \
54 ${datadir}/polkit-1 \
55 ${datadir}/dbus-1 \
56 ${nonarch_libdir}/tmpfiles.d \
57"
58
59do_install:append() {
60# Create /var/log/usbguard in runtime.
61 if [ "${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)}" ]; then
62 install -d ${D}${nonarch_libdir}/tmpfiles.d
63 echo "d ${localstatedir}/log/${BPN} 0755 root root -" > ${D}${nonarch_libdir}/tmpfiles.d/${BPN}.conf
64 fi
65 if [ "${@bb.utils.filter('DISTRO_FEATURES', 'sysvinit', d)}" ]; then
66 install -d ${D}${sysconfdir}/default/volatiles
67 echo "d root root 0755 ${localstatedir}/log/${BPN} none" > ${D}${sysconfdir}/default/volatiles/99_${BPN}
68 fi
69 rm -rf ${D}${localstatedir}/log
70}