File rustdesk-server.spec of Package rustdesk-server
#
# spec file for package rustdesk-server
#
# Copyright (c) 2023 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#
Name: rustdesk-server
Version: 1.1.9
Release: 0
Summary: RustDesk Server Program
License: AGPL-3.0
URL: https://github.com/rustdesk/rustdesk-server
Source0: %{name}-%{version}.tar.zst
Source1: vendor.tar.zst
Source2: cargo_config
Source3: %{name}-hbbs.service
Source4: %{name}-hbbr.service
Source5: %{name}.firewalld
Source10: system-user-rustdesk.conf
BuildRequires: cargo-packaging
BuildRequires: firewall-macros
BuildRequires: sysuser-shadow
BuildRequires: sysuser-tools
PreReq: permissions
Requires: user(rustdesk)
Provides: system-user-rustdesk = %{version}-%{release}
Obsoletes: system-user-rustdesk < %{version}-%{release}
%{?systemd_requires}
%description
Self-host your own RustDesk server, it is free and open source.
%package -n system-user-rustdesk
Summary: System user for the %{name}
BuildArch: noarch
%{sysusers_requires}
%description -n system-user-rustdesk
%{summary}.
%prep
%autosetup -p1 -a1
install -D -m 644 %{SOURCE2} .cargo/config
%build
%sysusers_generate_pre %{SOURCE10} system-user-rustdesk
%{cargo_build}
%install
%{cargo_install} --frozen
%__install -D -m 0644 %{SOURCE3} %{buildroot}/%{_unitdir}/%{name}-hbbs.service
%__install -D -m 0644 %{SOURCE4} %{buildroot}/%{_unitdir}/%{name}-hbbr.service
%__install -D -m 0644 %{SOURCE10} %{buildroot}%{_sysusersdir}/system-user-rustdesk.conf
%__install -d %{buildroot}%{_sharedstatedir}/%{name}
%__install -d %{buildroot}%{_libexecdir}/firewalld/services/
%__install -D -m 0644 %{SOURCE10} %{buildroot}%{_libexecdir}/firewalld/services/%{name}.xml
%pre -n system-user-rustdesk -f system-user-rustdesk.pre
%check
%{cargo_test}
%pre
%service_add_pre %{name}-hbbs.service
%service_add_pre %{name}-hbbr.service
%post
%service_add_post %{name}-hbbs.service
%service_add_post %{name}-hbbr.service
%preun
%systemd_preun %{name}-hbbr.service
%systemd_preun %{name}-hbbs.service
%postun
%service_del_postun_with_restart %{name}-hbbs.service
%service_del_postun_with_restart %{name}-hbbr.service
%files
%license LICENSE
%doc README.md README-DE.md README-NL.md
%{_bindir}/hbbr
%{_bindir}/hbbs
%{_bindir}/rustdesk-utils
%{_unitdir}/%{name}-hbbs.service
%{_unitdir}/%{name}-hbbr.service
%dir %{_libexecdir}/firewalld
%dir %{_libexecdir}/firewalld/services
%{_libexecdir}/firewalld/services/%{name}.xml
%defattr(664,rustdesk,rustdesk,775)
%{_sharedstatedir}/%{name}
%files -n system-user-rustdesk
%{_sysusersdir}/system-user-rustdesk.conf
%changelog