Your IP : 216.73.217.94


Current Path : /home2/noxxprod/www/c52d7/
Upload File :
Current File : //home2/noxxprod/www/c52d7/95iscsi.tar

cleanup-iscsi.sh000075500000000306152726047370007656 0ustar00#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

[ -z "${DRACUT_SYSTEMD}" ] && [ -e /sys/module/bnx2i ] && killproc iscsiuio

parse-iscsiroot.sh000075500000012306152726047370010250 0ustar00#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
#
# Preferred format:
#       root=iscsi:[<servername>]:[<protocol>]:[<port>]:[<LUN>]:<targetname>
#       [root=*] netroot=iscsi:[<servername>]:[<protocol>]:[<port>]:[<LUN>]:<targetname>
#
# Legacy formats:
#       [net]root=[iscsi] iscsiroot=[<servername>]:[<protocol>]:[<port>]:[<LUN>]:<targetname>
#       [net]root=[iscsi] iscsi_firmware
#
# root= takes precedence over netroot= if root=iscsi[...]
#

# This script is sourced, so root should be set. But let's be paranoid
[ -z "$root" ] && root=$(getarg root=)
if [ -z "$netroot" ]; then
    for nroot in $(getargs netroot=); do
        [ "${nroot%%:*}" = "iscsi" ] && break
    done
    if [ "${nroot%%:*}" = "iscsi" ]; then
        netroot="$nroot"
    else
        for nroot in $(getargs netroot=); do
            [ "${nroot%%:*}" = "dhcp" ] && break
        done
        netroot="$nroot"
    fi
fi
[ -z "$iscsiroot" ] && iscsiroot=$(getarg iscsiroot=)
[ -z "$iscsi_firmware" ] && getargbool 0 rd.iscsi.firmware -y iscsi_firmware && iscsi_firmware="1"

[ -n "$iscsiroot" ] && [ -n "$iscsi_firmware" ] && die "Mixing iscsiroot and iscsi_firmware is dangerous"

type write_fs_tab >/dev/null 2>&1 || . /lib/fs-lib.sh

# Root takes precedence over netroot
if [ "${root%%:*}" = "iscsi" ] ; then
    if [ -n "$netroot" ] ; then
        echo "Warning: root takes precedence over netroot. Ignoring netroot"
    fi
    netroot=$root
    # if root is not specified try to mount the whole iSCSI LUN
    printf 'ENV{DEVTYPE}!="partition", SYMLINK=="disk/by-path/*-iscsi-*-*", SYMLINK+="root"\n' >> /etc/udev/rules.d/99-iscsi-root.rules
    root=/dev/root

    write_fs_tab /dev/root
fi

# If it's not empty or iscsi we don't continue
for nroot in $(getargs netroot); do
    [ "${nroot%%:*}" = "iscsi" ] || continue
    netroot="$nroot"
    break
done

if [ -n "$iscsiroot" ] ; then
    [ -z "$netroot" ]  && netroot=$root

    # @deprecated
    echo "Warning: Argument iscsiroot is deprecated and might be removed in a future"
    echo "release. See 'man dracut.kernel' for more information."

    # Accept iscsiroot argument?
    [ -z "$netroot" ] || [ "$netroot" = "iscsi" ] || \
        die "Argument iscsiroot only accepted for empty root= or [net]root=iscsi"

    # Override root with iscsiroot content?
    [ -z "$netroot" ] || [ "$netroot" = "iscsi" ] && netroot=iscsi:$iscsiroot
fi

# iscsi_firmware does not need argument checking
if [ -n "$iscsi_firmware" ]; then
    if [ "$root" != "dhcp" ] && [ "$netroot" != "dhcp" ]; then
        [ -z "$netroot" ] && netroot=iscsi:
    fi
    modprobe -b -q iscsi_boot_sysfs 2>/dev/null
    modprobe -b -q iscsi_ibft
    # if no ip= is given, but firmware
    echo "[ -f '/tmp/iscsistarted-firmware' ]" > $hookdir/initqueue/finished/iscsi_started.sh
    initqueue --unique --online /sbin/iscsiroot online "iscsi:" "$NEWROOT"
    initqueue --unique --onetime --timeout /sbin/iscsiroot timeout "iscsi:" "$NEWROOT"
    initqueue --unique --onetime --settled /sbin/iscsiroot online "iscsi:" "'$NEWROOT'"
