Add a Debian package and bash completion
make deb builds dist/jarl_<version>_<arch>.deb with dpkg-deb alone (no root), for the host or another architecture (DEB_ARCH=arm64). The package creates the jarl user and directories and an example jarl.yaml on the first install, restarts a running jarld on upgrades, never touches /etc/jarl/jarl.yaml, stops jarld on removal, and keeps Jarl's data even on purge. make install and the package install bash completion for jarl and jarld. Besides commands and flags it completes server and group names from the CLI configuration, zone, view, ACL, TSIG key and user names from the server, and record types. make dist includes the completion scripts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0f2c318aaf
commit
352c9cb394
13 files changed
+555
-30
No files matched your search
@@ -0,0 +1,20 @@
|
||||
Package: jarl
|
||||
Version: @VERSION@
|
||||
Architecture: @ARCH@
|
||||
Maintainer: @MAINTAINER@
|
||||
Installed-Size: @SIZE@
|
||||
Depends: systemd
|
||||
Recommends: bind9 (>= 1:9.20)
|
||||
Section: net
|
||||
Priority: optional
|
||||
Description: web UI, REST API and CLI for managing a BIND 9 server
|
||||
Jarl manages a BIND 9.20 server: zones, records, views, ACLs, TSIG keys
|
||||
and options, through a web UI, a REST API and the jarl command line
|
||||
client. Every change is validated, checked with named-checkconf and
|
||||
loaded into named as one changeset that can be reverted. Users and API
|
||||
tokens have fine-grained permissions, and every change is audited.
|
||||
.
|
||||
The package installs jarld (the daemon, as the systemd service jarl) and
|
||||
jarl (the CLI), with bash completion for both. jarld isn't started on a
|
||||
first install: see /usr/share/doc/jarl/docs/install.md to create the
|
||||
database and adopt the BIND configuration.
|
||||
Executable
+38
@@ -0,0 +1,38 @@
|
||||
#!/bin/sh
|
||||
# Jarl: runs after the package's files are in place.
|
||||
set -e
|
||||
|
||||
if [ "$1" = configure ]; then
|
||||
# The jarl system user (a member of group bind) and Jarl's directories:
|
||||
# /etc/jarl, /var/lib/jarl, /etc/bind/jarl, /var/lib/bind/jarl,
|
||||
# /var/cache/bind/jarl and /var/log/named.
|
||||
systemd-sysusers jarl.conf
|
||||
systemd-tmpfiles --create jarl.conf || true
|
||||
|
||||
# An example configuration on the first install; an existing one is
|
||||
# never touched.
|
||||
if [ ! -e /etc/jarl/jarl.yaml ]; then
|
||||
/usr/bin/jarld config --example > /etc/jarl/jarl.yaml.dpkg-new
|
||||
chown root:jarl /etc/jarl/jarl.yaml.dpkg-new
|
||||
chmod 0640 /etc/jarl/jarl.yaml.dpkg-new
|
||||
mv /etc/jarl/jarl.yaml.dpkg-new /etc/jarl/jarl.yaml
|
||||
fi
|
||||
|
||||
if [ -d /run/systemd/system ]; then
|
||||
systemctl daemon-reload || true
|
||||
# An upgrade restarts a running jarld (its database is upgraded
|
||||
# when it starts). A first install starts nothing: Jarl needs
|
||||
# 'jarld init' and 'jarld adopt' first.
|
||||
if [ -n "$2" ] && systemctl is-active --quiet jarl.service; then
|
||||
systemctl restart jarl.service || echo "jarl: restarting jarld failed; see 'journalctl -u jarl'" >&2
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$2" ]; then
|
||||
echo "Jarl is installed. Next: create the database and adopt your BIND"
|
||||
echo "configuration, as described in /usr/share/doc/jarl/docs/install.md"
|
||||
echo "(from step 3), then: systemctl enable --now jarl"
|
||||
fi
|
||||
fi
|
||||
|
||||
exit 0
|
||||
Executable
+21
@@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
# Jarl: runs after the package's files are removed.
|
||||
set -e
|
||||
|
||||
case "$1" in
|
||||
remove|purge)
|
||||
if [ -d /run/systemd/system ]; then
|
||||
systemctl daemon-reload || true
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
# Even a purge keeps Jarl's data: the database in /var/lib/jarl is the
|
||||
# source of your DNS configuration, and named.conf may still include the
|
||||
# files in /etc/bind/jarl. Remove them by hand when you no longer need them.
|
||||
if [ "$1" = purge ]; then
|
||||
echo "jarl: kept /etc/jarl, /var/lib/jarl, /etc/bind/jarl, /var/lib/bind/jarl and"
|
||||
echo "/var/cache/bind/jarl (named may still use them); remove them by hand if unused."
|
||||
fi
|
||||
|
||||
exit 0
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
# Jarl: runs before the package's files are removed (also on upgrades).
|
||||
set -e
|
||||
|
||||
# On removal (not on upgrade) stop jarld and remove its boot-time link.
|
||||
# named keeps running with the configuration Jarl last wrote.
|
||||
if [ "$1" = remove ] && [ -d /run/systemd/system ]; then
|
||||
systemctl stop jarl.service 2>/dev/null || true
|
||||
systemctl disable jarl.service 2>/dev/null || true
|
||||
fi
|
||||
|
||||
exit 0
|
||||
Reference in new issue
Block a user