File vpncloud.spec of Package vpncloud

#
# spec file for package vpncloud
#
# Copyright (c) 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 https://bugs.opensuse.org/
#

%define services vpncloud@.service vpncloud.target vpncloud-wsproxy.service
Name:           vpncloud
Version:        2.2.0
Release:        0
Summary:        Peer-to-peer VPN
License:        GPL-3.0-or-later
URL:            https://vpncloud.ddswd.de/
Source:         https://github.com/dswd/vpncloud/archive/refs/tags/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1:        vendor.tar.xz
Source2:        cargo_config
BuildRequires:  pkgconfig
BuildRequires:  rust-packaging
BuildRequires:  ruby3.0-rubygem-asciidoctor
BuildRequires:  systemd-rpm-macros

%description
VpnCloud is a high performance peer-to-peer mesh VPN over UDP
supporting strong encryption, NAT traversal and a simple
configuration. It establishes a fully-meshed self-healing VPN
network in a peer-to-peer manner with strong end-to-end
encryption based on elliptic curve keys and AES-256.

VpnCloud creates a virtual network interface on the host and
forwards all received data via UDP to the destination. It can
work on TUN devices (IP based) and TAP devices (Ethernet based).

%prep
%autosetup -p 1 -a 1
install -D -m 0644 %{SOURCE2} .cargo/config

%build
%{cargo_build}

%install
install -D -m 0755 target/release/vpncloud %{buildroot}%{_bindir}/vpncloud
install -d -m 0750 %{buildroot}%{_sysconfdir}/%{name}
install -m 0600 assets/example.net.disabled %{buildroot}%{_sysconfdir}/%{name}/example.net.disabled
install -D -m 0644 target/vpncloud.1.gz %{buildroot}/%{_mandir}/man1/vpncloud.1.gz

for service in %{services} ; do
  install -D -m 0644 assets/$service  %{buildroot}%{_unitdir}/$service
done


%pre
%service_add_pre %{services}

%post
%service_add_post %{services}

%preun
%service_del_preun %{services}

%postun
%service_del_postun %{services}

%check
cargo test --release --verbose --

%files
%license LICENSE.md
%doc CHANGELOG.md README.md
%{_bindir}/vpncloud
%dir %{_sysconfdir}/vpncloud/
%config(noreplace) %{_sysconfdir}/vpncloud/example.net.disabled
%{_unitdir}/vpncloud@.service
%{_unitdir}/vpncloud.target
%{_unitdir}/vpncloud-wsproxy.service
%{_mandir}/man1/vpncloud.1%{?ext_man}

%changelog
openSUSE Build Service is sponsored by