File trusttunnel.spec of Package trusttunnel

#
# spec file for package trusttunnel
#
# Copyright (c) 2024 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:           trusttunnel
Version:        v0.9.115+git18.ga3fb4efe7702a6d7e2d90091accb49043c4e262a
Release:        0
Summary:        A secure tunnel for TrustTunnel
License:        MIT
Group:          Productivity/Networking/Security
URL:            https://github.com/TrustTunnel/TrustTunnel
Source0:        TrustTunnel-%{version}.tar.gz
Source1:        vendor-cargo.xz
Source2:        trusttunnel.service
Source3:        vpn.toml
Source4:        hosts.toml
BuildRequires:  cargo-packaging
BuildRequires:  rust >= 1.90
BuildRequires:  cmake
BuildRequires:  git
BuildRequires:  gcc-c++
BuildRequires:  systemd-rpm-macros
%{?systemd_requires}

%description
TrustTunnel provides a secure and easy-to-use tunneling solution.

%prep
%autosetup -p1 -n TrustTunnel-%{version}
tar -xf %{SOURCE1}

%build
cargo auditable build --release --offline

%install
install -D -m 0755 target/release/trusttunnel_endpoint %{buildroot}%{_bindir}/trusttunneld

install -D -m 0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/trusttunnel/vpn.toml
install -D -m 0644 %{SOURCE4} %{buildroot}%{_sysconfdir}/trusttunnel/hosts.toml
install -D -m 0644 %{SOURCE2} %{buildroot}%{_unitdir}/trusttunnel.service
mkdir -p %{buildroot}%{_sbindir}
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rctrusttunnel

%pre
%service_add_pre trusttunnel.service

%post
%service_add_post trusttunnel.service

%preun
%service_del_preun trusttunnel.service

%postun
%service_del_postun trusttunnel.service

%files
%license LICENSE
%doc README.md
%{_bindir}/trusttunneld
%{_unitdir}/trusttunnel.service
%{_sbindir}/rctrusttunnel
%dir %{_sysconfdir}/trusttunnel
%config(noreplace) %{_sysconfdir}/trusttunnel/vpn.toml
%config(noreplace) %{_sysconfdir}/trusttunnel/hosts.toml

%changelog
openSUSE Build Service is sponsored by