File spyserver.spec of Package spyserver

#
# spec file for package spyserver
#
# Copyright (c) 2017-2021, 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/
#

%define spyserver_group spyserver
%define spyserver_user  spyserver
%define airspy_group    airspy
%define airspyhf_group  airspyhf
%define rtlsdr_group    rtlsdr
Name:           spyserver
Version:        2.0.1732
Release:        0
Summary:        SDR#'s Streaming Server
License:        NonFree
Group:          Productivity/Hamradio/Other
URL:            https://airspy.com
Source0:        https://airspy.com/downloads/%{name}-linux-x64.tgz
Source1:        https://airspy.com/downloads/%{name}-linux-x86.tgz
Source2:        https://airspy.com/downloads/%{name}-arm64.tgz
Source3:        https://airspy.com/downloads/%{name}-arm32.tgz
Source9:        spyserver.service
BuildRequires:  airspy-udev
BuildRequires:  airspyhf-udev
BuildRequires:  rtl-sdr-udev
Requires:       airspy-devel
Requires:       airspyhf-devel
Requires:       rtl-sdr-devel
Requires(pre):  shadow
ExclusiveArch:  %{ix86} x86_64 %{arm} aarch64

%description
Airspy R0, R2, Mini, HF+ and RTL-SDR can be used as a high performance SDR
receiver capable of streaming separate chunks of the spectrum to multiple
clients over the LAN or the Internet.

%prep
%ifarch x86_64
%setup -q -T -a0 -c %{name}-%{version}
%endif
%ifarch i586
%setup -q -T -a1 -c %{name}-%{version}
%endif
%ifarch aarch64
%setup -q -T -a2 -c %{name}-%{version}
%endif
%ifarch %{arm}
%setup -q -T -a3 -c %{name}-%{version}
%endif

%build

%install
install -d %{buildroot}/%{_bindir}
install -d %{buildroot}/%{_sbindir}
install -d %{buildroot}/%{_sysconfdir}
install -m0755 spyserver %{buildroot}/%{_bindir}
install -m0644 spyserver.config %{buildroot}/%{_sysconfdir}
install -Dpm0644 %{SOURCE9} "%{buildroot}%{_unitdir}/spyserver.service"
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rcspyserver

%pre
getent group %{spyserver_group} >/dev/null || groupadd -r %{spyserver_group}
getent passwd %{spyserver_user} >/dev/null || useradd -r -g %{spyserver_group} -G %{airspy_group},%{airspyhf_group},%{rtlsdr_group} -d /tmp -s /sbin/nologin -c "user for SDR#'s SpyServer" %{spyserver_user}
%service_add_pre spyserver.service

%post
%service_add_post spyserver.service

%preun
%service_del_preun spyserver.service

%postun
%service_del_postun spyserver.service

%files
%{_bindir}/spyserver
%config(noreplace) %{_sysconfdir}/spyserver.config
%{_unitdir}/spyserver.service
%{_sbindir}/rcspyserver

%changelog
openSUSE Build Service is sponsored by