fi

if [ -z "$netroot" ] || ! [ "${netroot%%:*}" = "iscsi" ]; then
    return 1
fi

initqueue --unique --onetime --timeout /sbin/iscsiroot timeout "$netroot" "$NEWROOT"
initqueue --onetime modprobe --all -b -q qla4xxx cxgb3i cxgb4i bnx2i be2iscsi

# ISCSI actually supported?
if ! [ -e /sys/module/iscsi_tcp ]; then
    modprobe -b -q iscsi_tcp || die "iscsiroot requested but kernel/initrd does not support iscsi"
fi

if [ -n "$netroot" ] && [ "$root" != "/dev/root" ] && [ "$root" != "dhcp" ]; then
    if ! getargbool 1 rd.neednet >/dev/null || ! getarg "ip="; then
        initqueue --unique --onetime --settled /sbin/iscsiroot dummy "'$netroot'" "'$NEWROOT'"
    fi
fi

if arg=$(getarg rd.iscsi.initiator -d iscsi_initiator=) && [ -n "$arg" ] && ! [ -f /run/initiatorname.iscsi ] ; then
    iscsi_initiator=$arg
    echo "InitiatorName=$iscsi_initiator" > /run/initiatorname.iscsi
    ln -fs /run/initiatorname.iscsi /dev/.initiatorname.iscsi
    if ! [ -e /etc/iscsi/initiatorname.iscsi ]; then
        mkdir -p /etc/iscsi
        ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi
    fi
fi

# If not given on the cmdline and initiator-name available via iBFT
if [ -z $iscsi_initiator ] && [ -f /sys/firmware/ibft/initiator/initiator-name ] && ! [ -f /tmp/iscsi_set_initiator ]; then
    iscsi_initiator=$(while read line || [ -n "$line" ]; do echo $line;done < /sys/firmware/ibft/initiator/initiator-name)
    if [ -n "$iscsi_initiator" ]; then
        echo "InitiatorName=$iscsi_initiator" > /run/initiatorname.iscsi
        rm -f /etc/iscsi/initiatorname.iscsi
        mkdir -p /etc/iscsi
        ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi
        > /tmp/iscsi_set_initiator
        systemctl try-restart iscsid && sleep 1
    fi
fi


for nroot in $(getargs netroot); do
    [ "${nroot%%:*}" = "iscsi" ] || continue
    type parse_iscsi_root >/dev/null 2>&1 || . /lib/net-lib.sh
    parse_iscsi_root "$nroot" || return 1
    netroot_enc=$(str_replace "$nroot" '/' '\2f')
    echo "[ -f '/tmp/iscsistarted-$netroot_enc' ]" > $hookdir/initqueue/finished/iscsi_started.sh
done

# Done, all good!
rootok=1

# Shut up init error check
[ -z "$root" ] && root="iscsi"
iscsiroot.sh000075500000023532152726047370007143 0ustar00#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
#
# This implementation is incomplete: Discovery mode is not implemented and
# the argument handling doesn't follow currently agreed formats. This is mainly
# because rfc4173 does not say anything about iscsi_initiator but open-iscsi's
# iscsistart needs this.
#

type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
type parse_iscsi_root >/dev/null 2>&1 || . /lib/net-lib.sh
type write_fs_tab >/dev/null 2>&1 || . /lib/fs-lib.sh

PATH=/usr/sbin:/usr/bin:/sbin:/bin

# Huh? Empty $1?
[ -z "$1" ] && exit 1

# Huh? Empty $2?
[ -z "$2" ] && exit 1

# Huh? Empty $3? This isn't really necessary, since NEWROOT isn't
# used here. But let's be consistent
[ -z "$3" ] && exit 1

# root is in the form root=iscsi:[<servername>]:[<protocol>]:[<port>]:[<LUN>]:<targetname>
netif="$1"
iroot="$2"

# If it's not iscsi we don't continue
[ "${iroot%%:*}" = "iscsi" ] || exit 1

