Initial commit: GoBGP RPM package for AlmaLinux 9

This commit is contained in:
ryskn 2026-03-11 15:19:27 +09:00
commit 0ff2777f1e
4 changed files with 113 additions and 0 deletions

26
.gitignore vendored Normal file
View File

@ -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

1
.gobgp.metadata Normal file
View File

@ -0,0 +1 @@
bec19105bd928200ea1ac2c9927571fbce5e11781c741da520b19b7b76f9a0d0 SOURCES/v4.2.0.tar.gz

12
SOURCES/gobgpd.conf Normal file
View File

@ -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

74
SPECS/GoBGP.spec Normal file
View File

@ -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