VMCORE_DIR=/mnt/Data_drive/vmcore
KEXEC_APPEND_ARGS="1 maxcpus=1 reset_devices oops=panic panic=10 kmemleak=off consoleblank=0 crashkernel=0 vt.color=0x3E"

wait_for_mount() {
    timeout=$1;

    while ! mountpoint "/mnt/Data_drive" 2>&1> /dev/null;
        do
            timeout=$((${timeout} - 1));
            if [ ${timeout} -gt 0 ];
            then
                sleep 1
                continue
            else
                /usr/bin/logger -t kdump -s "$VMCORE_DIR partition mounted timeout"
                return 0
            fi
        done
    if [ -e /tmp/wait_for_data_drive ]; then
        /bin/bash /tmp/wait_for_data_drive
    fi
    return 1;
}


# Control what behavior happens prior to automatic copy of vmcore
# Options:
# "reboot" - skip the vmcore copy and just reboot
# "wait_for_mount 60 && return" - allow 60 seconds for NV storage to mount prior to the copy of vmcore, return if timeout
# "while :; do sleep 5; done" - wait here forever for user to intervene

# The following two lines provide the required commands to enable or disable kernel dump collection. Only one of these should
# be uncommented at any time. By default, kernel dump collection is disabled. Swap the comments on the two lines to enable
# that functionality. Remember to 'wb' this file so the changes are written back to the system drive

#PRE_VMCORE_COPY="/usr/bin/logger -t kdump -s 'Rebooting without collecting kernel crash dump'; /sbin/reboot; return"
PRE_VMCORE_COPY="wait_for_mount 60 && (/sbin/reboot; return;); /usr/bin/logger -t kdump -s 'Collecting kernel crash dump, this may take awhile...'"

