[kexec-tools] port force_rebuild kdump.conf option
Dave Young
yangrr at fedoraproject.org
Tue Aug 7 05:26:40 UTC 2012
commit 93e13c118b0ed745e6b3d79a13801647c95af555
Author: Dave Young <dyoung at redhat.com>
Date: Mon Aug 6 22:01:29 2012 +0800
port force_rebuild kdump.conf option
Add force_rebuild option in kdump.conf
Some user need always force rebuild the dumprd, add an kdump.conf
option force_rebuild here. If force_rebuild is set to 1
kdump initrd will be rebuilt every time then the service starts.
Testing:
Tested below cases:
force_rebuild
force_rebuild 0
force_rebuild 1
force_rebuild 2
Signed-off-by: Dave Young <dyoung at redhat.com>
Acked-by: Vivek Goyal <vgoyal at redhat.com>
kdump.conf | 7 ++++++-
kdump.conf.5 | 6 ++++++
kdumpctl | 15 ++++++++++++---
3 files changed, 24 insertions(+), 4 deletions(-)
---
diff --git a/kdump.conf b/kdump.conf
index da47d00..8fd3f33 100644
--- a/kdump.conf
+++ b/kdump.conf
@@ -103,6 +103,11 @@
# where you can try to record the core manually.
# Exiting this shell reboots the system.
# Note: kdump uses bash as the default shell.
+#
+# force_rebuild <0 | 1>
+# - By default, kdump initrd only will be rebuilt when
+# necessary. Specify 1 to force rebuilding kdump
+# initrd every time when kdump service starts.
#raw /dev/sda5
#ext4 /dev/sda3
@@ -120,4 +125,4 @@ path /var/crash
#extra_bins /usr/bin/lftp
#extra_modules gfs2
#default shell
-
+#force_rebuild 1
diff --git a/kdump.conf.5 b/kdump.conf.5
index 2dfd041..7289ad4 100644
--- a/kdump.conf.5
+++ b/kdump.conf.5
@@ -156,6 +156,12 @@ poweroff: The system will be powered down.
Note: kdump uses bash as the default shell.
.RE
+.B force_rebuild <0 | 1>
+.RS
+By default, kdump initrd only will be rebuilt when necessary.
+Specify 1 to force rebuilding kdump initrd every time when kdump service starts.
+.RE
+
.SH EXAMPLES
Here is some examples for core_collector option:
.PP
diff --git a/kdumpctl b/kdumpctl
index 5781da9..d1fef3d 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -78,7 +78,7 @@ function check_executable()
function check_config()
{
local extra_modules modified_files=""
- local force_rebuild=0
+ local _force_rebuild force_rebuild="0"
if [ -z "$KDUMP_KERNELVER" ]; then
kdump_kver=`uname -r`
@@ -89,9 +89,18 @@ function check_config()
kdump_kernel="${KDUMP_BOOTDIR}/${KDUMP_IMG}-${kdump_kver}${KDUMP_IMG_EXT}"
kdump_initrd="${KDUMP_BOOTDIR}/initramfs-${kdump_kver}kdump.img"
+ _force_rebuild=`grep ^force_rebuild $KDUMP_CONFIG_FILE 2>/dev/null`
+ if [ $? -eq 0 ]; then
+ force_rebuild=`echo $_force_rebuild | cut -d' ' -f2`
+ if [ "$force_rebuild" != "0" ] && [ "$force_rebuild" != "1" ];then
+ echo "Error: force_rebuild value is invalid"
+ return 1
+ fi
+ fi
+
#will rebuild every time if extra_modules are specified
extra_modules=`grep ^extra_modules $KDUMP_CONFIG_FILE`
- [ -n "$extra_modules" ] && force_rebuild=1
+ [ -n "$extra_modules" ] && force_rebuild="1"
#check to see if dependent files has been modified
#since last build of the image file
@@ -120,7 +129,7 @@ function check_config()
if [ $image_time -eq 0 ]; then
echo -n "No kdump initial ramdisk found."; echo
- elif [ "$force_rebuild" -ne 0 ]; then
+ elif [ "$force_rebuild" != "0" ]; then
echo -n "Force rebuild $kdump_initrd"; echo
elif [ -n "$modified_files" ]; then
echo "Detected change(s) the following file(s):"
More information about the scm-commits
mailing list