From 86369a77f71829b9ee5d09fca52f2f5c0737af99 Mon Sep 17 00:00:00 2001 From: Pim van Pelt Date: Wed, 31 Dec 2025 16:18:47 +0100 Subject: [PATCH] Couple of debian fixes, cannot use variable expansions this way --- README.md | 6 +++--- debian/bird-exporter.default | 7 +------ debian/bird-exporter.postinst | 18 ++++++++++++++++++ debian/bird-exporter.service | 4 ++-- debian/rules | 1 - 5 files changed, 24 insertions(+), 12 deletions(-) create mode 100755 debian/bird-exporter.postinst diff --git a/README.md b/README.md index 4683b33..0a54858 100644 --- a/README.md +++ b/README.md @@ -32,11 +32,11 @@ sudo systemctl start bird-exporter Default configuration: ``` -BIRD_RUN_USER=bird -BIRD_RUN_GROUP=bird -BIRD_EXPORTER_ARGS="-period=60s -bird.socket=/var/run/bird/bird.ctl" +BIRD_EXPORTER_ARGS="-web.listen-address=:9324 -period=60s -bird.socket=/var/run/bird/bird.ctl" ``` +The service runs as the `bird` user and group. + ## Documentation - **Manual page**: `man bird-exporter` (after package installation) diff --git a/debian/bird-exporter.default b/debian/bird-exporter.default index 9b97e6c..5687307 100644 --- a/debian/bird-exporter.default +++ b/debian/bird-exporter.default @@ -1,8 +1,3 @@ # Default settings for bird-exporter - -# User and group to run bird-exporter as -BIRD_RUN_USER=bird -BIRD_RUN_GROUP=bird - # Command line arguments to pass to bird-exporter -BIRD_EXPORTER_ARGS="-period=60s -bird.socket=/var/run/bird/bird.ctl" +BIRD_EXPORTER_ARGS="-web.listen-address=:9324 -period=60s -bird.socket=/var/run/bird/bird.ctl" diff --git a/debian/bird-exporter.postinst b/debian/bird-exporter.postinst new file mode 100755 index 0000000..c2da354 --- /dev/null +++ b/debian/bird-exporter.postinst @@ -0,0 +1,18 @@ +#!/bin/sh +set -e + +case "$1" in + configure) + # Create bird user if it doesn't exist + if ! getent passwd bird > /dev/null; then + adduser --system --group --no-create-home \ + --home /nonexistent \ + --gecos "BIRD routing daemon" \ + bird + fi + ;; +esac + +#DEBHELPER# + +exit 0 diff --git a/debian/bird-exporter.service b/debian/bird-exporter.service index 665c788..5455853 100644 --- a/debian/bird-exporter.service +++ b/debian/bird-exporter.service @@ -6,9 +6,9 @@ Wants=bird.service [Service] Type=simple +User=bird +Group=bird EnvironmentFile=-/etc/default/bird-exporter -User=${BIRD_RUN_USER:-bird} -Group=${BIRD_RUN_GROUP:-bird} ExecStart=/usr/bin/bird-exporter $BIRD_EXPORTER_ARGS Restart=always RestartSec=5 diff --git a/debian/rules b/debian/rules index 300956e..a57145a 100755 --- a/debian/rules +++ b/debian/rules @@ -14,7 +14,6 @@ override_dh_auto_build: override_dh_auto_install: install -D -m 0755 bird-exporter debian/bird-exporter/usr/bin/bird-exporter - install -D -m 0644 debian/bird-exporter.service debian/bird-exporter/lib/systemd/system/bird-exporter.service install -D -m 0644 debian/bird-exporter.default debian/bird-exporter/etc/default/bird-exporter install -D -m 0644 docs/bird-exporter.1 debian/bird-exporter/usr/share/man/man1/bird-exporter.1