It is hard to detect the time that /etc/kdump is removed. And this failure may cause out-of-date kdump.initrd. To keep things simple, just make /etc/kdump/pre.d and post.d mandotary and warn users to re-create them if they are be deleted.
Signed-off-by: Pingfan Liu piliu@redhat.com --- kdump.conf | 12 +++++------- kdump.conf.5 | 12 +++++------- kdumpctl | 6 +++--- 3 files changed, 13 insertions(+), 17 deletions(-)
diff --git a/kdump.conf b/kdump.conf index 9f35e31..9fc0a4f 100644 --- a/kdump.conf +++ b/kdump.conf @@ -79,10 +79,9 @@ # or script after the vmcore dump process terminates. # The exit status of the current dump process is fed to # the executable binary or script as its first argument. -# If /etc/kdump/post.d directory exists, all files in -# the directory are collectively sorted and executed in -# lexical order, before binary or script specified -# kdump_post parameter is executed. +# All files under /etc/kdump/post.d are collectively sorted +# and executed in lexical order, before binary or script +# specified kdump_post parameter is executed. # # kdump_pre <binary | script> # - Works like the "kdump_post" directive, but instead of running @@ -90,9 +89,8 @@ # Exit status of this binary is interpreted as follows: # 0 - continue with dump process as usual # non 0 - run the final action (reboot/poweroff/halt) -# If /etc/kdump/pre.d directory exists, all files in -# the directory are collectively sorted and executed in -# lexical order, after binary or script specified +# All files under /etc/kdump/pre.d are collectively sorted and +# executed in lexical order, after binary or script specified # kdump_pre parameter is executed. # Even if the binary or script in /etc/kdump/pre.d directory # returns non 0 exit status, the processing is continued. diff --git a/kdump.conf.5 b/kdump.conf.5 index c362963..34c996c 100644 --- a/kdump.conf.5 +++ b/kdump.conf.5 @@ -109,10 +109,9 @@ status of the current dump process is fed to the kdump_post executable as its first argument($1). Executable can modify it to indicate the new exit status of succeeding dump process, .PP -If /etc/kdump/post.d directory exists, All files in -the directory are collectively sorted and executed in -lexical order, before binary or script specified -kdump_post parameter is executed. +All files under /etc/kdump/post.d are collectively sorted +and executed in lexical order, before binary or script +specified kdump_post parameter is executed. .PP Note that scripts written for use with this directive must use the /bin/bash interpreter. @@ -129,9 +128,8 @@ as follows: .PP non 0 - run the final action (reboot/poweroff/halt) .PP -If /etc/kdump/pre.d directory exists, all files in -the directory are collectively sorted and executed in -lexical order, after binary or script specified +All files under /etc/kdump/pre.d are collectively sorted and +executed in lexical order, after binary or script specified kdump_pre parameter is executed. Even if the binary or script in /etc/kdump/pre.d directory returns non 0 exit status, the processing is continued. diff --git a/kdumpctl b/kdumpctl index 42c11d3..bf79e2d 100755 --- a/kdumpctl +++ b/kdumpctl @@ -151,7 +151,7 @@ rebuild_initrd() check_exist() { for file in $1; do - if [ ! -f "$file" ]; then + if [ ! -f "$file" ] && [ ! -d "$file" ]; then echo -n "Error: $file not found."; echo return 1 fi @@ -385,11 +385,11 @@ check_files_modified() done fi
+ # HOOKS is mandatory and need to check the modification time + files="$files $HOOKS" check_exist "$files" && check_executable "$EXTRA_BINS" [ $? -ne 0 ] && return 2
- # HOOKS only need to check the modification here - files="$files $HOOKS" for file in $files; do if [ -e "$file" ]; then time_stamp=`stat -c "%Y" $file`