From 908c4346d9f66b96d12767bfe9e53d45fb24a6f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Tue, 28 Jul 2020 18:16:44 +0200 Subject: Add System V init scripts again --- debian/= | 0 debian/changelog | 21 +------ debian/control | 1 + debian/ipmitool.ipmievd.init | 126 ++++++++++++++++++++++++++++++++++++++ debian/ipmitool.lintian-overrides | 4 ++ debian/ipmitool.maintscript | 1 - debian/ipmitool.postinst | 17 +++++ debian/ipmitool.postrm | 16 +---- debian/ipmitool.prerm | 9 +++ debian/rules | 3 + 10 files changed, 166 insertions(+), 32 deletions(-) create mode 100644 debian/= create mode 100644 debian/ipmitool.ipmievd.init create mode 100644 debian/ipmitool.lintian-overrides create mode 100644 debian/ipmitool.postinst create mode 100644 debian/ipmitool.prerm diff --git a/debian/= b/debian/= new file mode 100644 index 0000000..e69de29 diff --git a/debian/changelog b/debian/changelog index 8a0d02b..10b3182 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -ipmitool (1.8.18-10) UNRELEASED; urgency=medium +ipmitool (1.8.18-9) unstable; urgency=medium * New debian/patches/0005-gcc10.patch: Fix ftbfs with gcc-10 (Closes: #957371). @@ -10,25 +10,10 @@ ipmitool (1.8.18-10) UNRELEASED; urgency=medium - 0001-Dialect_change.patch * Declare compliance with Debian Policy 4.5.0 (No changes needed). * Switch to debhelper-compat level 13. - - -- Jörg Frings-Fürst Tue, 28 Jul 2020 15:42:13 +0200 - -ipmitool (1.8.18-9) unstable; urgency=medium - * debian/ipmitool.maintscript: - Fix syntax (Closes: #947384). - * Remove System V init scripts: - - Remove debian/ipmitool.ipmievd.init. - - Remove debian/ipmitool.lintian-overrides. - - Remove debian/ipmitool.postinst. - - Rewrite debian/ipmitool.postrm. - - Remove debian/ipmitool.prerm. - - Remove override_dh_installinit from debian/rules. - - Remove init-system-helpers (>> 1.50) from debian/control. - - Add rm_conffile /etc/init.d/ipmievd 1.8.18-9~ ipmitool to - debian/ipmitool.maintscript. - - -- Jörg Frings-Fürst Thu, 26 Dec 2019 19:25:06 +0100 + + -- Jörg Frings-Fürst Tue, 28 Jul 2020 17:29:03 +0200 ipmitool (1.8.18-8) unstable; urgency=medium diff --git a/debian/control b/debian/control index 46192f1..76b151b 100644 --- a/debian/control +++ b/debian/control @@ -4,6 +4,7 @@ Priority: optional Maintainer: Jörg Frings-Fürst Build-Depends: debhelper-compat (= 13), + init-system-helpers (>= 1.58), libncurses-dev, libfreeipmi-dev [!hurd-i386], libreadline-dev, diff --git a/debian/ipmitool.ipmievd.init b/debian/ipmitool.ipmievd.init new file mode 100644 index 0000000..dcd0c28 --- /dev/null +++ b/debian/ipmitool.ipmievd.init @@ -0,0 +1,126 @@ +#! /bin/sh +### BEGIN INIT INFO +# Provides: ipmievd +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: IPMI event daemon +# Description: ipmievd is a daemon which will listen for events +# from the BMC that are being sent to the SEL and +# also log those messages to syslog. +### END INIT INFO +# +# Author: Elmar Hoffmann +# Licence: This script is public domain using the same +# licence as ipmitool itself. +# Modified by: Petter Reinholdtsen +# Jörg Frings-Fürst 2014-06-01 + +set -e + +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +DESC="IPMI event daemon" +NAME=ipmievd +DAEMON=/usr/sbin/$NAME +PIDFILE=/var/run/$NAME.pid0 +SCRIPTNAME=/etc/init.d/$NAME +ENABLED=true + +# Gracefully exit if the package has been removed. +test -x $DAEMON || exit 0 + +. /lib/lsb/init-functions +test -r /etc/default/rcS && . /etc/default/rcS + +# Options used by ipmievd. +# +# "open" uses the asynchronous event notification from the OpenIPMI +# kernel driver, "sel" uses active polling of the contents of the SEL +# for new events. +# +# Need to force 'daemon' mode, to make sure messages are sent to +# syslog and the program forks into the background. +# +# Se ipmievd(8) for more info. +IPMIEVD_OPTIONS="open daemon" + +# +# requested kernelmodules +# +#REQMODULES="ipmi_devintf ipmi_msghandler ipmi_poweroff ipmi_si ipmi_watchdog" +REQMODULES="" + +# Read config file if it is present. +[ -f /etc/default/$NAME ] && . /etc/default/$NAME + +test "$ENABLED" != "false" || exit 0 + +# Backwards compatibility with version 1.8.6-2 and 1.8.6-1. The +# variable was renamed to be compatible with upstream, SuSe and RedHat. +if [ -n "$IPMIEVD_OPTS" ]; then + echo "warning: /etc/default/$NAME variable IPMIEVD_OPTS should be renamed to IPMIEVD_OPTIONS" + IPMIEVD_OPTIONS="$IPMIEVD_OPTS" +fi + +# +# function to load requested kernelmodules +do_modprobe() { + if [ -x /sbin/modprobe -a -f /proc/modules ] + then + modprobe -q "$1" || true + fi +} + +# +# Function that starts the daemon/service. +# +d_start() { + start-stop-daemon --start --quiet --exec $DAEMON --pidfile $PIDFILE -- $IPMIEVD_OPTIONS +} + +# +# Function that stops the daemon/service. +# +d_stop() { + start-stop-daemon --stop --oknodo --quiet --name $NAME --exec $DAEMON --pidfile $PIDFILE +} + +CODE=0 + +case "$1" in + start) + # load kernelmodules + for rmod in ${REQMODULES} + do + do_modprobe ${rmod} + done + [ "$VERBOSE" != no ] && log_begin_msg "Starting $DESC" "$NAME" + d_start || CODE=$? + [ "$VERBOSE" != no ] && log_end_msg $CODE + exit $CODE + ;; + stop) + log_begin_msg "Stopping $DESC" "$NAME" + d_stop || CODE=$? + log_end_msg $CODE + exit $CODE + ;; + restart|force-reload) + log_begin_msg "Restarting $DESC" "$NAME" + d_stop || true + sleep 1 + d_start || CODE=$? + log_end_msg $CODE + exit $CODE + ;; + status) + status_of_proc $DAEMON $NAME + ;; + *) + echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|status}" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/debian/ipmitool.lintian-overrides b/debian/ipmitool.lintian-overrides new file mode 100644 index 0000000..00696e1 --- /dev/null +++ b/debian/ipmitool.lintian-overrides @@ -0,0 +1,4 @@ +# +# see bug #932378 +# +ipmitool: missing-versioned-depends-on-init-system-helpers postinst:23 "update-rc.d defaults-disabled" needs init-system-helpers >= 1.50 diff --git a/debian/ipmitool.maintscript b/debian/ipmitool.maintscript index deee429..2a663cf 100644 --- a/debian/ipmitool.maintscript +++ b/debian/ipmitool.maintscript @@ -1,2 +1 @@ rm_conffile /etc/default/ipmitool 1.8.18-6~ ipmitool -rm_conffile /etc/init.d/ipmievd 1.8.18-8~ ipmitool diff --git a/debian/ipmitool.postinst b/debian/ipmitool.postinst new file mode 100644 index 0000000..b09b515 --- /dev/null +++ b/debian/ipmitool.postinst @@ -0,0 +1,17 @@ +#!/bin/sh + +set -e + + +ipmievd_initd_failed() { + echo "Unable to start ipmievd during installation. Trying to disable." + if [ -f /etc/default/ipmievd ] && \ + grep -q ^ENABLED=\"false\" /etc/default/ipmievd ; then + : + else + touch /etc/default/ipmievd + echo "ENABLED=\"false\"" >> /etc/default/ipmievd + fi +} + +#DEBHELPER# diff --git a/debian/ipmitool.postrm b/debian/ipmitool.postrm index f6d6ee9..6cd9693 100644 --- a/debian/ipmitool.postrm +++ b/debian/ipmitool.postrm @@ -3,18 +3,8 @@ set -e -# -# remove System V init file artefacte -# new since 1.8.18-9 -# -if [ "$1" = "purge" ] | [ "$1" = "remove" ]; then - rm -f /etc/rc0.d/K01ipmievd - rm -f /etc/rc1.d/K01ipmievd - rm -f /etc/rc2.d/K01ipmievd - rm -f /etc/rc3.d/K01ipmievd - rm -f /etc/rc4.d/K01ipmievd - rm -f /etc/rc5.d/K01ipmievd - rm -f /etc/rc6.d/K01ipmievd -fi +ipmievd_initd_failed() { + : +} #DEBHELPER# diff --git a/debian/ipmitool.prerm b/debian/ipmitool.prerm new file mode 100644 index 0000000..b45afde --- /dev/null +++ b/debian/ipmitool.prerm @@ -0,0 +1,9 @@ +#!/bin/sh + +set -e + +ipmievd_initd_failed() { + : +} + +#DEBHELPER# diff --git a/debian/rules b/debian/rules index faf1fef..96ce733 100755 --- a/debian/rules +++ b/debian/rules @@ -34,3 +34,6 @@ override_dh_installsystemd: override_dh_auto_configure: dh_auto_configure -- --prefix=/usr --with-kerneldir --mandir=/usr/share/man --enable-intf-dummy $(extra_config_opts) + +override_dh_installinit: + dh_installinit --no-enable --name ipmievd --error-handler=ipmievd_initd_failed -- cgit v1.2.3