Control: tags -1 + patch Hello,
I'm attaching my attempt at fixing this bug. Please note that I'm not actually an xinetd user myself, so this is virtually untested and who ever picks this up needs to take responsibility to make sure this actually works as intended. Please make sure the FIRST_VERSION_WITH_SYSTEMD_SERVICE is set properly. See attached debdiff. Regards, Andreas Henriksson
diff -Nru xinetd-2.3.15.3/debian/changelog xinetd-2.3.15.3/debian/changelog --- xinetd-2.3.15.3/debian/changelog 2018-02-05 19:31:09.000000000 +0100 +++ xinetd-2.3.15.3/debian/changelog 2023-07-03 12:39:06.000000000 +0200 @@ -1,3 +1,10 @@ +xinetd (1:2.3.15.3-1.1) UNRELEASED; urgency=medium + + * Non-maintainer upload. + * Add native systemd service (and migrate /etc/default/xinetd settings over) + + -- Andreas Henriksson <andr...@fatal.se> Mon, 03 Jul 2023 12:39:06 +0200 + xinetd (1:2.3.15.3-1) unstable; urgency=low * New upstream release diff -Nru xinetd-2.3.15.3/debian/xinetd.postinst xinetd-2.3.15.3/debian/xinetd.postinst --- xinetd-2.3.15.3/debian/xinetd.postinst 1970-01-01 01:00:00.000000000 +0100 +++ xinetd-2.3.15.3/debian/xinetd.postinst 2023-07-03 12:38:46.000000000 +0200 @@ -0,0 +1,80 @@ +#!/bin/sh + +FIRST_VERSION_WITH_SYSTEMD_SERVICE="1:2.3.15.3-1.1" + +if [ "$1" = "configure" ] && dpkg --compare-versions "$2" lt-nl "$FIRST_VERSION_WITH_SYSTEMD_SERVICE~" ; then + echo "Doing one-time migration of /etc/default/xinet to xinetd.service override (if needed)." + + +( +if [ -e /etc/default/xinetd ]; then + . /etc/default/xinetd + + # Internal state variables + DISABLE_IPV6="" + DISABLE_INETD_COMPAT="" + CHANGE_PIDFILE="" + CHANGE_XINETD_OPTS="" + + # Detect which overrides we need to set up + + ## INETD_COMPAT and INETD_IPV6 + case "${INETD_COMPAT:-}" in + [Yy]*) + # check we have ipv6 support (one time only) + if ! perl -MSocket -e 'exit (!socket($sock, AF_INET6, SOCK_STREAM, 0))'; then + DISABLE_IPV6="y" + fi + # use shipped defaults + ;; + *) + DISABLE_INETD_COMPAT="y" + ;; + esac + + ## PIDFILE + if [ "${PIDFILE:-}" != "/run/xinetd.pid" ] && [ -n "${PIDFILE:-}" ]; then + CHANGE_PIDFILE="y" + fi + + ## XINETD_OPTS + if [ "${XINETD_OPTS:-}" != "-stayalive" ]; then + CHANGE_XINETD_OPTS="y" + fi + + + # Any overrides needed or everything default? + if [ -n "$DISABLE_IPV6" ] || \ + [ -n "$DISABLE_INETD_COMPAT" ] || \ + [ -n "$CHANGE_PIDFILE" ] || \ + [ -n "$CHANGE_XINETD_OPTS" ] ; then + + echo "Migrating /etc/default/xinetd settings to xinetd.service override." + + # Create service overrides + mkdir -p /etc/systemd/system/xinetd.service.d/ + echo "[Service]" > /etc/systemd/system/xinetd.service.d/override.conf + + if [ -n "$DISABLE_INETD_COMPAT" ]; then + echo "Environment=\"INETD_COMPAT=\"" >> /etc/systemd/system/xinetd.service.d/override.conf + echo "Environment=\"INETD_IPV6=\"" >> /etc/systemd/system/xinetd.service.d/override.conf + elif [ -n "$DISABLE_IPV6" ]; then + echo "Environment=\"INETD_IPV6=\"" >> /etc/systemd/system/xinetd.service.d/override.conf + fi + + if [ -n "$CHANGE_XINETD_OPTS" ]; then + echo "Environment=\"XINETD_OPTS=$XINETD_OPTS\"" >> /etc/systemd/system/xinetd.service.d/override.conf + fi + + if [ -n "$CHANGE_PIDFILE" ]; then + echo "Environment=\"XINETD_PIDFILE=$PIDFILE\"" >> /etc/systemd/system/xinetd.service.d/override.conf + echo "PIDFile=$PIDFILE" >> /etc/systemd/system/xinetd.service.d/override.conf + fi + + fi +fi +) + +fi + +#DEBHELPER diff -Nru xinetd-2.3.15.3/debian/xinetd.service xinetd-2.3.15.3/debian/xinetd.service --- xinetd-2.3.15.3/debian/xinetd.service 1970-01-01 01:00:00.000000000 +0100 +++ xinetd-2.3.15.3/debian/xinetd.service 2023-07-03 12:39:06.000000000 +0200 @@ -0,0 +1,22 @@ +[Unit] +Description=powerful inetd replacement +After=network.target +Documentation=man:xinetd +Documentation=man:xinetd.conf +Documentation=man:xinetd.log + +[Service] +Type=forking +Environment="XINETD_OPTS=-stayalive" +Environment="INETD_COMPAT=-inetd_compat" +Environment="INETD_IPV6=-inetd_ipv6" +Environment="XINETD_PIDFILE=-pidfile /run/xinetd.pid" +# /etc/default/xinetd have been migrated to `systemctl edit xinetd` override. +#EnvironmentFile=/etc/default/xinetd +PIDFile=/run/xinetd.pid +ExecStart=/usr/sbin/xinetd $XINETD_OPTS $INETD_COMPAT $INETD_IPV6 $XINETD_PIDFILE +# Reloading should be synchronous, which signals are not... +ExecReload=kill -HUP $MAINPID + +[Install] +WantedBy=multi-user.target