summaryrefslogtreecommitdiff
path: root/init.d/halt.in
blob: 754d4ad8daa4a5cae94c12a4783e633a1b512697 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!@PREFIX@/sbin/runscript
# Copyright 2007-2008 Roy Marples <roy@marples.name>
# All rights reserved. Released under the 2-clause BSD license.

# This script really belongs with the Linux sysvinit package
description="Halt or reboot the host depending on sysvinit runlevel."

depend()
{
	after *
	use romount
	keyword noprefix
}

start()
{
	case "${RUNLEVEL}" in
		0) runlevel=shutdown;;
		6) runlevel=reboot;;
		*) eerror "Unknown runlevel ${RUNLEVEL}"; return 1
	esac

	. /etc/init.d/"${runlevel}".sh
	return 0
}