iroot=${iroot#iscsi}
iroot=${iroot#:}

# XXX modprobe crc32c should go in the cmdline parser, but I haven't yet
# figured out a way how to check whether this is built-in or not
modprobe crc32c 2>/dev/null

if [ -z "${DRACUT_SYSTEMD}" ] && [ -e /sys/module/bnx2i ] && ! [ -e /tmp/iscsiuio-started ]; then
        iscsiuio
        > /tmp/iscsiuio-started
fi

handle_firmware()
{
    if ! iscsistart -f; then
        warn "iscistart: Could not get list of targets from firmware. Skipping."
        echo 'skipped' > "/tmp/iscsistarted-firmware"
        return 0
    fi

    for p in $(getargs rd.iscsi.param -d iscsi_param); do
	iscsi_param="$iscsi_param --param $p"
    done

    if ! iscsistart -b $iscsi_param; then
        warn "'iscsistart -b $iscsi_param' failed with return code $?"
    fi

    echo 'started' > "/tmp/iscsistarted-iscsi:"
    echo 'started' > "/tmp/iscsistarted-firmware"

    need_shutdown
    return 0
}


handle_netroot()
{
    local iscsi_initiator iscsi_target_name iscsi_target_ip iscsi_target_port
    local iscsi_target_group iscsi_protocol iscsirw iscsi_lun
    local iscsi_username iscsi_password
    local iscsi_in_username iscsi_in_password
    local iscsi_iface_name iscsi_netdev_name
    local iscsi_param
    local p

    # override conf settings by command line options
    arg=$(getargs rd.iscsi.initiator -d iscsi_initiator=)
    [ -n "$arg" ] && iscsi_initiator="$arg"
    arg=$(getargs rd.iscsi.target.name -d iscsi_target_name=)
    [ -n "$arg" ] && iscsi_target_name="$arg"
    arg=$(getargs rd.iscsi.target.ip -d iscsi_target_ip)
    [ -n "$arg" ] && iscsi_target_ip="$arg"
    arg=$(getargs rd.iscsi.target.port -d iscsi_target_port=)
    [ -n "$arg" ] && iscsi_target_port="$arg"
    arg=$(getargs rd.iscsi.target.group -d iscsi_target_group=)
    [ -n "$arg" ] && iscsi_target_group="$arg"
    arg=$(getargs rd.iscsi.username -d iscsi_username=)
    [ -n "$arg" ] && iscsi_username="$arg"
    arg=$(getargs rd.iscsi.password -d iscsi_password)
    [ -n "$arg" ] && iscsi_password="$arg"
    arg=$(getargs rd.iscsi.in.username -d iscsi_in_username=)
    [ -n "$arg" ] && iscsi_in_username="$arg"
    arg=$(getargs rd.iscsi.in.password -d iscsi_in_password=)
    [ -n "$arg" ] && iscsi_in_password="$arg"
    for p in $(getargs rd.iscsi.param -d iscsi_param); do
	iscsi_param="$iscsi_param --param $p"
    done

    parse_iscsi_root "$1" || return 1

    # Bail out early, if there is no route to the destination
    if is_ip "$iscsi_target_ip" && [ "$netif" != "timeout" ] && ! all_ifaces_setup && getargbool 1 rd.iscsi.testroute; then
        ip route get "$iscsi_target_ip" >/dev/null 2>&1 || return 0
    fi

# XXX is this needed?
    getarg ro && iscsirw=ro
    getarg rw && iscsirw=rw
    fsopts="${fsopts:+$fsopts,}${iscsirw}"

    if [ -z "$iscsi_initiator" ] && [ -f /sys/firmware/ibft/initiator/initiator-name ] && ! [ -f /tmp/iscsi_set_initiator ]; then
           iscsi_initiator=$(while read line || [ -n "$line" ]; do echo $line;done < /sys/firmware/ibft/initiator/initiator-name)
           echo "InitiatorName=$iscsi_initiator" > /run/initiatorname.iscsi
           rm -f /etc/iscsi/initiatorname.iscsi
           mkdir -p /etc/iscsi
           ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi
           systemctl restart iscsid
           sleep 1
           > /tmp/iscsi_set_initiator
    fi

    if [ -z "$iscsi_initiator" ]; then
        [ -f /run/initiatorname.iscsi ] && . /run/initiatorname.iscsi
        [ -f /etc/initiatorname.iscsi ] && . /etc/initiatorname.iscsi
        [ -f /etc/iscsi/initiatorname.iscsi ] && . /etc/iscsi/initiatorname.iscsi
        iscsi_initiator=$InitiatorName
    fi

    if [ -z "$iscsi_initiator" ]; then
        iscsi_initiator=$(iscsi-iname)
        echo "InitiatorName=$iscsi_initiator" > /run/initiatorname.iscsi
        rm -f /etc/iscsi/initiatorname.iscsi
        mkdir -p /etc/iscsi
        ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi
        systemctl restart iscsid
        > /tmp/iscsi_set_initiator
        # FIXME: iscsid is not yet ready, when the service is :-/
        sleep 1
    fi


    if [ -z $iscsi_target_port ]; then
        iscsi_target_port=3260
    fi

    if [ -z $iscsi_target_group ]; then
        iscsi_target_group=1
    fi

    if [ -z $iscsi_lun ]; then
        iscsi_lun=0
    fi

    echo "InitiatorName=$iscsi_initiator" > /run/initiatorname.iscsi
    ln -fs /run/initiatorname.iscsi /dev/.initiatorname.iscsi
    if ! [ -e /etc/iscsi/initiatorname.iscsi ]; then
        mkdir -p /etc/iscsi
        ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi
    fi
# FIXME $iscsi_protocol??

    if [ "$root" = "dhcp" ] || [ "$netroot" = "dhcp" ]; then
        # if root is not specified try to mount the whole iSCSI LUN
        printf 'SYMLINK=="disk/by-path/*-iscsi-*-%s", SYMLINK+="root"\n' "${iscsi_lun//\"/}" >> /etc/udev/rules.d/99-iscsi-root.rules
        udevadm control --reload
        write_fs_tab /dev/root
        wait_for_dev -n /dev/root

        # install mount script
        [ -z "$DRACUT_SYSTEMD" ] && \
            printf 'iscsi_lun=%q . /bin/mount-lun.sh\n' "$iscsi_lun" > "$hookdir"/mount/01-$$-iscsi.sh
    fi

    if [ -n "$DRACUT_SYSTEMD" ] && command -v systemd-run >/dev/null 2>&1; then
        netroot_enc=$(systemd-escape "iscsistart_${1}")
        status=$(systemctl is-active "$netroot_enc" 2>/dev/null)
        is_active=$?
        if [ $is_active -ne 0 ]; then
            if [ "$status" != "activating" ] && ! systemctl is-failed "$netroot_enc" >/dev/null 2>&1; then
                systemd-run --service-type=oneshot --remain-after-exit --quiet \
                            --description="Login iSCSI Target $iscsi_target_name" \
                            -p 'DefaultDependencies=no' \
                            --unit="$netroot_enc" -- \
                            $(command -v iscsistart) \
                            -i "$iscsi_initiator" -t "$iscsi_target_name"        \
                            -g "$iscsi_target_group" -a "$iscsi_target_ip"      \
                            -p "$iscsi_target_port" \
                            ${iscsi_username:+-u "$iscsi_username"} \
                            ${iscsi_password:+-w "$iscsi_password"} \
                            ${iscsi_in_username:+-U "$iscsi_in_username"} \
                            ${iscsi_in_password:+-W "$iscsi_in_password"} \
	                    ${iscsi_iface_name:+--param "iface.iscsi_ifacename=$iscsi_iface_name"} \
	                    ${iscsi_netdev_name:+--param "iface.net_ifacename=$iscsi_netdev_name"} \
                            ${iscsi_param} >/dev/null 2>&1 \
	            && { > $hookdir/initqueue/work ; }
                while : ; do
                    status=$(systemctl is-active "$netroot_enc" 2>/dev/null)
                    [ "$status" != "activating" ] && break
                    sleep 1
                done
            else
                systemctl --no-block restart "$netroot_enc" >/dev/null 2>&1 \
	            && { > $hookdir/initqueue/work ; }
            fi
        fi
    else
        iscsistart -i "$iscsi_initiator" -t "$iscsi_target_name"        \
                   -g "$iscsi_target_group" -a "$iscsi_target_ip"      \
                   -p "$iscsi_target_port" \
                   ${iscsi_username:+-u "$iscsi_username"} \
                   ${iscsi_password:+-w "$iscsi_password"} \
                   ${iscsi_in_username:+-U "$iscsi_in_username"} \
                   ${iscsi_in_password:+-W "$iscsi_in_password"} \
	           ${iscsi_iface_name:+--param "iface.iscsi_ifacename=$iscsi_iface_name"} \
	           ${iscsi_netdev_name:+--param "iface.net_ifacename=$iscsi_netdev_name"} \
                   ${iscsi_param} \
	    && { > $hookdir/initqueue/work ; }
    fi
    netroot_enc=$(str_replace "$1" '/' '\2f')
    echo 'started' > "/tmp/iscsistarted-iscsi:${netroot_enc}"
    return 0
}

ret=0

if [ "$netif" != "timeout" ] && getargbool 1 rd.iscsi.waitnet; then
    all_ifaces_setup || exit 0
fi

if [ "$netif" = "timeout" ] && all_ifaces_setup; then
    # s.th. went wrong and the timeout script hits
    # restart
    systemctl restart iscsid
    # damn iscsid is not ready after unit says it's ready
    sleep 2
fi

if getargbool 0 rd.iscsi.firmware -d -y iscsi_firmware ; then
    if [ "$netif" = "timeout" ] || [ "$netif" = "online" ]; then
        handle_firmware
        ret=$?
    fi
fi

if ! [ "$netif" = "online" ]; then
    # loop over all netroot parameter
    if nroot=$(getarg netroot) && [ "$nroot" != "dhcp" ]; then
        for nroot in $(getargs netroot); do
            [ "${nroot%%:*}" = "iscsi" ] || continue
            nroot="${nroot##iscsi:}"
            if [ -n "$nroot" ]; then
                handle_netroot "$nroot"
                ret=$(($ret + $?))
            fi
        done
    else
        if [ -n "$iroot" ]; then
            handle_netroot "$iroot"
            ret=$?
        fi
    fi
fi

need_shutdown

# now we have a root filesystem somewhere in /dev/sd*
# let the normal block handler handle root=
exit $ret
module-setup.sh000075500000012756152726047370007556 0ustar00#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

check() {
    local _rootdev
    # If our prerequisites are not met, fail anyways.
    require_binaries iscsistart hostname iscsi-iname || return 1

    # If hostonly was requested, fail the check if we are not actually
    # booting from root.

    is_iscsi() {
        local _dev=$1

        [[ -L "/sys/dev/block/$_dev" ]] || return
        cd "$(readlink -f "/sys/dev/block/$_dev")"
        until [[ -d sys || -d iscsi_session ]]; do
            cd ..
        done
        [[ -d iscsi_session ]]
    }

    [[ $hostonly ]] || [[ $mount_needs ]] && {
        pushd . >/dev/null
        for_each_host_dev_and_slaves is_iscsi
        local _is_iscsi=$?
        popd >/dev/null
        [[ $_is_iscsi == 0 ]] || return 255
    }
    return 0
}

get_ibft_mod() {
    local ibft_mac=$1
    local iface_mac iface_mod
    # Return the iSCSI offload module for a given MAC address
    for iface_desc in $(iscsiadm -m iface | cut -f 2 -d ' '); do
        iface_mod=${iface_desc%%,*}
        iface_mac=${iface_desc#*,}
        iface_mac=${iface_mac%%,*}
        if [ "$ibft_mac" = "$iface_mac" ] ; then
            echo $iface_mod
            return 0
        fi
    done
}

install_ibft() {
    # When iBFT / iscsi_boot is detected:
    # - Use 'ip=ibft' to set up iBFT network interface
    #   Note: bnx2i is using a different MAC address of iSCSI offloading
    #         so the 'ip=ibft' parameter must not be set
    # - specify firmware booting cmdline parameter

    for d in /sys/firmware/* ; do
        if [ -d ${d}/ethernet0 ] ; then
            read ibft_mac < ${d}/ethernet0/mac
            ibft_mod=$(get_ibft_mod $ibft_mac)
        fi
        if [ -z "$ibft_mod" ] && [ -d ${d}/ethernet1 ] ; then
            read ibft_mac < ${d}/ethernet1/mac
            ibft_mod=$(get_ibft_mod $ibft_mac)
        fi
        if [ -d ${d}/initiator ] ; then
            if [ ${d##*/} = "ibft" ] && [ "$ibft_mod" != "bnx2i" ] ; then
                echo -n "ip=ibft "
            fi
            echo -n "rd.iscsi.firmware=1"
        fi
    done
}

depends() {
    echo network rootfs-block
}

installkernel() {
    local _arch=$(uname -m)

    instmods bnx2i qla4xxx cxgb3i cxgb4i be2iscsi
    hostonly="" instmods iscsi_tcp iscsi_ibft crc32c iscsi_boot_sysfs
    iscsi_module_filter() {
        local _funcs='iscsi_register_transport'
        # subfunctions inherit following FDs
        local _merge=8 _side2=9
        function bmf1() {
            local _f
            while read _f; do
                case "$_f" in
                    *.ko)    [[ $(<         $_f) =~ $_funcs ]] && echo "$_f" ;;
                    *.ko.gz) [[ $(gzip -dc <$_f) =~ $_funcs ]] && echo "$_f" ;;
                    *.ko.xz) [[ $(xz -dc   <$_f) =~ $_funcs ]] && echo "$_f" ;;
                esac
            done
            return 0
        }

        function rotor() {
            local _f1 _f2
            while read _f1; do
                echo "$_f1"
                if read _f2; then
                    echo "$_f2" 1>&${_side2}
                fi
            done | bmf1 1>&${_merge}
            return 0
        }
        # Use two parallel streams to filter alternating modules.
        set +x
        eval "( ( rotor ) ${_side2}>&1 | bmf1 ) ${_merge}>&1"
        [[ $debug ]] && set -x
        return 0
    }

    { find_kernel_modules_by_path drivers/scsi; if [ "$_arch" = "s390" -o "$_arch" = "s390x" ]; then find_kernel_modules_by_path drivers/s390/scsi; fi;} \
    | iscsi_module_filter  |  instmods
}

