To sum up things, I tried rebuilding 2.4.1 for bookworm, but I saw no
difference in the init file.
The attached patch puts together every suggestion from this thread and it also
appears to fix
bug #1032495, which I had filed some time ago.
Regards
--- kea-dhcp4-server.orig 2024-01-03 09:07:49.508825915 +0100
+++ kea-dhcp4-server 2024-01-03 09:09:18.329264599 +0100
@@ -16,7 +16,7 @@
# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="kea-dhcp4"
-NAME=kea-dhcp4-server
+NAME=kea-dhcp4
DAEMON=/usr/sbin/kea-dhcp4
DAEMON_ARGS="-c /etc/kea/kea-dhcp4.conf"
PIDFILE=/run/$NAME.pid
@@ -24,6 +24,8 @@ SCRIPTNAME=/etc/init.d/$NAME
KEA_PIDFILE_DIR=/run/
KEA_LOCKFILE_DIR=/run/lock/kea/
KEA_LOGGER_DESTINATION=/var/log/kea/
+KEA_RUN_DIR=/run/kea/
+KEA_USER=_kea
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
@@ -42,7 +44,10 @@ KEA_LOGGER_DESTINATION=/var/log/kea/
create_lockfile_dir()
{
if [ ! -d "$KEA_LOCKFILE_DIR" ]; then
- mkdir -m 0750 -p "$KEA_LOCKFILE_DIR"
+ mkdir -m 0750 -p "$KEA_LOCKFILE_DIR" && chown $KEA_USER "$KEA_LOCKFILE_DIR"
+ fi
+ if [ ! -d "$KEA_RUN_DIR" ]; then
+ mkdir -m 0750 -p "$KEA_RUN_DIR" && chown $KEA_USER "$KEA_RUN_DIR"
fi
}
@@ -52,13 +57,14 @@ create_lockfile_dir()
do_start()
{
create_lockfile_dir
+ export KEA_LOCKFILE_DIR
# Return
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
- start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
+ start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -u $KEA_USER --test > /dev/null \
|| return 1
- start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -b -- \
+ start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -c $KEA_USER -b -- \
$DAEMON_ARGS \
|| return 2
}