packages: kexec-tools/kexec-tools.spec, kexec-tools/kexec.init (NEW), kexec...

glen glen at pld-linux.org
Mon Jun 29 00:38:40 CEST 2009


Author: glen                         Date: Sun Jun 28 22:38:40 2009 GMT
Module: packages                      Tag: HEAD
---- Log message:
- add initscript to load kexec image

---- Files affected:
packages/kexec-tools:
   kexec-tools.spec (1.18 -> 1.19) , kexec.init (NONE -> 1.1)  (NEW), kexec.sysconfig (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: packages/kexec-tools/kexec-tools.spec
diff -u packages/kexec-tools/kexec-tools.spec:1.18 packages/kexec-tools/kexec-tools.spec:1.19
--- packages/kexec-tools/kexec-tools.spec:1.18	Mon Jun 29 00:18:55 2009
+++ packages/kexec-tools/kexec-tools.spec	Mon Jun 29 00:38:35 2009
@@ -3,15 +3,20 @@
 Summary(pl.UTF-8):	Narzędzie pozwalające załadować nowe jądro bez konieczności restartu
 Name:		kexec-tools
 Version:	2.0.0
-Release:	0.1
+Release:	0.3
 License:	GPL v2
 Group:		Applications/System
 Source0:	http://www.kernel.org/pub/linux/kernel/people/horms/kexec-tools/%{name}-%{version}.tar.bz2
 # Source0-md5:	d9f2ecd3c3307905f24130a25816e6cc
 Patch0:		as-needed.patch
+Source1:	kexec.init
+Source2:	kexec.sysconfig
 URL:		http://www.kernel.org/pub/linux/kernel/people/horms/kexec-tools/
 BuildRequires:	autoconf
+BuildRequires:	rpmbuild(macros) >= 1.228
 BuildRequires:	zlib-devel
+Requires(post,preun):	/sbin/chkconfig
+Requires:	rc-scripts
 ExclusiveArch:	%{ix86} %{x8664} alpha ia64 ppc ppc64
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
@@ -40,16 +45,32 @@
 
 %install
 rm -rf $RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT/etc/{sysconfig,rc.d/init.d}
 
 %{__make} install \
 	DESTDIR=$RPM_BUILD_ROOT
 
+install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/kexec
+cp -a %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/kexec
+
 %clean
 rm -rf $RPM_BUILD_ROOT
 
+%post
+/sbin/chkconfig --add kexec
+%service kexec restart
+
+%preun
+if [ "$1" = "0" ]; then
+	%service -q kexec stop
+	/sbin/chkconfig --del kexec
+fi
+
 %files
 %defattr(644,root,root,755)
 %doc AUTHORS News TODO
+%attr(754,root,root) /etc/rc.d/init.d/kexec
+%config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/kexec
 %attr(755,root,root) %{_sbindir}/kdump
 %attr(755,root,root) %{_sbindir}/kexec
 %dir %{_libdir}/kexec-tools
@@ -61,6 +82,9 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.19  2009/06/28 22:38:35  glen
+- add initscript to load kexec image
+
 Revision 1.18  2009/06/28 22:18:55  glen
 - up to 2.0.0, new url
 
@@ -116,3 +140,6 @@
 
 Revision 1.2  2003/07/13 15:27:16  erjot
 - adapterized
+
+Revision 1.1  2003/07/13 15:13:22  erjot
+- init version

================================================================
Index: packages/kexec-tools/kexec.init
diff -u /dev/null packages/kexec-tools/kexec.init:1.1
--- /dev/null	Mon Jun 29 00:38:40 2009
+++ packages/kexec-tools/kexec.init	Mon Jun 29 00:38:35 2009
@@ -0,0 +1,65 @@
+#!/bin/sh
+#
+# kexec-load	Load kernel image with kexec
+#
+# chkconfig:	345 99 01
+#
+# description:	This tool is used to load a kernel in memory and reboot into the kernel \
+#  				loaded in memory using the kexec system call.
+#
+# $Id$
+
+# Source function library
+. /etc/rc.d/init.d/functions
+
+LOAD_KEXEC=yes
+KERNEL_IMAGE="/boot/vmlinuz"
+INITRD="/boot/initrd"
+APPEND=""
+
+# Get service config - may override defaults
+[ -f /etc/sysconfig/kexec ] && . /etc/sysconfig/kexec
+
+stop() {
+	if ! is_yes "$LOAD_KEXEC" || [ ! -f /sys/kernel/kexec_loaded ]; then
+		return
+	fi
+
+	# skip if already loaded something
+	if [ "`cat /sys/kernel/kexec_loaded 2>/dev/null`" = "1" ]; then
+		return
+	fi
+
+	REAL_APPEND="$APPEND"
+	if [ -z "$REAL_APPEND" ]; then
+	   	REAL_APPEND=$(cat /proc/cmdline)
+	fi
+
+	show "Loading new kernel image (%s) into memory" "$KERNEL_IMAGE"
+	if [ -z "$INITRD" ]; then
+		kexec -l "$KERNEL_IMAGE" --append="$REAL_APPEND"
+	else
+		kexec -l "$KERNEL_IMAGE" --initrd="$INITRD" --append="$REAL_APPEND"
+	fi
+	if [ $? = 0 ]; then
+		ok
+	else
+		fail
+	fi
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+	# it's a noop
+	;;
+  stop)
+  	stop
+	;;
+  *)
+	msg_usage "$0 {start|stop}"
+	exit 3
+esac
+
+exit $RETVAL

================================================================
Index: packages/kexec-tools/kexec.sysconfig
diff -u /dev/null packages/kexec-tools/kexec.sysconfig:1.1
--- /dev/null	Mon Jun 29 00:38:40 2009
+++ packages/kexec-tools/kexec.sysconfig	Mon Jun 29 00:38:35 2009
@@ -0,0 +1,12 @@
+# Defaults for kexec initscript
+# Sourced by /etc/rc.d/init.d/kexec
+
+# Load a kexec kernel (yes/no)
+LOAD_KEXEC=yes
+
+# Kernel and initrd image
+KERNEL_IMAGE="/boot/vmlinuz"
+INITRD="/boot/initrd.gz"
+
+# If empty, use current /proc/cmdline
+APPEND=""
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/kexec-tools/kexec-tools.spec?r1=1.18&r2=1.19&f=u



More information about the pld-cvs-commit mailing list