File nikau.spec of Package nikau

Name:           nikau
Version:        0.3.2+1
Release:        0
Summary:        Software KVM switch with clipboard sharing and wayland support
License:        AGPL-3.0-or-later
Url:            https://sr.ht/~nickbp/nikau/
Source0:        %{name}-%{version}.tar.zst
Source1:        vendor.tar.zst
Source2:        nikau-client.service
Source3:        nikau-server.service
Source4:        nikau-client@.service
Source5:        nikau-server@.service
Source6:        70-nikau.rules
Source7:        nikau.xml
Source8:        README-SUSE.md
BuildRequires:  cargo
BuildRequires:  cargo-packaging
ExclusiveArch:  %{rust_tier1_arches}

%bcond_without check

%description
Nikau is a Linux software KVM (keyboard-video-mouse) switch with clipboard
sharing. Any Linux machine should work, including Wayland, X11, and even Linux
consoles. Keyboards, mice, and touchpads are all tested and supported.

Please read README-SUSE.md.

%prep
%autosetup -p1 -a1

%build
%{cargo_build}
cp %{SOURCE8} .

%install
%{cargo_install}
install -m 0755 -d %{buildroot}%{_unitdir}
install -m 0644 -t %{buildroot}%{_unitdir} %{SOURCE4} %{SOURCE5}

install -m 0755 -d %{buildroot}%{_userunitdir}
install -m 0644 -t %{buildroot}%{_userunitdir} %{SOURCE2} %{SOURCE3}

install -m 0755 -d %{buildroot}%{_datadir}/polkit-1/rules.d
install -m 0644 -t %{buildroot}%{_datadir}/polkit-1/rules.d %{SOURCE6}

install -m 0755 -d %{buildroot}/usr/lib/firewalld/services
install -m 0644 -t %{buildroot}/usr/lib/firewalld/services %{SOURCE7}

%check
%if %{with check}
%{cargo_test}
%endif

%pre
%service_add_pre nikau-client@.service nikau-server@.service

%post
%service_add_post nikau-client@.service nikau-server@.service

%preun
%service_del_preun nikau-client@.service nikau-server@.service

%postun
%service_del_postun nikau-client@.service nikau-server@.service

%files
%license LICENCE.md
%doc README.md README-SUSE.md
%{_bindir}/%{name}
%{_unitdir}
%{_userunitdir}
%dir %{_datadir}/polkit-1
%attr(0750,root,polkitd) %dir %{_datadir}/polkit-1/rules.d
%{_datadir}/polkit-1/rules.d/*
/usr/lib/firewalld

%changelog
openSUSE Build Service is sponsored by