File hide.me.spec of Package hide.me

#
# spec file for package hide.me
#
# Copyright (c) 2025 mantarimay
#
# 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:           hide.me
Version:        0
Release:        0
Summary:        A hide.me-cli VPN client for Linux
License:        MIT
URL:            https://github.com/eventure/hide.client.linux
Source0:        %{name}-%{version}.tar.zst
Source1:        vendor.tar.zst
BuildRequires:  golang-packaging
BuildRequires:  zstd

%description
Hide.me CLI is a VPN client for use with eVenture Ltd. Hide.me VPN
service based on the WireGuard protocol. 

%prep
%autosetup -n %{name}-%{version} -p1 -a1

sed -i \
  -e 's|CA: *"CA\.pem"|CA: "/usr/share/hide.me/CA.pem"|' \
  -e 's|AccessTokenPath: *"accessToken\.txt"|AccessTokenPath: "/etc/hide.me/accessToken.txt"|' \
  configuration.go

sed -i 's|ExecStart=/opt/hide.me/hide.me \(.*\)|ExecStart=/usr/bin/hide.me \1|' hide.me@.service
sed -i 's|WorkingDirectory=/opt/hide.me|WorkingDirectory=/etc/hide.me|' hide.me@.service
sed -i 's|ReadWritePaths=/opt/hide.me /etc -/run/systemd/resolve|ReadWritePaths=/etc/hide.me /etc/resolv.conf -/run/systemd/resolve|' hide.me@.service
sed -i 's|EnvironmentFile=/opt/hide.me/config|EnvironmentFile=/etc/hide.me/config|' hide.me@.service


%build
go build \
   -o build/%{name} \
   -mod=vendor \
   -ldflags="-s -w" \
   -buildmode=pie

%install
install -Dm0755 build/%{name} -t %{buildroot}%{_bindir}
install -Dm644 -t %{buildroot}%{_datadir}/%{name} CA.pem
install -Dm644 -t %{buildroot}%{_sysconfdir}/%{name} config
install -Dm644 -t %{buildroot}%{_userunitdir} hide.me@.service

%files
%license LICEN*
%doc README.md
%{_bindir}/%{name}
%{_datadir}/%{name}
%{_sysconfdir}/%{name}
%{_userunitdir}

%changelog
openSUSE Build Service is sponsored by