23ef29
#!/bin/bash --norc
23ef29
# New mkdumprd
23ef29
#
23ef29
# Copyright 2011 Red Hat, Inc.
23ef29
#
23ef29
# Written by Cong Wang <amwang@redhat.com>
23ef29
#
23ef29
23ef29
. /lib/kdump/kdump-lib.sh
23ef29
export IN_KDUMP=1
23ef29
23ef29
conf_file="/etc/kdump.conf"
23ef29
SSH_KEY_LOCATION="/root/.ssh/kdump_id_rsa"
23ef29
SAVE_PATH=$(grep ^path $conf_file| cut -d' '  -f2)
23ef29
[ -z "$SAVE_PATH" ] && SAVE_PATH=$DEFAULT_PATH
23ef29
# strip the duplicated "/"
23ef29
SAVE_PATH=$(echo $SAVE_PATH | tr -s /)
23ef29
23ef29
is_wdt_addition_needed() {
23ef29
	local active
23ef29
23ef29
	is_wdt_mod_omitted
23ef29
	[[ $? -eq 0 ]] && return 1
23ef29
	[[ -d /sys/class/watchdog/ ]] || return 1
23ef29
	for dir in /sys/class/watchdog/*; do
23ef29
		[[ -f "$dir/state" ]] || continue
23ef29
		active=$(< "$dir/state")
23ef29
		[[ "$active" =  "active" ]] && return 0
23ef29
	done
23ef29
	return 1
23ef29
}
23ef29
23ef29
WDTCFG=""
23ef29
is_wdt_addition_needed
23ef29
[[ $? -eq 0 ]] && WDTCFG="-a watchdog"
23ef29
23ef29
extra_modules=""
23ef29
dracut_args=("--hostonly" "--hostonly-cmdline" "--hostonly-i18n" "-o" "plymouth dash resume ifcfg" $WDTCFG)
23ef29
OVERRIDE_RESETTABLE=0
23ef29
23ef29
add_dracut_arg() {
23ef29
    local arg qarg is_quoted=0
23ef29
    while [ $# -gt 0 ];
23ef29
    do
23ef29
        arg="${1//\'/\"}"
23ef29
        #Handle quoted substring properly for passing it to dracut_args array.
23ef29
        if [ $is_quoted -eq 0 ]; then
23ef29
            if [[ "$arg" == "\"" ]] || [[ $arg != ${arg#\"} ]]; then
23ef29
                is_quoted=1
23ef29
                arg=${arg#\"}
23ef29
            fi
23ef29
        fi
23ef29
        if [ $is_quoted -eq 1 ]; then
23ef29
            qarg="$qarg $arg"
23ef29
            if [[ "$arg" == "\"" ]] || [[ $arg != ${arg%\"} ]]; then
23ef29
                is_quoted=0
23ef29
                arg=${qarg%\"}
23ef29
                qarg=""
23ef29
            else
23ef29
                shift
23ef29
                continue
23ef29
            fi
23ef29
        fi
23ef29
        dracut_args+=("$arg")
23ef29
        shift
23ef29
    done
23ef29
}
23ef29
23ef29
add_dracut_module() {
23ef29
    add_dracut_arg "--add" "$1"
23ef29
}
23ef29
23ef29
add_dracut_mount() {
23ef29
    add_dracut_arg "--mount" "$1"
23ef29
}
23ef29
23ef29
add_dracut_sshkey() {
23ef29
    add_dracut_arg "--sshkey" "$1"
23ef29
}
23ef29
23ef29
# Generic substring function.  If $2 is in $1, return 0.
23ef29
strstr() { [[ $1 =~ $2 ]]; }
23ef29
23ef29
target_is_root() {
23ef29
    local _t
23ef29
    _t=$(findmnt -k -n -r -o TARGET $1|sort|head -1)
23ef29
    [ "$_t" = "/" ]
23ef29
}
23ef29
23ef29
# caller should ensure $1 is valid and mounted in 1st kernel
23ef29
to_mount() {
23ef29
    local _dev=$1 _source _target _fstype _options _mntopts _pdev
23ef29
23ef29
    _source=$(findmnt -k -f -n -r -o SOURCE $_dev)
23ef29
    _target=$(get_mntpoint_from_target $_dev)
23ef29
    # mount under /sysroot if dump to root disk or mount under
23ef29
    #/kdumproot/$_target in other cases in 2nd kernel. systemd
23ef29
    #will be in charge to umount it.
23ef29
23ef29
    if [ "$_target" = "/" ];then
23ef29
        _target="/sysroot"
23ef29
    else
23ef29
        _target="/kdumproot/$_target"
23ef29
    fi
23ef29
23ef29
    _fstype=$(findmnt -k -f -n -r -o FSTYPE $_dev)
23ef29
    [[ -e /etc/fstab ]] && _options=$(findmnt --fstab -f -n -r -o OPTIONS $_dev)
23ef29
    [ -z "$_options" ] && _options=$(findmnt -k -f -n -r -o OPTIONS $_dev)
23ef29
    # with 'noauto' in fstab nfs and non-root disk mount will fail in 2nd
23ef29
    # kernel, filter it out here.
23ef29
    _options=$(echo $_options | sed 's/noauto//')
23ef29
    _options=${_options/#ro/rw} #mount fs target as rw in 2nd kernel
23ef29
    # "x-initrd.mount" mount failure will trigger isolate emergency service
23ef29
    # W/o this, systemd won't isolate, thus we won't get to emergency.
23ef29
    # This is not applicable to remote fs mount, because if we use
23ef29
    # "x-initrd.mount", remote mount will become required by
23ef29
    # "initrd-root-fs.target", instead of "remote-fs.target". That's how it is
23ef29
    # handled within systemd internal. We need remote mount to be required
23ef29
    # "remote-fs.target", because we need to bring up network before any remote
23ef29
    # mount and "remote-fs.target" can be a checkpoint of that.
23ef29
    # If remote mount fails, dracut-initqueue will still start and once
23ef29
    # dracut-initqueue finishes, kdump service will start. Because remote mount
23ef29
    # failed, kdump service will fail and it will lead to kdump error handler.
23ef29
    if ! is_nfs_dump_target; then
23ef29
       _options="$_options,x-initrd.mount"
23ef29
    fi
23ef29
    _mntopts="$_target $_fstype $_options"
23ef29
    #for non-nfs _dev converting to use udev persistent name
23ef29
    if [ -b "$_source" ]; then
23ef29
        _pdev="$(kdump_get_persistent_dev $_source $_fstype)"
23ef29
        if [ $? -ne 0 ]; then
23ef29
            return 1
23ef29
        fi
23ef29
23ef29
    else
23ef29
        _pdev=$_dev
23ef29
    fi
23ef29
23ef29
    echo "$_pdev $_mntopts"
23ef29
}
23ef29
23ef29
is_readonly_mount() {
23ef29
    local _mnt
23ef29
    _mnt=$(findmnt -k -f -n -r -o OPTIONS $1)
23ef29
23ef29
    #fs/proc_namespace.c: show_mountinfo():
23ef29
    #seq_puts(m, mnt->mnt_flags & MNT_READONLY ? " ro" : " rw");
23ef29
    [[ "$_mnt" =~ ^ro ]]
23ef29
}
23ef29
23ef29
#Function: get_ssh_size
23ef29
#$1=dump target
23ef29
#called from while loop and shouldn't read from stdin, so we're using "ssh -n"
23ef29
get_ssh_size() {
23ef29
    local _opt _out _size
23ef29
    _opt="-i $SSH_KEY_LOCATION -o BatchMode=yes -o StrictHostKeyChecking=yes"
23ef29
    _out=$(ssh -q -n $_opt $1 "df -P $SAVE_PATH")
23ef29
    [ $? -ne 0 ] && {
23ef29
        perror_exit "checking remote ssh server available size failed."
23ef29
    }
23ef29
23ef29
    #ssh output removed the line break, so print field NF-2
23ef29
    _size=$(echo -n $_out| awk '{avail=NF-2; print $avail}')
23ef29
    echo -n $_size
23ef29
}
23ef29
23ef29
#mkdir if save path does not exist on ssh dump target
23ef29
#$1=ssh dump target
23ef29
#caller should ensure write permission on $DUMP_TARGET:$SAVE_PATH
23ef29
#called from while loop and shouldn't read from stdin, so we're using "ssh -n"
23ef29
mkdir_save_path_ssh()
23ef29
{
23ef29
    local _opt _dir
23ef29
    _opt="-i $SSH_KEY_LOCATION -o BatchMode=yes -o StrictHostKeyChecking=yes"
23ef29
    ssh -qn $_opt $1 mkdir -p $SAVE_PATH 2>&1 > /dev/null
23ef29
    _ret=$?
23ef29
    if [ $_ret -ne 0 ]; then
23ef29
        perror_exit "mkdir failed on $DUMP_TARGET:$SAVE_PATH"
23ef29
    fi
23ef29
23ef29
    #check whether user has write permission on $SAVE_PATH/$DUMP_TARGET
23ef29
    _dir=$(ssh -qn $_opt $1 mktemp -dqp $SAVE_PATH 2>/dev/null)
23ef29
    _ret=$?
23ef29
    if [ $_ret -ne 0 ]; then
23ef29
        perror_exit "Could not create temporary directory on $DUMP_TARGET:$SAVE_PATH. Make sure user has write permission on destination"
23ef29
    fi
23ef29
    ssh -qn $_opt $1 rmdir $_dir
23ef29
23ef29
    return 0
23ef29
}
23ef29
23ef29
#Function: get_fs_size
23ef29
#$1=dump target
23ef29
get_fs_size() {
23ef29
    local _mnt=$(get_mntpoint_from_target $1)
23ef29
    echo -n $(df -P "${_mnt}/$SAVE_PATH"|tail -1|awk '{print $4}')
23ef29
}
23ef29
23ef29
#Function: get_raw_size
23ef29
#$1=dump target
23ef29
get_raw_size() {
23ef29
        echo -n $(fdisk -s "$1")
23ef29
}
23ef29
23ef29
#Function: check_size
23ef29
#$1: dump type string ('raw', 'fs', 'ssh')
23ef29
#$2: dump target
23ef29
check_size() {
23ef29
    local avail memtotal
23ef29
23ef29
    memtotal=$(awk '/MemTotal/{print $2}' /proc/meminfo)
23ef29
    case "$1" in
23ef29
        raw)
23ef29
            avail=$(get_raw_size "$2")
23ef29
            ;;
23ef29
        ssh)
23ef29
            avail=$(get_ssh_size "$2")
23ef29
            ;;
23ef29
        fs)
23ef29
            avail=$(get_fs_size "$2")
23ef29
            ;;
23ef29
        *)
23ef29
            return
23ef29
    esac
23ef29
23ef29
    if [ $? -ne 0 ]; then
23ef29
            perror_exit "Check dump target size failed"
23ef29
    fi
23ef29
23ef29
    if [ $avail -lt $memtotal ]; then
23ef29
        echo "Warning: There might not be enough space to save a vmcore."
23ef29
        echo "         The size of $2 should be greater than $memtotal kilo bytes."
23ef29
    fi
23ef29
}
23ef29
23ef29
# $1: core_collector config value
23ef29
verify_core_collector() {
23ef29
    if grep -q "^raw" $conf_file && [ "${1%% *}" != "makedumpfile" ]; then
23ef29
        echo "Warning: specifying a non-makedumpfile core collector, you will have to recover the vmcore manually."
23ef29
    fi
23ef29
    if is_ssh_dump_target || is_raw_dump_target; then
23ef29
        if [ "${1%% *}" = "makedumpfile" ]; then
23ef29
            ! strstr "$1" "-F" && {
23ef29
                perror_exit "The specified dump target needs makedumpfile \"-F\" option."
23ef29
            }
23ef29
        fi
23ef29
    fi
23ef29
}
23ef29
23ef29
add_mount() {
23ef29
    if ! target_is_root "$1"; then
23ef29
        local _mnt=$(to_mount "$1")
23ef29
        if [ $? -ne 0 ]; then
23ef29
            exit 1
23ef29
        fi
23ef29
        add_dracut_mount "$_mnt"
23ef29
    fi
23ef29
}
23ef29
23ef29
# get_maj_min <device>
23ef29
# Prints the major and minor of a device node.
23ef29
# Example:
23ef29
# $ get_maj_min /dev/sda2
23ef29
# 8:2
23ef29
get_maj_min() {
23ef29
    local _dev
23ef29
    _dev=$(stat -L -c '$((0x%t)):$((0x%T))' "$1" 2>/dev/null)
23ef29
    _dev=$(eval "echo $_dev")
23ef29
    echo $_dev
23ef29
}
23ef29
23ef29
# ugly workaround for the lvm design
23ef29
# There is no volume group device,
23ef29
# so, there are no slave devices for volume groups.
23ef29
# Logical volumes only have the slave devices they really live on,
23ef29
# but you cannot create the logical volume without the volume group.
23ef29
# And the volume group might be bigger than the devices the LV needs.
23ef29
check_vol_slaves() {
23ef29
    local _lv _vg _pv
23ef29
    for i in /dev/mapper/*; do
23ef29
        _lv=$(get_maj_min $i)
23ef29
        if [[ $_lv = $2 ]]; then
23ef29
            _vg=$(lvm lvs --noheadings -o vg_name $i 2>/dev/null)
23ef29
            # strip space
23ef29
            _vg=$(echo $_vg)
23ef29
            if [[ $_vg ]]; then
23ef29
                for _pv in $(lvm vgs --noheadings -o pv_name "$_vg" 2>/dev/null)
23ef29
                do
23ef29
                    check_block_and_slaves $1 $(get_maj_min $_pv) && return 0
23ef29
                done
23ef29
            fi
23ef29
        fi
23ef29
    done
23ef29
    return 1
23ef29
}
23ef29
23ef29
# Walk all the slave relationships for a given block device.
23ef29
# Stop when our helper function returns success
23ef29
# $1 = function to call on every found block device
23ef29
# $2 = block device in major:minor format
23ef29
check_block_and_slaves() {
23ef29
    local _x
23ef29
    [[ -b /dev/block/$2 ]] || return 1 # Not a block device? So sorry.
23ef29
    "$1" $2 && return
23ef29
    check_vol_slaves "$@" && return 0
23ef29
    if [[ -f /sys/dev/block/$2/../dev ]]; then
23ef29
        check_block_and_slaves $1 $(cat "/sys/dev/block/$2/../dev") && return 0
23ef29
    fi
23ef29
    [[ -d /sys/dev/block/$2/slaves ]] || return 1
23ef29
    for _x in /sys/dev/block/$2/slaves/*/dev; do
23ef29
        [[ -f $_x ]] || continue
23ef29
        check_block_and_slaves $1 $(cat "$_x") && return 0
23ef29
    done
23ef29
    return 1
23ef29
}
23ef29
23ef29
get_block_dump_target()
23ef29
{
23ef29
    local _target
23ef29
23ef29
23ef29
    _target=$(get_user_configured_dump_disk)
23ef29
    [ -n "$_target" ] && echo $(to_dev_name $_target) && return
23ef29
23ef29
    #get rootfs device name
23ef29
    _target=$(get_root_fs_device)
23ef29
    [ -b "$_target" ] && echo $(to_dev_name $_target)
23ef29
}
23ef29
23ef29
#handle the case user does not specify the dump target explicitly
23ef29
handle_default_dump_target()
23ef29
{
23ef29
    local _target
23ef29
    local _mntpoint
23ef29
    local _fstype
23ef29
23ef29
    is_user_configured_dump_target && return
23ef29
23ef29
    check_save_path_fs $SAVE_PATH
23ef29
23ef29
    _mntpoint=$(get_mntpoint_from_path $SAVE_PATH)
23ef29
    _target=$(get_target_from_path $SAVE_PATH)
23ef29
23ef29
    if is_atomic && is_bind_mount $_mntpoint; then
23ef29
        SAVE_PATH=${SAVE_PATH##"$_mntpoint"}
23ef29
        # the real dump path in the 2nd kernel, if the mount point is bind mounted.
23ef29
        SAVE_PATH=$(get_bind_mount_directory $_mntpoint)/$SAVE_PATH
23ef29
        _mntpoint=$(get_mntpoint_from_target $_target)
23ef29
23ef29
        # the absolute path in the 1st kernel
23ef29
        SAVE_PATH=$_mntpoint/$SAVE_PATH
23ef29
    fi
23ef29
23ef29
    if [ "$_mntpoint" != "/" ]; then
23ef29
        SAVE_PATH=${SAVE_PATH##"$_mntpoint"}
23ef29
        _fstype=$(get_fs_type_from_target $_target)
23ef29
23ef29
        add_mount "$_target"
23ef29
        check_size fs $_target
23ef29
    fi
23ef29
}
23ef29
23ef29
get_default_action_target()
23ef29
{
23ef29
    local _target
23ef29
    local _action=$(grep "^default" /etc/kdump.conf 2>/dev/null | awk '{print $2}')
23ef29
    if [ -n "$_action" ] && [ "$_action" = "dump_to_rootfs" ]; then
23ef29
        #get rootfs device name
23ef29
        _target=$(findmnt -k -f -n -o SOURCE /)
23ef29
        [ -b "$_target" ] && echo $(to_dev_name $_target)
23ef29
    fi
23ef29
    return
23ef29
}
23ef29
23ef29
get_override_resettable()
23ef29
{
23ef29
    local override_resettable
23ef29
23ef29
    override_resettable=$(grep "^override_resettable" $conf_file)
23ef29
    if [ -n "$override_resettable" ]; then
23ef29
        OVERRIDE_RESETTABLE=$(echo $override_resettable | cut -d' '  -f2)
23ef29
        if [ "$OVERRIDE_RESETTABLE" != "0" ] && [ "$OVERRIDE_RESETTABLE" != "1" ];then
23ef29
            perror_exit "override_resettable value $OVERRIDE_RESETTABLE is invalid"
23ef29
        fi
23ef29
    fi
23ef29
}
23ef29
23ef29
23ef29
# $1: function name
23ef29
for_each_block_target()
23ef29
{
23ef29
    local dev majmin
23ef29
23ef29
    #check dump target
23ef29
    dev=$(get_block_dump_target)
23ef29
23ef29
    if [ -n "$dev" ]; then
23ef29
        majmin=$(get_maj_min $dev)
23ef29
        check_block_and_slaves $1 $majmin && return 1
23ef29
    fi
23ef29
23ef29
    #check rootfs when default action dump_to_rootfs is set
23ef29
    dev=$(get_default_action_target)
23ef29
    if [ -n "$dev" ]; then
23ef29
        majmin=$(get_maj_min $dev)
23ef29
        check_block_and_slaves $1 $majmin && return 2
23ef29
    fi
23ef29
23ef29
    return 0
23ef29
}
23ef29
23ef29
23ef29
23ef29
#judge if a specific device with $1 is unresettable
23ef29
#return false if unresettable.
23ef29
is_unresettable()
23ef29
{
23ef29
    local path="/sys/$(udevadm info --query=all --path=/sys/dev/block/$1 | awk '/^P:/ {print $2}' | sed -e 's/\(cciss[0-9]\+\/\).*/\1/g' -e 's/\/block\/.*$//')/resettable"
23ef29
    local resettable=1
23ef29
23ef29
    if [ -f "$path" ]
23ef29
    then
23ef29
        resettable="$(cat $path)"
23ef29
        [ $resettable -eq 0 -a "$OVERRIDE_RESETTABLE" -eq 0 ] && {
23ef29
            local device=$(udevadm info --query=all --path=/sys/dev/block/$1 | awk -F= '/DEVNAME/{print $2}')
23ef29
            echo "Device $device is unresettable"
23ef29
            return 0
23ef29
        }
23ef29
    fi
23ef29
23ef29
    return 1
23ef29
}
23ef29
23ef29
#check if machine is resettable.
23ef29
#return true if resettable
23ef29
check_resettable()
23ef29
{
23ef29
    local _ret _target
23ef29
23ef29
    get_override_resettable
23ef29
23ef29
    for_each_block_target is_unresettable
23ef29
    _ret=$?
23ef29
23ef29
    [ $_ret -eq 0 ] && return
23ef29
23ef29
    if [ $_ret -eq 1 ]; then
23ef29
        _target=$(get_block_dump_target)
23ef29
        perror "Can not save vmcore to target device $_target . This device can not be initialized in kdump kernel as it is not resettable"
23ef29
    elif [ $_ret -eq 2 ]; then
23ef29
        _target=$(get_default_action_target)
23ef29
        perror "Rootfs device $_target is not resettable, can not be used as the default target, please specify a default action"
23ef29
    fi
23ef29
23ef29
    return 1
23ef29
}
23ef29
23ef29
# $1: maj:min
23ef29
is_crypt()
23ef29
{
23ef29
    local majmin=$1 dev line ID_FS_TYPE=""
23ef29
23ef29
    line=$(udevadm info --query=property --path=/sys/dev/block/$majmin \
23ef29
            | grep "^ID_FS_TYPE")
23ef29
    eval "$line"
23ef29
    [[ "$ID_FS_TYPE" = "crypto_LUKS" ]] && {
23ef29
        dev=$(udevadm info --query=all --path=/sys/dev/block/$majmin | awk -F= '/DEVNAME/{print $2}')
23ef29
        echo "Device $dev is encrypted."
23ef29
        return 0
23ef29
    }
23ef29
    return 1
23ef29
}
23ef29
23ef29
check_crypt()
23ef29
{
23ef29
    local _ret _target
23ef29
23ef29
    for_each_block_target is_crypt
23ef29
    _ret=$?
23ef29
23ef29
    [ $_ret -eq 0 ] && return
23ef29
23ef29
    return 1
23ef29
}
23ef29
23ef29
if ! check_resettable; then
23ef29
    exit 1
23ef29
fi
23ef29
23ef29
if ! check_crypt; then
23ef29
    echo "Warning: Encrypted device is in dump path. User will prompted for password during second kernel boot."
23ef29
fi
23ef29
23ef29
# firstly get right SSH_KEY_LOCATION
23ef29
keyfile=$(awk '/^sshkey/ {print $2}' $conf_file)
23ef29
if [ -f "$keyfile" ]; then
23ef29
    # canonicalize the path
23ef29
    SSH_KEY_LOCATION=$(/usr/bin/readlink -m $keyfile)
23ef29
fi
23ef29
23ef29
if [ "$(uname -m)" = "s390x" ]; then
23ef29
    add_dracut_module "znet"
23ef29
fi
23ef29
23ef29
while read config_opt config_val;
23ef29
do
23ef29
    # remove inline comments after the end of a directive.
23ef29
    config_val=$(strip_comments $config_val)
23ef29
    case "$config_opt" in
23ef29
    extra_modules)
23ef29
        extra_modules="$extra_modules $config_val"
23ef29
        ;;
23ef29
    ext[234]|xfs|btrfs|minix|nfs)
