commit 0ff2777f1e9c2f4bee0bb6ceaacfe1d827a14b9b Author: ryskn Date: Wed Mar 11 15:19:27 2026 +0900 Initial commit: GoBGP RPM package for AlmaLinux 9 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6adbcf3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,26 @@ +# RPM build directories (generated during build) +BUILD/ +BUILDROOT/ +RPMS/ +SRPMS/ + +# Source tarballs (downloaded from upstream) +SOURCES/*.tar.gz +SOURCES/*.tar.bz2 +SOURCES/*.tar.xz +SOURCES/*.tgz +SOURCES/*.zip + +# Keep config files in SOURCES +!SOURCES/*.conf +!SOURCES/*.service + +# Editor backup files +*~ +*.swp +*.swo +.*.swp + +# OS generated files +.DS_Store +Thumbs.db diff --git a/.gobgp.metadata b/.gobgp.metadata new file mode 100644 index 0000000..76cf4a8 --- /dev/null +++ b/.gobgp.metadata @@ -0,0 +1 @@ +bec19105bd928200ea1ac2c9927571fbce5e11781c741da520b19b7b76f9a0d0 SOURCES/v4.2.0.tar.gz diff --git a/SOURCES/gobgpd.conf b/SOURCES/gobgpd.conf new file mode 100644 index 0000000..55e5b44 --- /dev/null +++ b/SOURCES/gobgpd.conf @@ -0,0 +1,12 @@ +# GoBGP Configuration File +# See: https://github.com/osrg/gobgp/blob/master/docs/sources/configuration.md + +[global.config] + as = 65001 + router-id = "192.0.2.1" + +# Example neighbor configuration (uncomment and modify as needed) +# [[neighbors]] +# [neighbors.config] +# neighbor-address = "192.0.2.2" +# peer-as = 65002 diff --git a/SPECS/GoBGP.spec b/SPECS/GoBGP.spec new file mode 100644 index 0000000..ba02a85 --- /dev/null +++ b/SPECS/GoBGP.spec @@ -0,0 +1,74 @@ +# Go binaries don't generate debug source files +%global debug_package %{nil} + +Name: gobgp +Version: 4.2.0 +Release: 1%{?dist} +Summary: BGP implementation in Go + +License: Apache-2.0 +URL: https://github.com/osrg/gobgp +Source0: https://github.com/osrg/gobgp/archive/refs/tags/v%{version}.tar.gz +Source1: gobgpd.conf + +BuildRequires: golang +BuildRequires: git +BuildRequires: systemd-rpm-macros + +Requires: systemd +Requires(pre): shadow-utils + +%global goipath github.com/osrg/gobgp + +%description +GoBGP is an open source BGP implementation designed for modern +networking environments. + +%prep +%autosetup -n gobgp-%{version} +# Fix gobgpd path in service file +sed -i 's|/usr/bin/gobgpd|/usr/sbin/gobgpd|g' tools/contrib/centos/gobgpd.service + +%build +go env -w GOPATH=%{_builddir}/go +mkdir -p %{_builddir}/go/src/$(dirname %{goipath}) +ln -sf %{_builddir}/gobgp-%{version} %{_builddir}/go/src/%{goipath} + +cd %{_builddir}/go/src/%{goipath} +go build -v -o gobgpd ./cmd/gobgpd +go build -v -o gobgp ./cmd/gobgp + +%install +install -D -m 0755 %{_builddir}/go/src/%{goipath}/gobgpd %{buildroot}%{_sbindir}/gobgpd +install -D -m 0755 %{_builddir}/go/src/%{goipath}/gobgp %{buildroot}%{_bindir}/gobgp +install -D -m 0644 tools/contrib/centos/gobgpd.service %{buildroot}%{_unitdir}/gobgpd.service +install -D -m 0640 %{SOURCE1} %{buildroot}%{_sysconfdir}/gobgpd/gobgpd.conf + +%pre +getent group gobgpd >/dev/null || groupadd -r gobgpd +getent passwd gobgpd >/dev/null || \ + useradd -r -g gobgpd -d /var/lib/gobgpd -s /sbin/nologin \ + -c "GoBGP Routing Daemon" gobgpd +exit 0 + +%post +%systemd_post gobgpd.service + +%preun +%systemd_preun gobgpd.service + +%postun +%systemd_postun_with_restart gobgpd.service + +%files +%license LICENSE +%{_sbindir}/gobgpd +%{_bindir}/gobgp +%{_unitdir}/gobgpd.service +%dir %{_sysconfdir}/gobgpd +%config(noreplace) %attr(0640, root, gobgpd) %{_sysconfdir}/gobgpd/gobgpd.conf + +%changelog +* Sun Jan 19 2026 ryosuke.nakayama@ryskn.com - 4.2.0-1 +- Initial package +- Add systemd service file