#!/bin/sh
### BEGIN INIT INFO
# Provides:		kexec-load
# Required-Start:	$local_fs $remote_fs kexec
# Required-Stop:	$local_fs $remote_fs kexec
# Should-Stop:		autofs
# Default-Start:	2 3 4 5
# Default-Stop:		6
# Short-Description: Load kernel image with kexec
# Description:
### END INIT INFO

PATH=/sbin:/bin:/usr/sbin:/usr/bin

. /lib/lsb/init-functions

test -r /etc/default/kexec && . /etc/default/kexec
if [ -d /etc/default/kexec.d ] ; then
	for snippet in $(run-parts --list /etc/default/kexec.d) ; do
		. "$snippet"
	done
fi

do_stop () {
	kexec-load-kernel
	log_action_end_msg $?
}

case "$1" in
  start)
	# No-op
	;;
  restart|reload|force-reload)
	echo "Error: argument '$1' not supported" >&2
	exit 0
	;;
  stop)
	do_stop
	;;
  *)
	echo "Usage: $0 start|stop" >&2
	exit 3
	;;
esac
exit 0
