[arch-projects] [initscripts][PATCH 3/4] check for a loaded kernel on reboot

Dave Reisner dreisner at archlinux.org
Fri Jun 8 10:58:48 EDT 2012


Explicitly pass "kexec" to the shutdown script if we detect a preloaded
kernel already in memory. We mask read errors for custom kernels where
kexec is not available.

Signed-off-by: Dave Reisner <dreisner at archlinux.org>
---
 rc.shutdown |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/rc.shutdown b/rc.shutdown
index d0d8405..78f56c4 100755
--- a/rc.shutdown
+++ b/rc.shutdown
@@ -82,7 +82,12 @@ if [[ -x /run/initramfs/shutdown ]]; then
 	if [[ $RUNLEVEL = 0 ]]; then
 		action="poweroff"
 	else
-		action="reboot"
+		{ read kexec_loaded </sys/kernel/kexec_loaded; } 2>/dev/null
+		if (( kexec_loaded )); then
+			action="kexec"
+		else
+			action="reboot"
+		fi
 	fi
 
 	# make /run/initrafs a mount
-- 
1.7.10.4



More information about the arch-projects mailing list