Package: kexec-tools / 1:2.0.14-1

coldreboot.patch Patch series | download
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
79
80
81
82
--- a/Makefile.in
+++ b/Makefile.in
@@ -178,11 +178,13 @@
 PGSRCS:=$(foreach s, $(GENERATED_SRCS), $(PACKAGE_NAME)-$(PACKAGE_VERSION)/$(s))
 
 MAN_PAGES:=$(KEXEC_MANPAGE) $(KDUMP_MANPAGE) $(VMCORE_DMESG_MANPAGE)
+MAN_PAGES+= $(MANDIR)/man8/coldreboot.8
 BINARIES_i386:=$(KEXEC_TEST)
 BINARIES_x86_64:=$(KEXEC_TEST)
 BINARIES:=$(KEXEC) $(KDUMP) $(VMCORE_DMESG) $(BINARIES_$(ARCH))
+SCRIPTS:=$(SBINDIR)/coldreboot
 
-TARGETS:=$(BINARIES) $(MAN_PAGES)
+TARGETS:=$(BINARIES) $(MAN_PAGES) $(SCRIPTS)
 
 targets: $(TARGETS)
 
--- a/kexec/Makefile
+++ b/kexec/Makefile
@@ -92,6 +92,8 @@
 
 KEXEC = $(SBINDIR)/kexec
 KEXEC_MANPAGE = $(MANDIR)/man8/kexec.8
+KEXEC_COLDREBOOT=$(SBINDIR)/coldreboot
+KEXEC_COLDREBOOT_MANPAGE=$(MANDIR)/man8/coldreboot.8
 
 -include $(KEXEC_DEPS)
 
@@ -106,6 +108,16 @@
 $(KEXEC_MANPAGE): kexec/kexec.8
 	@$(MKDIR) -p     $(MANDIR)/man8
 	cp $^ $(KEXEC_MANPAGE)
+
+$(KEXEC_COLDREBOOT): kexec/coldreboot
+	@$(MKDIR) -p     $(@D)
+	cp kexec/coldreboot $(KEXEC_COLDREBOOT)
+	/bin/chmod 755 $(KEXEC_COLDREBOOT)
+
+$(KEXEC_COLDREBOOT_MANPAGE): kexec/coldreboot.8
+	@$(MKDIR) -p     $(MANDIR)/man8
+	cp kexec/coldreboot.8 $(KEXEC_COLDREBOOT_MANPAGE)
+
 echo::
 	@echo "KEXEC_SRCS $(KEXEC_SRCS)"
 	@echo "KEXEC_DEPS $(KEXEC_DEPS)"
--- /dev/null
+++ b/kexec/coldreboot
@@ -0,0 +1,6 @@
+#!/bin/sh
+NOKEXECFILE=/no-kexec-reboot
+
+/bin/rm -f $NOKEXECFILE
+touch $NOKEXECFILE
+/sbin/reboot $*
--- /dev/null
+++ b/kexec/coldreboot.8
@@ -0,0 +1,25 @@
+.\" Process this file with
+.\" groff -man -Tascii coldreboot.8
+.\"
+.TH kexec 8 "April 2006" Linux "User Manuals"
+.SH NAME
+coldreboot \- Force a cold reboot bypassing kexec-tools default
+.SH SYNOPSIS
+.B /sbin/coldreboot
+.B [reboot options]
+
+.SH DESCRIPTION
+.B coldreboot
+is a script that forces a cold reboot regardless of whether kexec is enabled
+or not in /etc/default/kexec.
+.B coldreboot
+takes the same arguments as /sbin/reboot and passes them on to /sbin/reboot
+later.
+
+.SH NOTES
+.PP
+.B coldreboot
+prevents a kexec kernel from being loaded automatically and thus
+forces a cold reboot. If the user loads a kexec kernel by hand,
+.B coldreboot
+will still result in a kexec reboot.