usbguard/usbguard.spec
2020-06-19 17:33:50 +08:00

143 lines
3.9 KiB
RPMSpec

%global _hardened_build 1
Name: usbguard
Version: 0.7.2
Release: 6
Summary: A tool for computer usb guard
License: GPLv2+
URL: https://usbguard.github.io/
Source0: https://github.com/USBGuard/usbguard/releases/download/usbguard-%{version}/usbguard-%{version}.tar.gz
Source1: usbguard-daemon.conf
Patch0000: 0001-Update-to-latest-PEGTL-API.patch
BuildRequires: libqb-devel libgcrypt-devel libstdc++-devel protobuf-devel protobuf-compiler PEGTL-static
BuildRequires: catch1-devel autoconf automake libtool bash-completion asciidoctor audit-libs-devel systemd
BuildRequires: qt5-qtbase-devel qt5-qtsvg-devel qt5-linguist dbus-glib-devel dbus-devel glib2-devel
BuildRequires: polkit-devel libxslt libxml2
Requires: systemd
%description
USBGuard helps to protect your computer against rogue USB devices.
%package devel
Summary: Development files for usbguard
Requires: usbguard = %{version}-%{release} pkgconfig libstdc++-devel
%description devel
Development libraries and header files for usbguard.
%package tools
Summary: USBGuard Tools
Requires: usbguard = %{version}-%{release}
%description tools
Optional tools from the USBGuard software framework.
%package applet-qt
Summary: USBGuard Qt 5.x Applet
Requires: usbguard = %{version}-%{release}
Obsoletes: usbguard-applet-qt <= 0.3
%description applet-qt
Optional Qt 5.x desktop applet for interacting with the USBGuard daemon component.
%package dbus
Summary: USBGuard D-Bus Service
Requires: usbguard = %{version}-%{release} dbus polkit
%description dbus
Optional component that provides a D-Bus interface to the USBGuard daemon component.
%package help
Summary: Documentation for usbguard
Requires: usbguard = %{version}-%{release}
%description help
Documentation for usbguard
%prep
%autosetup -n usbguard-%{version} -p1
rm -rf src/ThirdParty/{Catch,PEGTL}
%build
install -d ./m4
autoreconf -i -v --no-recursive ./
%configure --disable-silent-rules --without-bundled-catch --without-bundled-pegtl \
--enable-systemd --with-gui-qt=qt5 --with-dbus --with-polkit \
--with-crypto-library=gcrypt
%make_build
%check
make check
%install
%make_install
install -d %{buildroot}%{_sysconfdir}/usbguard/IPCAccessControl.d
cp %{SOURCE1} %{buildroot}%{_sysconfdir}/usbguard/usbguard-daemon.conf
chmod 644 %{buildroot}%{_sysconfdir}/usbguard/usbguard-daemon.conf
%delete_la
%preun
%systemd_preun usbguard.service
%post
/sbin/ldconfig
%systemd_post usbguard.service
%postun
/sbin/ldconfig
%systemd_postun usbguard.service
%preun dbus
%systemd_preun usbguard-dbus.service
%post dbus
%systemd_post usbguard-dbus.service
%postun dbus
%systemd_postun_with_restart usbguard-dbus.service
%files
%doc LICENSE
%exclude %{_libdir}/*.a
%{_libdir}/*.so.*
%{_sbindir}/usbguard-daemon
%{_bindir}/usbguard
%dir %{_localstatedir}/log/usbguard
%dir %{_sysconfdir}/usbguard
%dir %{_sysconfdir}/usbguard/IPCAccessControl.d
%config(noreplace) %attr(0600,-,-) %{_sysconfdir}/usbguard/usbguard-daemon.conf
%config(noreplace) %attr(0600,-,-) %{_sysconfdir}/usbguard/rules.conf
%{_unitdir}/usbguard.service
%{_datadir}/bash-completion/completions/usbguard
%files devel
%{_includedir}/*
%{_libdir}/*.so
%{_libdir}/pkgconfig/*.pc
%files tools
%{_bindir}/usbguard-rule-parser
%files applet-qt
%{_bindir}/usbguard-applet-qt
%{_datadir}/applications/usbguard-applet-qt.desktop
%{_datadir}/icons/hicolor/scalable/apps/usbguard-icon.svg
%files dbus
%{_sbindir}/usbguard-dbus
%{_datadir}/dbus-1/system-services/org.usbguard.service
%{_datadir}/dbus-1/system.d/org.usbguard.conf
%{_datadir}/polkit-1/actions/org.usbguard.policy
%{_unitdir}/usbguard-dbus.service
%files help
%doc README.adoc CHANGELOG.md
%{_mandir}/*/*
%changelog
* Mon Apr 27 2020 lizhenhua <lizhenhua21@huawei.com> - 0.7.2-6
- Package init