23ef29
        if ! findmnt $config_val >/dev/null; then
23ef29
            perror_exit "Dump target $config_val is probably not mounted."
23ef29
        fi
23ef29
23ef29
        _absolute_save_path=$(make_absolute_save_path $config_val)
23ef29
        _mntpoint=$(get_mntpoint_from_path $_absolute_save_path)
23ef29
        if is_atomic && is_bind_mount $_mntpoint; then
23ef29
            SAVE_PATH=${_absolute_save_path##"$_mntpoint"}
23ef29
            # the real dump path in the 2nd kernel, if the mount point is bind mounted.
23ef29
            SAVE_PATH=$(get_bind_mount_directory $_mntpoint)/$SAVE_PATH
23ef29
        fi
23ef29
23ef29
        add_mount "$config_val"
23ef29
        check_save_path_fs $_absolute_save_path
23ef29
        check_size fs $config_val
23ef29
        ;;
23ef29
    raw)
23ef29
        #checking raw disk writable
23ef29
        dd if=$config_val count=1 of=/dev/null > /dev/null 2>&1 || {
23ef29
            perror_exit "Bad raw disk $config_val"
23ef29
        }
23ef29
        _praw=$(kdump_get_persistent_dev $config_val "raw")
23ef29
        if [ $? -ne 0 ]; then
