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@redhat.com>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
This commit is contained in:
Dave Young 2012-08-06 22:01:29 +08:00
parent 3111ff74c9
commit 93e13c118b
3 changed files with 24 additions and 4 deletions

View File

@ -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

View File

@ -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

View File

@ -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):"