diff --git a/mkdumprd b/mkdumprd index f856773..d40f3ca 100644 --- a/mkdumprd +++ b/mkdumprd @@ -23,7 +23,6 @@ if [ $? -ne 0 ]; then exit 1 fi -conf_file="/etc/kdump.conf" SSH_KEY_LOCATION="/root/.ssh/kdump_id_rsa" SAVE_PATH=$(get_save_path) OVERRIDE_RESETTABLE=0 @@ -292,19 +291,6 @@ handle_default_dump_target() check_size fs $_target } -get_override_resettable() -{ - local override_resettable - - override_resettable=$(grep "^override_resettable" $conf_file) - if [ -n "$override_resettable" ]; then - OVERRIDE_RESETTABLE=$(echo $override_resettable | cut -d' ' -f2) - if [ "$OVERRIDE_RESETTABLE" != "0" ] && [ "$OVERRIDE_RESETTABLE" != "1" ];then - perror_exit "override_resettable value $OVERRIDE_RESETTABLE is invalid" - fi - fi -} - # $1: function name for_each_block_target() { @@ -343,9 +329,13 @@ is_unresettable() #return true if resettable check_resettable() { - local _ret _target + local _ret _target _override_resettable - get_override_resettable + _override_resettable=$(kdump_get_conf_val override_resettable) + OVERRIDE_RESETTABLE=${_override_resettable:-$OVERRIDE_RESETTABLE} + if [ "$OVERRIDE_RESETTABLE" != "0" ] && [ "$OVERRIDE_RESETTABLE" != "1" ];then + perror_exit "override_resettable value '$OVERRIDE_RESETTABLE' is invalid" + fi for_each_block_target is_unresettable _ret=$? @@ -375,7 +365,7 @@ if ! check_crypt; then fi # firstly get right SSH_KEY_LOCATION -keyfile=$(awk '/^sshkey/ {print $2}' $conf_file) +keyfile=$(kdump_get_conf_val sshkey) if [ -f "$keyfile" ]; then # canonicalize the path SSH_KEY_LOCATION=$(/usr/bin/readlink -m $keyfile)