Add an initial 'make pkg-deb' and debian/ control directory

This commit is contained in:
Pim van Pelt
2025-06-17 00:22:01 +02:00
parent adf033318a
commit 82db92f344
8 changed files with 150 additions and 0 deletions

10
.gitignore vendored
View File

@ -1,2 +1,12 @@
govpp-snmp-agentx govpp-snmp-agentx
vppcfg.yaml vppcfg.yaml
# Debian packaging artifacts
debian/.debhelper/
debian/.gocache/
debian/go/
debian/govpp-snmp-agentx/
debian/files
debian/*.substvars
debian/debhelper-build-stamp
debian/*.debhelper

20
Makefile Normal file
View File

@ -0,0 +1,20 @@
.PHONY: build test clean pkg-deb
# Build the govpp-snmp-agentx binary
build:
go build -o govpp-snmp-agentx .
# Run all tests
test:
go test ./...
# Clean build artifacts
clean:
rm -f govpp-snmp-agentx
[ -d debian/go ] && chmod -R +w debian/go || true
rm -rf debian/.debhelper debian/.gocache debian/go debian/govpp-snmp-agentx debian/files debian/*.substvars debian/debhelper-build-stamp
rm -f ../govpp-snmp-agentx_*
# Build Debian package
pkg-deb:
fakeroot dpkg-buildpackage -us -uc -b

8
debian/changelog vendored Normal file
View File

@ -0,0 +1,8 @@
govpp-snmp-agentx (1.0.0-1) bookworm; urgency=medium
* Initial release
* SNMP AgentX daemon for VPP statistics
* Interface MIB support
* Systemd service integration
-- Pim van Pelt <pim@ipng.ch> Mon, 16 Jun 2025 00:00:00 +0000

23
debian/control vendored Normal file
View File

@ -0,0 +1,23 @@
Source: govpp-snmp-agentx
Section: net
Priority: optional
Maintainer: Pim van Pelt <pim@ipng.ch>
Build-Depends: debhelper-compat (= 13), golang-go (>= 1.21)
Standards-Version: 4.6.2
Homepage: https://git.ipng.ch/ipng/govpp-agentx-snmp
Vcs-Git: https://git.ipng.ch/ipng/govpp-agentx-snmp
Vcs-Browser: https://git.ipng.ch/ipng/govpp-agentx-snmp
Package: govpp-snmp-agentx
Architecture: any
Depends: ${misc:Depends}, ${shlibs:Depends}, snmp, snmpd, adduser
Description: GoVPP SNMP AgentX Daemon
A SNMP AgentX daemon that provides SNMP access to VPP (Vector Packet Processing)
statistics and interface information. This daemon acts as a subagent that
connects to the main SNMP daemon via the AgentX protocol.
.
Features:
- Interface MIB support
- VPP statistics exposure
- AgentX protocol implementation
- Systemd integration

View File

@ -0,0 +1,12 @@
# Automatically added by dh_installsystemd/13.11.4
if [ "$1" = remove ] && [ -d /run/systemd/system ] ; then
systemctl --system daemon-reload >/dev/null || true
fi
# End automatically added section
# Automatically added by dh_installsystemd/13.11.4
if [ "$1" = "purge" ]; then
if [ -x "/usr/bin/deb-systemd-helper" ]; then
deb-systemd-helper purge 'govpp-snmp-agentx.service' >/dev/null || true
fi
fi
# End automatically added section

28
debian/postinst vendored Executable file
View File

@ -0,0 +1,28 @@
#!/bin/bash
set -e
case "$1" in
configure)
# Create agentx directories
mkdir -p /var/agentx/master
chown Debian-snmp:vpp /var/agentx /var/agentx/master
chmod 770 /var/agentx /var/agentx/master
# Enable and start the service
systemctl daemon-reload
systemctl enable govpp-snmp-agentx.service
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
#DEBHELPER#
exit 0

22
debian/prerm vendored Executable file
View File

@ -0,0 +1,22 @@
#!/bin/bash
set -e
case "$1" in
remove|upgrade|deconfigure)
systemctl stop govpp-snmp-agentx.service || true
systemctl disable govpp-snmp-agentx.service || true
;;
failed-upgrade)
;;
*)
echo "prerm called with unknown argument \`$1'" >&2
exit 1
;;
esac
#DEBHELPER#
exit 0

27
debian/rules vendored Executable file
View File

@ -0,0 +1,27 @@
#!/usr/bin/make -f
export DH_VERBOSE = 1
export GO111MODULE = on
export GOPROXY = direct
export GOCACHE = $(CURDIR)/debian/.gocache
export GOPATH = $(CURDIR)/debian/go
%:
dh $@
override_dh_auto_build:
go build -v -ldflags="-s -w" -o govpp-snmp-agentx .
override_dh_auto_install:
install -D -m 0755 govpp-snmp-agentx debian/govpp-snmp-agentx/usr/sbin/govpp-snmp-agentx
install -D -m 0644 govpp-snmp-agentx.service debian/govpp-snmp-agentx/lib/systemd/system/govpp-snmp-agentx.service
override_dh_auto_configure:
# Skip auto configure
override_dh_auto_test:
# Skip tests during packaging
override_dh_auto_clean:
rm -f govpp-snmp-agentx
rm -rf debian/.gocache debian/go obj-*