Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/AnonR/anonr.TX.../lib/dracut/modules..../95fcoe
File: module-setup.sh
#!/bin/bash
[0] Fix | Delete
[1] Fix | Delete
# called by dracut
[2] Fix | Delete
check() {
[3] Fix | Delete
is_fcoe() {
[4] Fix | Delete
block_is_fcoe $1 || return 1
[5] Fix | Delete
}
[6] Fix | Delete
[7] Fix | Delete
[[ $hostonly ]] || [[ $mount_needs ]] && {
[8] Fix | Delete
for_each_host_dev_and_slaves is_fcoe || return 255
[9] Fix | Delete
}
[10] Fix | Delete
[11] Fix | Delete
require_binaries dcbtool fipvlan lldpad ip readlink fcoemon fcoeadm || return 1
[12] Fix | Delete
return 0
[13] Fix | Delete
}
[14] Fix | Delete
[15] Fix | Delete
# called by dracut
[16] Fix | Delete
depends() {
[17] Fix | Delete
echo network rootfs-block
[18] Fix | Delete
return 0
[19] Fix | Delete
}
[20] Fix | Delete
[21] Fix | Delete
# called by dracut
[22] Fix | Delete
installkernel() {
[23] Fix | Delete
instmods fcoe libfcoe 8021q edd bnx2fc
[24] Fix | Delete
}
[25] Fix | Delete
[26] Fix | Delete
get_vlan_parent() {
[27] Fix | Delete
local link=$1
[28] Fix | Delete
[29] Fix | Delete
[ -d $link ] || return
[30] Fix | Delete
read iflink < $link/iflink
[31] Fix | Delete
for if in /sys/class/net/* ; do
[32] Fix | Delete
read idx < $if/ifindex
[33] Fix | Delete
if [ $idx -eq $iflink ] ; then
[34] Fix | Delete
echo ${if##*/}
[35] Fix | Delete
fi
[36] Fix | Delete
done
[37] Fix | Delete
}
[38] Fix | Delete
[39] Fix | Delete
# called by dracut
[40] Fix | Delete
cmdline() {
[41] Fix | Delete
{
[42] Fix | Delete
for c in /sys/bus/fcoe/devices/ctlr_* ; do
[43] Fix | Delete
[ -L $c ] || continue
[44] Fix | Delete
read enabled < $c/enabled
[45] Fix | Delete
read mode < $c/mode
[46] Fix | Delete
[ $enabled -eq 0 ] && continue
[47] Fix | Delete
if [ $mode = "VN2VN" ] ; then
[48] Fix | Delete
mode="vn2vn"
[49] Fix | Delete
else
[50] Fix | Delete
mode="fabric"
[51] Fix | Delete
fi
[52] Fix | Delete
d=$(cd -P $c; echo $PWD)
[53] Fix | Delete
i=${d%/*}
[54] Fix | Delete
ifname=${i##*/}
[55] Fix | Delete
read mac < ${i}/address
[56] Fix | Delete
s=$(dcbtool gc ${i##*/} dcb 2>/dev/null | sed -n 's/^DCB State:\t*\(.*\)/\1/p')
[57] Fix | Delete
if [ -z "$s" ] ; then
[58] Fix | Delete
p=$(get_vlan_parent ${i})
[59] Fix | Delete
if [ "$p" ] ; then
[60] Fix | Delete
s=$(dcbtool gc ${p} dcb 2>/dev/null | sed -n 's/^DCB State:\t*\(.*\)/\1/p')
[61] Fix | Delete
ifname=${p##*/}
[62] Fix | Delete
fi
[63] Fix | Delete
fi
[64] Fix | Delete
if [ "$s" = "on" ] ; then
[65] Fix | Delete
dcb="dcb"
[66] Fix | Delete
else
[67] Fix | Delete
dcb="nodcb"
[68] Fix | Delete
fi
[69] Fix | Delete
[70] Fix | Delete
# Some Combined Network Adapters(CNAs) implement DCB in firmware.
[71] Fix | Delete
# Do not run software-based DCB or LLDP on CNAs that implement DCB.
[72] Fix | Delete
# If the network interface provides hardware DCB/DCBX capabilities,
[73] Fix | Delete
# DCB_REQUIRED in "/etc/fcoe/cfg-xxx" is expected to set to "no".
[74] Fix | Delete
#
[75] Fix | Delete
# Force "nodcb" if there's any DCB_REQUIRED="no"(child or vlan parent).
[76] Fix | Delete
grep -q "^[[:blank:]]*DCB_REQUIRED=\"no\"" /etc/fcoe/cfg-${i##*/} &>/dev/null
[77] Fix | Delete
[ $? -eq 0 ] && dcb="nodcb"
[78] Fix | Delete
if [ "$p" ] ; then
[79] Fix | Delete
grep -q "^[[:blank:]]*DCB_REQUIRED=\"no\"" /etc/fcoe/cfg-${p} &>/dev/null
[80] Fix | Delete
[ $? -eq 0 ] && dcb="nodcb"
[81] Fix | Delete
fi
[82] Fix | Delete
[83] Fix | Delete
echo "ifname=${ifname}:${mac}"
[84] Fix | Delete
echo "fcoe=${ifname}:${dcb}:${mode}"
[85] Fix | Delete
done
[86] Fix | Delete
} | sort | uniq
[87] Fix | Delete
}
[88] Fix | Delete
[89] Fix | Delete
# called by dracut
[90] Fix | Delete
install() {
[91] Fix | Delete
inst_multiple ip dcbtool fipvlan lldpad readlink lldptool fcoemon fcoeadm
[92] Fix | Delete
if [ -e "/etc/hba.conf" ]; then
[93] Fix | Delete
inst_libdir_file 'libhbalinux.so*'
[94] Fix | Delete
inst_simple "/etc/hba.conf"
[95] Fix | Delete
fi
[96] Fix | Delete
[97] Fix | Delete
mkdir -m 0755 -p "$initdir/var/lib/lldpad"
[98] Fix | Delete
mkdir -m 0755 -p "$initdir/etc/fcoe"
[99] Fix | Delete
[100] Fix | Delete
if [[ $hostonly_cmdline == "yes" ]] ; then
[101] Fix | Delete
local _fcoeconf=$(cmdline)
[102] Fix | Delete
[[ $_fcoeconf ]] && printf "%s\n" "$_fcoeconf" >> "${initdir}/etc/cmdline.d/95fcoe.conf"
[103] Fix | Delete
fi
[104] Fix | Delete
inst_multiple /etc/fcoe/cfg-*
[105] Fix | Delete
[106] Fix | Delete
inst "$moddir/fcoe-up.sh" "/sbin/fcoe-up"
[107] Fix | Delete
inst "$moddir/fcoe-edd.sh" "/sbin/fcoe-edd"
[108] Fix | Delete
inst "$moddir/fcoe-genrules.sh" "/sbin/fcoe-genrules.sh"
[109] Fix | Delete
inst_hook pre-trigger 03 "$moddir/lldpad.sh"
[110] Fix | Delete
inst_hook cmdline 99 "$moddir/parse-fcoe.sh"
[111] Fix | Delete
inst_hook cleanup 90 "$moddir/cleanup-fcoe.sh"
[112] Fix | Delete
inst_hook shutdown 40 "$moddir/stop-fcoe.sh"
[113] Fix | Delete
dracut_need_initqueue
[114] Fix | Delete
}
[115] Fix | Delete
[116] Fix | Delete
[117] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function