#!/bin/bash # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- # ex: ts=8 sw=4 sts=4 et filetype=sh # We depend on network modules being loaded [ "$1" = "-d" ] && echo network # If our prerequisites are not met, fail anyways. type -P iscsistart hostname iscsi-iname >/dev/null || exit 1 # If hostonly was requested, fail the check if we are not actually # booting from root. . $dracutfunctions [[ $debug ]] && set -x is_iscsi() ( [[ -L /sys/dev/block/$1 ]] || return cd "$(readlink -f /sys/dev/block/$1)" until [[ -d sys || -d iscsi_session ]]; do cd .. done [[ -d iscsi_session ]] ) case $1 in -h) rootdev=$(find_root_block_device) if [[ $rootdev ]]; then # root lives on a block device, so we can be more precise about # hostonly checking check_block_and_slaves is_iscsi "$rootdev" || exit 1 else exit 1 fi ;; esac exit 0