Control: tags 1078674 patch

Daniel,

Thanks for your invitation in #1078651 to help with this. My proposed patch is
attached. Do let me have any comments.

With best wishes

Mark
diff --git a/debian/NEWS b/debian/NEWS
index 95f946a..f790ed9 100644
--- a/debian/NEWS
+++ b/debian/NEWS
@@ -1,3 +1,14 @@
+netperf (2.7.0+git20210121.3bc455b+ds-2) unstable; urgency=medium
+
+  * The LSB initscript has been restored for users of non-systemd
+    inits. The server is disabled by default and should be enabled with
+
+     $ update-rc.d netperf enable; invoke-rc.d netperf start
+
+    if required.
+
+ -- Mark Hindley <lee...@debian.org>  Mon, 19 Aug 2024 10:21:26 +0100
+
 netperf (2.7.0+git20210121.3bc455b+ds-1) unstable; urgency=medium
 
   The sysvinit /etc/init.d/netperf script was replaced by a systemd service
diff --git a/debian/changelog b/debian/changelog
index e3eb0c7..1b83e10 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+netperf (2.7.0+git20210121.3bc455b+ds-2) UNRELEASED; urgency=medium
+
+  * d/control: add myself to uploaders.
+  * Restore LSB initscript (Closes: #1078674).
+  * d/rules: don't enable or start LSB initscript by default.
+  * d/NEWS: add entry about LSB initscript.
+
+ -- Mark Hindley <lee...@debian.org>  Mon, 19 Aug 2024 10:39:58 +0100
+
 netperf (2.7.0+git20210121.3bc455b+ds-1) unstable; urgency=medium
 
   * Remove stale patches
diff --git a/debian/conffiles b/debian/conffiles
index 9be9edb..6b558cd 100644
--- a/debian/conffiles
+++ b/debian/conffiles
@@ -1,2 +1 @@
 remove-on-upgrade /etc/default/netperf
-remove-on-upgrade /etc/init.d/netperf
diff --git a/debian/control b/debian/control
index ef24bbb..6467f38 100644
--- a/debian/control
+++ b/debian/control
@@ -5,6 +5,7 @@ Maintainer: netperf Debian Maintainers <netp...@packages.debian.org>
 Uploaders:
  Erik Wenzel <e...@debian.org>,
  Daniel Gröber <d...@darkboxed.org>,
+ Mark Hindley <lee...@debian.org>
 Build-Depends:
  debhelper-compat (= 13),
  texinfo,
diff --git a/debian/init.d b/debian/init.d
new file mode 100644
index 0000000..bd80b05
--- /dev/null
+++ b/debian/init.d
@@ -0,0 +1,76 @@
+#!/bin/sh
+#
+#
+# Written by Miquel van Smoorenburg <miqu...@cistron.nl>.
+# Modified for Debian GNU/Linux by Ian Murdock <imurd...@gnu.org>.
+# Modified for Debian by Christoph Lameter <clame...@debian.org>
+
+### BEGIN INIT INFO
+# Provides:             netperf
+# Required-Start:       $remote_fs $local_fs $time
+# Required-Stop:        $remote_fs $local_fs $time
+# Should-Start:         $network $named
+# Should-Stop:          $network $named
+# Default-Start:        2 3 4 5
+# Default-Stop:         0 1 6
+# Short-Description:    network benchmark
+### END INIT INFO
+
+PATH=/bin:/usr/bin:/sbin:/usr/sbin
+DAEMON=/usr/bin/netserver
+
+test -f $DAEMON || exit 0
+
+
+# Read configuration variable file if it is present
+[ -r /etc/default/netperf ] && . /etc/default/netperf
+
+# Define LSB log_* functions.
+# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
+. /lib/lsb/init-functions
+
+case "$1" in
+  start)
+	if [ x"$NETSERVER_ENABLE" = xno ]
+	then
+		log_warning_msg "netperf daemon not enabled in /etc/default/netperf, not starting..."
+		return 0
+	fi
+	log_begin_msg "Starting network benchmark server"
+	start-stop-daemon --start --quiet --exec $DAEMON < /dev/null > /dev/null 2>&1 
+	log_end_msg $?
+    ;;
+  stop)
+	log_begin_msg "Stopping network benchmark server"
+	start-stop-daemon --stop --quiet --exec $DAEMON
+	log_end_msg $?
+    ;;
+  #reload)
+    #
+    # If the daemon can reload its config files on the fly
+    # for example by sending it SIGHUP, do it here.
+    #
+    # If the daemon responds to changes in its config file
+    # directly anyway, make this a do-nothing entry.
+    #
+    # start-stop-daemon --stop --signal 1 --verbose --exec $DAEMON
+    # ;;
+  restart|force-reload)
+  #
+  # If the "reload" option is implemented, move the "force-reload"
+  # option to the "reload" entry above. If not, "force-reload" is
+  # just the same as "restart".
+  #
+    log_begin_msg "Restarting network benchmark server"
+    start-stop-daemon --stop --verbose --exec $DAEMON
+    sleep 1
+    start-stop-daemon --start --verbose --exec $DAEMON < /dev/null > /dev/null 2>&1
+    log_end_msg $?
+    ;;
+  *)
+    echo "Usage: /etc/init.d/netperf {start|stop|restart|force-reload}"
+    exit 1
+    ;;
+esac
+
+exit 0
diff --git a/debian/rules b/debian/rules
index 1bd1a91..869c6ed 100755
--- a/debian/rules
+++ b/debian/rules
@@ -20,3 +20,6 @@ execute_after_dh_auto_install:
 
 override_dh_installsystemd:
 	dh_installsystemd --no-enable
+
+override_dh_installinit:
+	dh_installinit --no-enable --no-start

Reply via email to