nebula/nebula.spec
2023-08-21 21:06:05 -04:00

113 lines
2.7 KiB
RPMSpec

# Generated by go2rpm 1.6.0
%bcond_without check
# https://github.com/slackhq/nebula
%global goipath github.com/slackhq/nebula
Version: 1.6.1
%gometa
%global goname nebula
%global common_description %{expand:
A scalable overlay networking tool with a focus on performance, simplicity and
security.}
%global golicenses LICENSE
%global godocs examples AUTHORS README.md CHANGELOG.md
Name: %{goname}
Release: %autorelease
Summary: A scalable overlay networking tool with a focus on performance, simplicity and security
License: MIT
URL: %{gourl}
Source0: %{gosource}
Source1: %{name}-vendor-%{version}.tar.gz
BuildRequires: systemd-rpm-macros
%if 0%{?fedora}
BuildRequires: go-rpm-macros
%endif
# Let's be sure that people do not upgrade from the "old" nebula. We can sensibly drop it by F39
Conflicts: nebula < 1.0
%description
%{common_description}
%gopkg
%prep
%if 0%{?fedora}
%goprep
# https://github.com/slackhq/nebula/pull/791
sed -i 's/\(Wants=.*\)$/\1 nss-lookup.target time-sync.target/' dist/fedora/nebula.service
%generate_buildrequires
%go_generate_buildrequires
%else
%autosetup -a 1
mkdir -p %{_builddir}/src/github.com/slackhq/
cp -r %{_builddir}/%{name}-%{version} %{_builddir}/src/github.com/slackhq/%{name}
mkdir -p %{_builddir}/%{name}-%{version}/_build/src/github.com/slackhq/nebula
mv %{_builddir}/src %{_builddir}/%{name}-%{version}/_build/src
%endif
%build
export LDFLAGS="-X main.Build=%{version}-Fedora $(LDFLAGS)"
%if 0%{?fedora}
for cmd in cmd/* ; do
%gobuild -o %{gobuilddir}/bin/$(basename $cmd) %{goipath}/$cmd
done
%else
export GOPATH="%{_builddir}/%{name}-%{version}/_build"
pushd $GOPATH/src/github.com/slackhq/nebula
go generate
popd
for cmd in cmd/* ; do
%gobuild -o bin/$(basename $cmd) %{goipath}/$cmd
done
%endif
%install
%if 0%{?fedora}
%gopkginstall
%endif
install -m 0755 -vd %{buildroot}%{_bindir}
install -m 0755 -vp bin/* %{buildroot}%{_bindir}/
install -m 0755 -vd %{buildroot}%{_sysconfdir}/%{name}
install -m 0640 -vp examples/config.yml %{buildroot}%{_sysconfdir}/%{name}
install -m 0644 -vDp dist/fedora/nebula.service %{buildroot}%{_unitdir}/%{name}.service
%if %{with check}
%check
%if 0%{?fedora}
%gocheck
%endif
%endif
%post
%systemd_post nebula.service
%preun
%systemd_preun nebula.service
%postun
%systemd_postun_with_restart nebula.service
%files
%license LICENSE
%dir %{_sysconfdir}/%{name}
%config(noreplace) %{_sysconfdir}/%{name}/config.yml
%doc examples AUTHORS README.md CHANGELOG.md
%{_bindir}/*
%{_unitdir}/%{name}.service
%if 0%{?fedora}
%gopkgfiles
%endif
%changelog
%autochangelog