2 # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
3 # ex: ts=8 sw=4 sts=4 et filetype=sh
7 # If our prerequisites are not met, fail anyways.
8 type -P iscsistart hostname iscsi-iname >/dev/null || return 1
10 # If hostonly was requested, fail the check if we are not actually
15 [[ $debug ]] && set -x
18 [[ -L /sys/dev/block/$1 ]] || return
19 cd "$(readlink -f /sys/dev/block/$1)"
20 until [[ -d sys || -d iscsi_session ]]; do
23 [[ -d iscsi_session ]]
26 [[ $hostonly ]] || [[ $mount_needs ]] && {
27 _rootdev=$(find_root_block_device)
28 if [[ $_rootdev ]]; then
29 # root lives on a block device, so we can be more precise about
31 check_block_and_slaves is_iscsi "$_rootdev" || return 1
40 echo network rootfs-block
44 instmods iscsi_tcp iscsi_ibft crc32c bnx2i iscsi_boot_sysfs qla4xxx cxgb3i cxgb4i be2iscsi
45 iscsi_module_filter() {
46 local _iscsifuncs='iscsi_register_transport'
48 while read _f; do case "$_f" in
49 *.ko) [[ $(< $_f) =~ $_iscsifuncs ]] && echo "$_f" ;;
50 *.ko.gz) [[ $(gzip -dc <$_f) =~ $_iscsifuncs ]] && echo "$_f" ;;
51 *.ko.xz) [[ $(xz -dc <$_f) =~ $_iscsifuncs ]] && echo "$_f" ;;
55 { find_kernel_modules_by_path drivers/scsi; find_kernel_modules_by_path drivers/s390/scsi; } \
56 | iscsi_module_filter | instmods
61 dracut_install -o iscsiuio
65 inst_hook cmdline 90 "$moddir/parse-iscsiroot.sh"
66 inst_hook pre-pivot 90 "$moddir/cleanup-iscsi.sh"
67 inst "$moddir/iscsiroot" "/sbin/iscsiroot"
68 inst "$moddir/mount-lun.sh" "/bin/mount-lun.sh"