Split Debian package into vpp-maglevd + vpp-maglev; add maglevt.1 manpage
vpp-maglevd ships maglevd, maglevd-frontend, both systemd units, and the config conffiles. vpp-maglev ships maglevc and maglevt as pure client tools so jump hosts and workstations can install them without pulling in the daemon. pkg-deb now emits four .debs per release (2 packages x 2 archs); build-deb.sh takes a package-name argument and dispatches accordingly.
This commit is contained in:
111
debian/build-deb.sh
vendored
111
debian/build-deb.sh
vendored
@@ -1,64 +1,93 @@
|
||||
#!/bin/bash
|
||||
# Build a vpp-maglev Debian package for one architecture.
|
||||
# Usage: build-deb.sh <amd64|arm64> <version>
|
||||
# Build one vpp-maglev* Debian package for one architecture.
|
||||
# Usage: build-deb.sh <package> <amd64|arm64> <version>
|
||||
#
|
||||
# <package> is one of:
|
||||
# vpp-maglevd — health-checker daemon + optional web dashboard,
|
||||
# with both systemd units, the default config, and
|
||||
# the /etc/default/vpp-maglev environment file.
|
||||
# vpp-maglev — maglevc CLI client and maglevt out-of-band tester.
|
||||
# Pure client-side tools, no systemd units, no conffiles.
|
||||
#
|
||||
# The commit hash is baked into the binaries at link time via -ldflags
|
||||
# in the Makefile, so `maglevd --version` / `maglevc --version` /
|
||||
# `maglevd-frontend --version` are the source of truth for "which
|
||||
# build". The .deb itself carries only the release version.
|
||||
# in the Makefile, so `maglevd --version` / `maglevc --version` / etc.
|
||||
# are the source of truth for "which build". The .deb itself carries
|
||||
# only the release version.
|
||||
set -euo pipefail
|
||||
|
||||
ARCH="${1:?usage: build-deb.sh <amd64|arm64> <version>}"
|
||||
VERSION="${2:?usage: build-deb.sh <amd64|arm64> <version>}"
|
||||
PACKAGE="${1:?usage: build-deb.sh <vpp-maglevd|vpp-maglev> <amd64|arm64> <version>}"
|
||||
ARCH="${2:?usage: build-deb.sh <vpp-maglevd|vpp-maglev> <amd64|arm64> <version>}"
|
||||
VERSION="${3:?usage: build-deb.sh <vpp-maglevd|vpp-maglev> <amd64|arm64> <version>}"
|
||||
|
||||
REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
PKG="vpp-maglev_${VERSION}_${ARCH}"
|
||||
PKG="${PACKAGE}_${VERSION}_${ARCH}"
|
||||
STAGING="$(mktemp -d)"
|
||||
trap 'rm -rf "$STAGING"' EXIT
|
||||
|
||||
echo "Building ${PKG}.deb"
|
||||
|
||||
# Directories
|
||||
install -d "$STAGING/usr/sbin"
|
||||
install -d "$STAGING/usr/bin"
|
||||
install -d "$STAGING/usr/share/man/man1"
|
||||
install -d "$STAGING/usr/share/man/man8"
|
||||
install -d "$STAGING/lib/systemd/system"
|
||||
install -d "$STAGING/etc/default"
|
||||
install -d "$STAGING/etc/vpp-maglev"
|
||||
install -d "$STAGING/DEBIAN"
|
||||
|
||||
# Binaries. maglevd and maglevd-frontend are daemons and live under
|
||||
# /usr/sbin; maglevc is the interactive CLI client and lives under
|
||||
# /usr/bin so it's on every login shell's PATH.
|
||||
install -m 755 "$REPO_ROOT/build/${ARCH}/maglevd" "$STAGING/usr/sbin/maglevd"
|
||||
install -m 755 "$REPO_ROOT/build/${ARCH}/maglevc" "$STAGING/usr/bin/maglevc"
|
||||
install -m 755 "$REPO_ROOT/build/${ARCH}/maglevd-frontend" "$STAGING/usr/sbin/maglevd-frontend"
|
||||
case "$PACKAGE" in
|
||||
vpp-maglevd)
|
||||
install -d "$STAGING/usr/sbin"
|
||||
install -d "$STAGING/usr/share/man/man8"
|
||||
install -d "$STAGING/lib/systemd/system"
|
||||
install -d "$STAGING/etc/default"
|
||||
install -d "$STAGING/etc/vpp-maglev"
|
||||
|
||||
# Man pages
|
||||
gzip -9 -c "$REPO_ROOT/docs/maglevd.8" > "$STAGING/usr/share/man/man8/maglevd.8.gz"
|
||||
gzip -9 -c "$REPO_ROOT/docs/maglevc.1" > "$STAGING/usr/share/man/man1/maglevc.1.gz"
|
||||
gzip -9 -c "$REPO_ROOT/docs/maglevd-frontend.8" > "$STAGING/usr/share/man/man8/maglevd-frontend.8.gz"
|
||||
# Binaries. Both daemons live under /usr/sbin; they are long-running
|
||||
# services, not interactive tools.
|
||||
install -m 755 "$REPO_ROOT/build/${ARCH}/maglevd" "$STAGING/usr/sbin/maglevd"
|
||||
install -m 755 "$REPO_ROOT/build/${ARCH}/maglevd-frontend" "$STAGING/usr/sbin/maglevd-frontend"
|
||||
|
||||
# Systemd units
|
||||
install -m 644 "$REPO_ROOT/debian/vpp-maglev.service" "$STAGING/lib/systemd/system/vpp-maglev.service"
|
||||
install -m 644 "$REPO_ROOT/debian/vpp-maglev-frontend.service" "$STAGING/lib/systemd/system/vpp-maglev-frontend.service"
|
||||
# Man pages
|
||||
gzip -9 -c "$REPO_ROOT/docs/maglevd.8" > "$STAGING/usr/share/man/man8/maglevd.8.gz"
|
||||
gzip -9 -c "$REPO_ROOT/docs/maglevd-frontend.8" > "$STAGING/usr/share/man/man8/maglevd-frontend.8.gz"
|
||||
|
||||
# /etc/default/vpp-maglev (conffile — dpkg won't overwrite on upgrade)
|
||||
install -m 644 "$REPO_ROOT/debian/default.vpp-maglev" "$STAGING/etc/default/vpp-maglev"
|
||||
# Systemd units
|
||||
install -m 644 "$REPO_ROOT/debian/vpp-maglev.service" "$STAGING/lib/systemd/system/vpp-maglev.service"
|
||||
install -m 644 "$REPO_ROOT/debian/vpp-maglev-frontend.service" "$STAGING/lib/systemd/system/vpp-maglev-frontend.service"
|
||||
|
||||
# /etc/vpp-maglev/maglev.yaml (conffile)
|
||||
install -m 644 "$REPO_ROOT/debian/maglev.yaml" "$STAGING/etc/vpp-maglev/maglev.yaml"
|
||||
# /etc/default/vpp-maglev (conffile — dpkg won't overwrite on upgrade)
|
||||
install -m 644 "$REPO_ROOT/debian/default.vpp-maglev" "$STAGING/etc/default/vpp-maglev"
|
||||
|
||||
# DEBIAN/control
|
||||
sed "s/@VERSION@/${VERSION}/;s/@ARCH@/${ARCH}/" \
|
||||
"$REPO_ROOT/debian/control.in" > "$STAGING/DEBIAN/control"
|
||||
# /etc/vpp-maglev/maglev.yaml (conffile)
|
||||
install -m 644 "$REPO_ROOT/debian/maglev.yaml" "$STAGING/etc/vpp-maglev/maglev.yaml"
|
||||
|
||||
# DEBIAN/conffiles, postinst, prerm, postrm
|
||||
install -m 644 "$REPO_ROOT/debian/conffiles" "$STAGING/DEBIAN/conffiles"
|
||||
install -m 755 "$REPO_ROOT/debian/postinst" "$STAGING/DEBIAN/postinst"
|
||||
install -m 755 "$REPO_ROOT/debian/prerm" "$STAGING/DEBIAN/prerm"
|
||||
install -m 755 "$REPO_ROOT/debian/postrm" "$STAGING/DEBIAN/postrm"
|
||||
# DEBIAN metadata
|
||||
sed "s/@VERSION@/${VERSION}/;s/@ARCH@/${ARCH}/" \
|
||||
"$REPO_ROOT/debian/vpp-maglevd.control.in" > "$STAGING/DEBIAN/control"
|
||||
install -m 644 "$REPO_ROOT/debian/vpp-maglevd.conffiles" "$STAGING/DEBIAN/conffiles"
|
||||
install -m 755 "$REPO_ROOT/debian/vpp-maglevd.postinst" "$STAGING/DEBIAN/postinst"
|
||||
install -m 755 "$REPO_ROOT/debian/vpp-maglevd.prerm" "$STAGING/DEBIAN/prerm"
|
||||
install -m 755 "$REPO_ROOT/debian/vpp-maglevd.postrm" "$STAGING/DEBIAN/postrm"
|
||||
;;
|
||||
|
||||
vpp-maglev)
|
||||
install -d "$STAGING/usr/bin"
|
||||
install -d "$STAGING/usr/share/man/man1"
|
||||
|
||||
# Binaries. Both client tools live under /usr/bin so they land on
|
||||
# every login shell's PATH without needing /usr/sbin on PATH.
|
||||
install -m 755 "$REPO_ROOT/build/${ARCH}/maglevc" "$STAGING/usr/bin/maglevc"
|
||||
install -m 755 "$REPO_ROOT/build/${ARCH}/maglevt" "$STAGING/usr/bin/maglevt"
|
||||
|
||||
# Man pages
|
||||
gzip -9 -c "$REPO_ROOT/docs/maglevc.1" > "$STAGING/usr/share/man/man1/maglevc.1.gz"
|
||||
gzip -9 -c "$REPO_ROOT/docs/maglevt.1" > "$STAGING/usr/share/man/man1/maglevt.1.gz"
|
||||
|
||||
# DEBIAN metadata. The client package has no conffiles and no
|
||||
# maintainer scripts — it ships binaries and manpages only.
|
||||
sed "s/@VERSION@/${VERSION}/;s/@ARCH@/${ARCH}/" \
|
||||
"$REPO_ROOT/debian/vpp-maglev.control.in" > "$STAGING/DEBIAN/control"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "error: unknown package '${PACKAGE}' (expected vpp-maglevd or vpp-maglev)" >&2
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
|
||||
# Emit package into build/
|
||||
mkdir -p "$REPO_ROOT/build"
|
||||
|
||||
Reference in New Issue
Block a user