Edit File by line
/home/barbar84/www/wp-conte.../plugins/sujqvwi/ShExBy/shex_roo.../lib/dracut/modules..../95iscsi
File: parse-iscsiroot.sh
#!/bin/sh
[0] Fix | Delete
#
[1] Fix | Delete
# Preferred format:
[2] Fix | Delete
# root=iscsi:[<servername>]:[<protocol>]:[<port>]:[<LUN>]:<targetname>
[3] Fix | Delete
# [root=*] netroot=iscsi:[<servername>]:[<protocol>]:[<port>]:[<LUN>]:<targetname>
[4] Fix | Delete
#
[5] Fix | Delete
# Legacy formats:
[6] Fix | Delete
# [net]root=[iscsi] iscsiroot=[<servername>]:[<protocol>]:[<port>]:[<LUN>]:<targetname>
[7] Fix | Delete
# [net]root=[iscsi] iscsi_firmware
[8] Fix | Delete
#
[9] Fix | Delete
# root= takes precedence over netroot= if root=iscsi[...]
[10] Fix | Delete
#
[11] Fix | Delete
[12] Fix | Delete
# This script is sourced, so root should be set. But let's be paranoid
[13] Fix | Delete
[ -z "$root" ] && root=$(getarg root=)
[14] Fix | Delete
if [ -z "$netroot" ]; then
[15] Fix | Delete
for nroot in $(getargs netroot=); do
[16] Fix | Delete
[ "${nroot%%:*}" = "iscsi" ] && break
[17] Fix | Delete
done
[18] Fix | Delete
if [ "${nroot%%:*}" = "iscsi" ]; then
[19] Fix | Delete
netroot="$nroot"
[20] Fix | Delete
else
[21] Fix | Delete
for nroot in $(getargs netroot=); do
[22] Fix | Delete
[ "${nroot%%:*}" = "dhcp" ] && break
[23] Fix | Delete
done
[24] Fix | Delete
netroot="$nroot"
[25] Fix | Delete
fi
[26] Fix | Delete
fi
[27] Fix | Delete
[ -z "$iscsiroot" ] && iscsiroot=$(getarg iscsiroot=)
[28] Fix | Delete
[ -z "$iscsi_firmware" ] && getargbool 0 rd.iscsi.firmware -y iscsi_firmware && iscsi_firmware="1"
[29] Fix | Delete
[30] Fix | Delete
[ -n "$iscsiroot" ] && [ -n "$iscsi_firmware" ] && die "Mixing iscsiroot and iscsi_firmware is dangerous"
[31] Fix | Delete
[32] Fix | Delete
type write_fs_tab >/dev/null 2>&1 || . /lib/fs-lib.sh
[33] Fix | Delete
[34] Fix | Delete
# Root takes precedence over netroot
[35] Fix | Delete
if [ "${root%%:*}" = "iscsi" ] ; then
[36] Fix | Delete
if [ -n "$netroot" ] ; then
[37] Fix | Delete
echo "Warning: root takes precedence over netroot. Ignoring netroot"
[38] Fix | Delete
fi
[39] Fix | Delete
netroot=$root
[40] Fix | Delete
# if root is not specified try to mount the whole iSCSI LUN
[41] Fix | Delete
printf 'ENV{DEVTYPE}!="partition", SYMLINK=="disk/by-path/*-iscsi-*-*", SYMLINK+="root"\n' >> /etc/udev/rules.d/99-iscsi-root.rules
[42] Fix | Delete
[ -n "$DRACUT_SYSTEMD" ] && systemctl is-active systemd-udevd && udevadm control --reload-rules
[43] Fix | Delete
root=/dev/root
[44] Fix | Delete
[45] Fix | Delete
write_fs_tab /dev/root
[46] Fix | Delete
fi
[47] Fix | Delete
[48] Fix | Delete
# If it's not empty or iscsi we don't continue
[49] Fix | Delete
for nroot in $(getargs netroot); do
[50] Fix | Delete
[ "${nroot%%:*}" = "iscsi" ] || continue
[51] Fix | Delete
netroot="$nroot"
[52] Fix | Delete
break
[53] Fix | Delete
done
[54] Fix | Delete
[55] Fix | Delete
# Root takes precedence over netroot
[56] Fix | Delete
if [ "${root}" = "/dev/root" ] && getarg "netroot=dhcp" ; then
[57] Fix | Delete
# if root is not specified try to mount the whole iSCSI LUN
[58] Fix | Delete
printf 'ENV{DEVTYPE}!="partition", SYMLINK=="disk/by-path/*-iscsi-*-*", SYMLINK+="root"\n' >> /etc/udev/rules.d/99-iscsi-root.rules
[59] Fix | Delete
[ -n "$DRACUT_SYSTEMD" ] && systemctl is-active systemd-udevd && udevadm control --reload-rules
[60] Fix | Delete
fi
[61] Fix | Delete
[62] Fix | Delete
if [ -n "$iscsiroot" ] ; then
[63] Fix | Delete
[ -z "$netroot" ] && netroot=$root
[64] Fix | Delete
[65] Fix | Delete
# @deprecated
[66] Fix | Delete
echo "Warning: Argument iscsiroot is deprecated and might be removed in a future"
[67] Fix | Delete
echo "release. See 'man dracut.kernel' for more information."
[68] Fix | Delete
[69] Fix | Delete
# Accept iscsiroot argument?
[70] Fix | Delete
[ -z "$netroot" ] || [ "$netroot" = "iscsi" ] || \
[71] Fix | Delete
die "Argument iscsiroot only accepted for empty root= or [net]root=iscsi"
[72] Fix | Delete
[73] Fix | Delete
# Override root with iscsiroot content?
[74] Fix | Delete
[ -z "$netroot" ] || [ "$netroot" = "iscsi" ] && netroot=iscsi:$iscsiroot
[75] Fix | Delete
fi
[76] Fix | Delete
[77] Fix | Delete
# iscsi_firmware does not need argument checking
[78] Fix | Delete
if [ -n "$iscsi_firmware" ]; then
[79] Fix | Delete
if [ "$root" != "dhcp" ] && [ "$netroot" != "dhcp" ]; then
[80] Fix | Delete
[ -z "$netroot" ] && netroot=iscsi:
[81] Fix | Delete
fi
[82] Fix | Delete
modprobe -b -q iscsi_boot_sysfs 2>/dev/null
[83] Fix | Delete
modprobe -b -q iscsi_ibft
[84] Fix | Delete
# if no ip= is given, but firmware
[85] Fix | Delete
echo "${DRACUT_SYSTEMD+systemctl is-active initrd-root-device.target || }[ -f '/tmp/iscsistarted-firmware' ]" > $hookdir/initqueue/finished/iscsi_started.sh
[86] Fix | Delete
initqueue --unique --online /sbin/iscsiroot online "iscsi:" "$NEWROOT"
[87] Fix | Delete
initqueue --unique --onetime --timeout /sbin/iscsiroot timeout "iscsi:" "$NEWROOT"
[88] Fix | Delete
initqueue --unique --onetime --settled /sbin/iscsiroot online "iscsi:" "'$NEWROOT'"
[89] Fix | Delete
fi
[90] Fix | Delete
[91] Fix | Delete
# ISCSI actually supported?
[92] Fix | Delete
if ! [ -e /sys/module/iscsi_tcp ]; then
[93] Fix | Delete
modprobe -b -q iscsi_tcp || die "iscsiroot requested but kernel/initrd does not support iscsi"
[94] Fix | Delete
fi
[95] Fix | Delete
[96] Fix | Delete
modprobe --all -b -q qla4xxx cxgb3i cxgb4i bnx2i be2iscsi
[97] Fix | Delete
[98] Fix | Delete
if [ -n "$netroot" ] && [ "$root" != "/dev/root" ] && [ "$root" != "dhcp" ]; then
[99] Fix | Delete
if ! getargbool 1 rd.neednet >/dev/null || ! getarg "ip="; then
[100] Fix | Delete
initqueue --unique --onetime --settled /sbin/iscsiroot dummy "'$netroot'" "'$NEWROOT'"
[101] Fix | Delete
fi
[102] Fix | Delete
fi
[103] Fix | Delete
[104] Fix | Delete
if arg=$(getarg rd.iscsi.initiator -d iscsi_initiator=) && [ -n "$arg" ] && ! [ -f /run/initiatorname.iscsi ] ; then
[105] Fix | Delete
iscsi_initiator=$arg
[106] Fix | Delete
echo "InitiatorName=$iscsi_initiator" > /run/initiatorname.iscsi
[107] Fix | Delete
ln -fs /run/initiatorname.iscsi /dev/.initiatorname.iscsi
[108] Fix | Delete
rm -f /etc/iscsi/initiatorname.iscsi
[109] Fix | Delete
mkdir -p /etc/iscsi
[110] Fix | Delete
ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi
[111] Fix | Delete
if [ -n "$DRACUT_SYSTEMD" ]; then
[112] Fix | Delete
systemctl try-restart iscsid
[113] Fix | Delete
# FIXME: iscsid is not yet ready, when the service is :-/
[114] Fix | Delete
sleep 1
[115] Fix | Delete
fi
[116] Fix | Delete
fi
[117] Fix | Delete
[118] Fix | Delete
# If not given on the cmdline and initiator-name available via iBFT
[119] Fix | Delete
if [ -z $iscsi_initiator ] && [ -f /sys/firmware/ibft/initiator/initiator-name ] && ! [ -f /tmp/iscsi_set_initiator ]; then
[120] Fix | Delete
iscsi_initiator=$(while read line || [ -n "$line" ]; do echo $line;done < /sys/firmware/ibft/initiator/initiator-name)
[121] Fix | Delete
if [ -n "$iscsi_initiator" ]; then
[122] Fix | Delete
echo "InitiatorName=$iscsi_initiator" > /run/initiatorname.iscsi
[123] Fix | Delete
rm -f /etc/iscsi/initiatorname.iscsi
[124] Fix | Delete
mkdir -p /etc/iscsi
[125] Fix | Delete
ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi
[126] Fix | Delete
> /tmp/iscsi_set_initiator
[127] Fix | Delete
if [ -n "$DRACUT_SYSTEMD" ]; then
[128] Fix | Delete
systemctl try-restart iscsid
[129] Fix | Delete
# FIXME: iscsid is not yet ready, when the service is :-/
[130] Fix | Delete
sleep 1
[131] Fix | Delete
fi
[132] Fix | Delete
fi
[133] Fix | Delete
fi
[134] Fix | Delete
[135] Fix | Delete
if [ -z "$netroot" ] || ! [ "${netroot%%:*}" = "iscsi" ]; then
[136] Fix | Delete
return 1
[137] Fix | Delete
fi
[138] Fix | Delete
[139] Fix | Delete
initqueue --unique --onetime --timeout /sbin/iscsiroot timeout "$netroot" "$NEWROOT"
[140] Fix | Delete
[141] Fix | Delete
for nroot in $(getargs netroot); do
[142] Fix | Delete
[ "${nroot%%:*}" = "iscsi" ] || continue
[143] Fix | Delete
type parse_iscsi_root >/dev/null 2>&1 || . /lib/net-lib.sh
[144] Fix | Delete
parse_iscsi_root "$nroot" || return 1
[145] Fix | Delete
netroot_enc=$(str_replace "$nroot" '/' '\2f')
[146] Fix | Delete
echo "${DRACUT_SYSTEMD+systemctl is-active initrd-root-device.target || }[ -f '/tmp/iscsistarted-$netroot_enc' ]" > $hookdir/initqueue/finished/iscsi_started.sh
[147] Fix | Delete
done
[148] Fix | Delete
[149] Fix | Delete
# Done, all good!
[150] Fix | Delete
rootok=1
[151] Fix | Delete
[152] Fix | Delete
# Shut up init error check
[153] Fix | Delete
[ -z "$root" ] && root="iscsi"
[154] Fix | Delete
[155] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function