%global forgeurl https://github.com/yggdrasil-network/yggdrasil-go %global version 0.5.9 %global commit 9398cae230170990b5b048f63a22653a714e30ee %global date 20241119 %global source_date_epoch_from_changelog 0 %global debug_package %{nil} %forgemeta Name: yggnet Version: %{forgeversion} Release: %{autorelease} Summary: Yggdrasil overlay network License: LGPL-3.0-only URL: https://yggdrasil-network.github.io/ Source0: %{forgesource} Source1: %{name}.sysusers Source2: %{name}.howto BuildRequires: git-core BuildRequires: golang-bin BuildRequires: systemd-rpm-macros %description Yggdrasil is an overlay mesh network that relies on IPv6. Key features of this network: - Supports large, complex or even Internet-scale topologies. - Responds quickly to connection failures or mobility events. - Provides end-to-end encryption for traffic over the network. - Works entirely ad-hoc by design and completely decentralized. - Supported on Linux, macOS, Windows, Android, iOS and more. %prep %forgesetup sed -i -e 's/yggdrasil/%{name}/' src/config/defaults_linux.go for SVC in yggdrasil yggdrasil-default-config do sed -e '/^Description=/!s/yggdrasil/%{name}/g' \ contrib/systemd/${SVC}.service > ${SVC/yggdrasil/%{name}}.service done %build export GOPROXY="https://proxy.golang.org,direct" export GOFLAGS="-trimpath -buildmode=pie" export LDFLAGS="-s -w" for CMD in yggdrasil yggdrasilctl do go build -ldflags "${LDFLAGS}" -o ${CMD/yggdrasil/%{name}} ./cmd/${CMD} done %install install -p -D -m 644 %{SOURCE1} %{buildroot}%{_sysusersdir}/%{name}.conf install -p -D -m 755 -t %{buildroot}%{_bindir} %{name} %{name}ctl install -p -D -m 644 -t %{buildroot}%{_unitdir} %{name}.service %{name}-default-config.service install -p -D -m 644 -t %{buildroot}%{_pkgdocdir} %{SOURCE2} CHANGELOG.md README.md %pre %sysusers_create_package %{name} %SOURCE1 %post %systemd_post %{name}.service %preun %systemd_preun %{name}.service %postun %systemd_postun_with_restart %{name}.service %files %license LICENSE %doc %{_pkgdocdir} %{_bindir}/%{name} %{_bindir}/%{name}ctl %{_sysusersdir}/%{name}.conf %{_unitdir}/%{name}.service %{_unitdir}/%{name}-default-config.service