23ef29
            exit 1
23ef29
        fi
23ef29
        add_dracut_arg "--device" "$_praw"
23ef29
        check_size raw $config_val
23ef29
        ;;
23ef29
    ssh)
23ef29
        if strstr "$config_val" "@";
23ef29
        then
23ef29
            check_size ssh $config_val
23ef29
            mkdir_save_path_ssh $config_val
23ef29
            add_dracut_module "ssh-client"
23ef29
		add_dracut_sshkey "$SSH_KEY_LOCATION"
23ef29
        else
23ef29
            perror_exit "Bad ssh dump target $config_val"
23ef29
        fi
23ef29
        ;;
23ef29
    core_collector)
23ef29
        verify_core_collector "$config_val"
23ef29
        ;;
23ef29
    dracut_args)
23ef29
        add_dracut_arg $config_val
23ef29
        ;;
23ef29
    *)
23ef29
        if [ -n $(echo $config_opt | grep "^#.*$") ]
23ef29
        then
23ef29
            continue
23ef29
        fi
23ef29
        ;;
23ef29
    esac
23ef29
done < $conf_file
23ef29
23ef29
handle_default_dump_target
23ef29
23ef29
if [ -n "$extra_modules" ]
23ef29
then
23ef29
    add_dracut_arg "--add-drivers" "$extra_modules"
23ef29
fi
23ef29
23ef29
dracut "${dracut_args[@]}" "$@"
23ef29
_rc=$?
23ef29
sync
23ef29
exit $_rc