aboutsummaryrefslogtreecommitdiff
blob: 555b06409645433130acf2ad69e20cfd13b18b1c (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
#!/sbin/openrc-run
# Copyright 1999-2020 Gentoo Authors

extra_commands="mark_for_reboot"

STATEFILE=/force_reboot_shutdown

depend() {
	if [ -x /etc/init.d/root ]; then
		need root
	else
		need checkroot
	fi
}

start() {
	# check weather this time this is a reboot and I should shutdown
	
	if [ -e "${STATEFILE}" ]; then
		rm -f "${STATEFILE}"
		einfo "This is a reboot to write the wakeup-time into the bios."
		einfo "Shutting down now."
		init 0
	fi
}

stop() {
	:
}

mark_for_reboot() {
	touch "${STATEFILE}"
}