File ufp.spec of Package ufp

#
# spec file for package ufp
#
# Copyright (c) 2024, Martin Hauke <mardnh@gmx.de>
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name:           ufp
Version:        0~git20240117
Release:        0
Summary:        OpenWrt network device fingerprinting service
License:        GPL-2.0-only
URL:            https://git.openwrt.org/?p=project/ufp.git;a=summary
Source:         %{name}-%{version}.tar.xz
BuildRequires:  cmake
BuildRequires:  libubox-devel
BuildRequires:  pkgconfig
BuildRequires:  ucode-devel
BuildRequires:  pkgconfig(json-c)
Requires:       udhcpsnoop
Requires:       umdnsd

%description
OpenWrt network device fingerprinting service.

%prep
%setup -q
find . -type f -exec sed -i 's|#!%{_bindir}/env ucode|#!%{_bindir}/ucode|g' {} +

%build
cd src
%cmake
%cmake_build

%install
# FIXME
#ucode ./scripts/convert-devices.uc $(1)/usr/share/ufp/devices.bin ./data/*.json

install -d %{buildroot}%{_sysconfdir}/ufp/
install -d %{buildroot}%{_datadir}/ufp/
mv files/usr/share/ufp/*.uc %{buildroot}%{_datadir}/ufp/
#install -Dpm0755 files%%{_initddir}/ufp %%{buildroot}%%{_initddir}/ufp
install -Dpm0755 files/usr/sbin/ufpd %{buildroot}%{_sbindir}/ufpd
# ucode extension
install -Dpm0755 ./src/build/uht.so %{buildroot}%{_libdir}/ucode/uht.so

%files
%doc README.md
%{_sysconfdir}/ufp/
#%%exclude %%{_initddir}/ufp
%{_sbindir}/ufpd
%dir %{_datadir}/ufp
%{_datadir}/ufp/plugin_dhcp.uc
%{_datadir}/ufp/plugin_mdns.uc
%{_datadir}/ufp/plugin_wifi.uc
#%%{_datadir}/ufp/devices.bin
%{_libdir}/ucode/uht.so

%changelog
openSUSE Build Service is sponsored by