kdumpctl: Error out if path is set more than once.

Currently the kdumpctl script doesn't check if the path option is
set more than once due to which a vmcore is not captured.

This patch addresses this issue by ensuring that only one path
is specified in /etc/kdump.conf file.

Signed-off-by: Kenneth D'souza <kdsouza@redhat.com>
Acked-by: Kairui Song <kasong@redhat.com>
This commit is contained in:
Kenneth Dsouza 2018-08-10 06:05:54 +05:30 committed by Kairui Song
parent 94a7b43407
commit d92b9364ae

View File

@ -204,6 +204,13 @@ check_config()
return 1 return 1
} }
# Check if path option is set more than once.
nr=$(awk 'BEGIN{cnt=0} /^path /{cnt++} END{print cnt}' $KDUMP_CONFIG_FILE)
[ $nr -gt 1 ] && {
echo "Mutiple paths specifed in $KDUMP_CONFIG_FILE"
return 1
}
nr=$(grep "^dracut_args .*\-\-mount" $KDUMP_CONFIG_FILE | grep -o "\-\-mount" | wc -l) nr=$(grep "^dracut_args .*\-\-mount" $KDUMP_CONFIG_FILE | grep -o "\-\-mount" | wc -l)
[ $nr -gt 1 ] && { [ $nr -gt 1 ] && {
echo "Multiple mount targets specified in one \"dracut_args\"." echo "Multiple mount targets specified in one \"dracut_args\"."