cmdline() {
    install_ibft
}

# called by dracut
install() {
    inst_multiple umount iscsistart hostname iscsi-iname
    inst_multiple -o iscsiuio
    inst_libdir_file 'libgcc_s.so*'

    # Detect iBFT and perform mandatory steps
    if [[ $hostonly_cmdline == "yes" ]] ; then
        local _ibftconf=$(install_ibft)
        [[ $_ibftconf ]] && printf "%s\n" "$_ibftconf" >> "${initdir}/etc/cmdline.d/95iscsi.conf"
    fi

    inst_hook cmdline 90 "$moddir/parse-iscsiroot.sh"
    inst_hook cleanup 90 "$moddir/cleanup-iscsi.sh"
    inst "$moddir/iscsiroot.sh" "/sbin/iscsiroot"
    if ! dracut_module_included "systemd"; then
        inst "$moddir/mount-lun.sh" "/bin/mount-lun.sh"
    else
        inst_multiple -o \
                      $systemdsystemunitdir/iscsi.service \
                      $systemdsystemunitdir/iscsid.service \
                      $systemdsystemunitdir/iscsid.socket \
                      $systemdsystemunitdir/iscsiuio.service \
                      $systemdsystemunitdir/iscsiuio.socket \
                      iscsiadm iscsid

        mkdir -p "${initdir}/$systemdsystemunitdir/sockets.target.wants"
        for i in \
                iscsiuio.socket \
            ; do
            ln_r "$systemdsystemunitdir/${i}" "$systemdsystemunitdir/sockets.target.wants/${i}"
        done

        mkdir -p "${initdir}/$systemdsystemunitdir/basic.target.wants"
        for i in \
                iscsid.service \
            ; do
            ln_r "$systemdsystemunitdir/${i}" "$systemdsystemunitdir/basic.target.wants/${i}"
        done

        # Make sure iscsid is started after dracut-cmdline and ready for the initqueue
        mkdir -p "${initdir}/$systemdsystemunitdir/iscsid.service.d"
        (
            echo "[Unit]"
            echo "After=dracut-cmdline.service"
            echo "Before=dracut-initqueue.service"
        ) > "${initdir}/$systemdsystemunitdir/iscsid.service.d/dracut.conf"
    fi
    inst_dir /var/lib/iscsi
    dracut_need_initqueue
}
mount-lun.sh000075500000000672152726047370007063 0ustar00#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
if [ -z $iscsi_lun ]; then
    iscsi_lun=0
fi
NEWROOT=${NEWROOT:-"/sysroot"}

for disk in /dev/disk/by-path/*-iscsi-*-$iscsi_lun; do
    if mount -t ${fstype:-auto} -o "$rflags" $disk $NEWROOT; then
        if [ ! -d $NEWROOT/proc ]; then
            umount $disk
            continue
        fi
        break
    fi
done