#!/bin/sh
set -eu

### BEGIN INIT INFO
# Provides:          netconsole
# Required-Start:    $named $network $local_fs $remote_fs
# Required-Stop:     $named $network $local_fs $remote_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Dynamically configure Linux netconsole
### END INIT INFO

NAME=netconsole
DAEMON=/usr/sbin/netconsole-setup

# Exit if the package is not installed
test -x $DAEMON || exit 0

. /lib/lsb/init-functions

# Read configuration variable file if it is present
NETCONSOLE_OPTS=
if test -r /etc/default/$NAME; then
	. /etc/default/$NAME
fi

case "$1" in
  start|restart|force-reload)
	# shellcheck disable=SC2086
	$DAEMON $NETCONSOLE_OPTS
	;;
  status|stop)
	# Nothing to do
	exit 0
	;;
  *)
	echo "Usage: /etc/init.d/$NAME {start|stop|restart|force-reload}" >&2
	exit 2
	;;
esac
