kdumpctl: Check kdump.conf for error when rebuild is called

Although "kdumpctl rebuild" is introduced to help user rebuild the
initramfs without modifying the kdump.conf, if the kdump.conf is
modified and "kdumpctl rebuild" is called, a initramfs with a faulty
kdump.conf will be built.

Kdump will refuse to load the initramfs when restarted, but kdumpctl
reload may load the faulty initramfs. So need to make sure the faulty
build won't be generate in the first place.

Check for kdump.conf error before building the initramfs to ensure such
failure won't happen.

Signed-off-by: Kairui Song <kasong@redhat.com>
Acked-by: Dave Young <dyoung@redhat.com>
This commit is contained in:
Kairui Song 2019-05-23 17:34:05 +08:00 committed by Kairui Song
parent 8af28759ec
commit 43c26b7312
1 changed files with 5 additions and 0 deletions

View File

@ -1169,6 +1169,11 @@ stop()
}
rebuild() {
check_config
if [ $? -ne 0 ]; then
return 1
fi
setup_initrd
if [ $? -ne 0 ]; then
return 1