File nebula.spec of Package nebula

#
# spec file for package nebula
#
# Copyright (c) 2025 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:           nebula
Version:        1.9.5
Release:        0
Summary:        A scalable overlay networking tool
License:        MIT
URL:            https://github.com/slackhq/nebula
Source0:        %{name}-%{version}.tar.gz
Source1:        vendor.tar.zst
Source2:        %{name}.service
Patch0:         fix-CVE-2025-22869.patch
BuildRequires:  git-core
BuildRequires:  golang-packaging
BuildRequires:  zstd
BuildRequires:  golang(API) >= 1.23.6

%description
Nebula is a scalable overlay networking tool with a focus on performance,
simplicity and security. It lets you seamlessly connect computers anywhere
in the world. It can be used to connect a small number of computers,
but is also able to connect tens of thousands of computers.

%package cert
Summary:        Seperate %{name}-cert package

%description cert
This package only includes the %{name}-cert binary.

%prep
%autosetup -a1

%build
go build -buildmode=pie -mod=vendor -ldflags "-X main.Build=%{version}-dirty" -o %{name} ./cmd/%{name}
go build -buildmode=pie -mod=vendor -ldflags "-X main.Build=%{version}-dirty" -o %{name}-cert ./cmd/%{name}-cert

%install
install -Dm0755 -t %{buildroot}%{_sbindir} %{name}
install -Dm0755 -t %{buildroot}%{_bindir} %{name}-cert
install -Dm0644 -t %{buildroot}%{_unitdir} %{SOURCE2}
install -d %{buildroot}%{_sysconfdir}/%{name}

%pre
%service_add_pre %{name}.service

%post
%service_add_post %{name}.service

%preun
%service_del_preun %{name}.service

%postun
%service_del_postun %{name}.service

%check
%make_build test

%files
%license LICENSE
%doc AUTHORS CHANGELOG.md LOGGING.md README.md SECURITY.md examples/config.yml
%{_sbindir}/%{name}
%{_unitdir}/%{name}.service
%{_sysconfdir}/%{name}

%files cert
%license LICENSE
%{_bindir}/%{name}-cert

%changelog
openSUSE Build Service is sponsored by