aboutsummaryrefslogtreecommitdiff
blob: 27859d0f08dbd07782b30c16c1804f99d7aa9e83 (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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# $Id$
# Author:
#   Matthias Schwarzott <zzam@gmx.de>
#   Various other contributors from gentoo.de
#

if [ -z "${BOOT_MANAGER}" ]; then
	BOOT_MANAGER="auto"
fi

case "${BOOT_MANAGER}" in
	auto)
		if [ ! -L /etc/runlevels/boot/wakeup-reboot-halt ]; then
			rc-update add wakeup-reboot-halt boot
		fi

		/etc/init.d/wakeup-reboot-halt mark_for_reboot
		;;
	grub)
		mount /boot
		if [ -n "${REBOOT_ENTRY_GRUB}" ]; then
			case "${GRUB_SET_REBOOT_ENTRY_METHOD:=grub-set-default}" in
				grub-set-default)
					if [ -x /sbin/grub-set-default ]; then
						/sbin/grub-set-default "${REBOOT_ENTRY_GRUB}"
					else
						mesg "command grub-set-default not found!"
					fi
					;;
				savedefault)
					if [ -x /sbin/grub ]; then
						echo "savedefault --default=${REBOOT_ENTRY_GRUB} --once" | /sbin/grub --batch
					else
						mesg "command grub-set-default not found!"
					fi
					;;
				*)
					mesg "Unknown grub method ${GRUB_SET_REBOOT_ENTRY_METHOD}."
					;;
			esac
		else
			mesg "reboot entry not set, can not reboot."
		fi
		;;
	grub2)
		mount /boot
		if [ -n "${REBOOT_ENTRY_GRUB}" ]; then
			case "${GRUB_SET_REBOOT_ENTRY_METHOD:=grub2-set-default}" in
				grub2-set-default)
					if [ -x /usr/sbin/grub2-set-default ]; then
						/usr/sbin/grub2-set-default "${REBOOT_ENTRY_GRUB}"
					else
						mesg "command grub2-set-default not found!"
					fi
					;;
				*)
					mesg "Unknown grub method ${GRUB_SET_REBOOT_ENTRY_METHOD}."
					;;
			esac
		else
			mesg "reboot entry not set, can not reboot."
		fi
		;;
	lilo)
		mount /boot
		if [ -n "${REBOOT_ENTRY_LILO}" ]; then
			/sbin/lilo -R ${REBOOT_ENTRY_LILO}
		else
			mesg "reboot entry not set, can not reboot."
		fi
		;;
	*)
		mesg "Unsupported boot manager ${BOOT_MANAGER}"
		return
		;;
esac

/sbin/shutdown -r now