/usr/share/initramfs-tools/scripts/local-top/iscsi is in open-iscsi 2.0.873-3ubuntu9.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | #!/bin/sh
PREREQ=""
prereqs()
{
echo "$PREREQ"
}
case $1 in
# get pre-requisites
prereqs)
prereqs
exit 0
;;
esac
do_iscsi_login ()
{
# Bring in the main config
. /conf/initramfs.conf
for conf in conf/conf.d/*; do
[ -f ${conf} ] && . ${conf}
done
. /scripts/functions
wait_for_udev
configure_networking
# write info file for later consumption by iscsi-network-interface.conf
if [ -n "${DEVICE}" ] && [ -e "/run/net-${DEVICE}.conf" ]; then
echo "${DEVICE}" >/run/initramfs/open-iscsi.interface
fi
modprobe iscsi_tcp
modprobe crc32c
if [ -z $ISCSI_AUTO ]; then
if [ -z $ISCSI_INITIATOR ]; then
. /etc/initiatorname.iscsi
ISCSI_INITIATOR=$InitiatorName
fi
if [ -z $ISCSI_TARGET_PORT ]; then
ISCSI_TARGET_PORT=3260
fi
if [ -z $ISCSI_TARGET_GROUP ]; then
ISCSI_TARGET_GROUP=1
fi
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"}
else
modprobe iscsi_ibft
iscsistart -b
fi
if [ -z $ISCSI_TARGET_PORT ]; then
ISCSI_TARGET_PORT=3260
fi
if [ -z $ISCSI_TARGET_GROUP ]; then
ISCSI_TARGET_GROUP=1
fi
for i in $ISCSI_TARGET_IP; do
iscsistart -i $ISCSI_INITIATOR -t $ISCSI_TARGET_NAME \
-g $ISCSI_TARGET_GROUP -a $i \
-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"}
done
}
parse_iscsi_ops ()
{
. /etc/iscsi.initramfs
for x in $(cat /proc/cmdline); do
case ${x} in
iscsi_auto)
ISCSI_AUTO=true
;;
iscsi_initiator=*)
ISCSI_INITIATOR="${x#iscsi_initiator=}"
;;
iscsi_target_name=*)
ISCSI_TARGET_NAME="${x#iscsi_target_name=}"
;;
iscsi_target_ip=*)
ISCSI_TARGET_IP="${x#iscsi_target_ip=}"
;;
iscsi_target_port=*)
ISCSI_TARGET_PORT="${x#iscsi_target_port=}"
;;
iscsi_target_group=*)
ISCSI_TARGET_GROUP="${x#iscsi_target_group=}"
;;
iscsi_username=*)
ISCSI_USERNAME="${x#iscsi_username=}"
;;
iscsi_password=*)
ISCSI_PASSWORD="${x#iscsi_password=}"
;;
iscsi_in_username=*)
ISCSI_IN_USERNAME="${x#iscsi_in_username=}"
;;
iscsi_in_password=*)
ISCSI_IN_PASSWORD="${x#iscsi_in_password=}"
;;
esac
done
}
if [ ! -x /sbin/iscsistart ]; then
exit 0
fi
parse_iscsi_ops
if ( [ -z $ISCSI_TARGET_NAME ] || [ -z $ISCSI_TARGET_IP ] ) && [ -z $ISCSI_AUTO ]; then
exit 0
fi
do_iscsi_login
udevadm settle
exit 0
|