plymouth: removed console_init call
[dracut/plouj.git] / modules.d / 95iscsi / parse-iscsiroot.sh
blob1ba4277d21d1f3559ecfb049eae352536164ded9
1 #!/bin/sh
3 # Preferred format:
4 # root=iscsi:[<servername>]:[<protocol>]:[<port>]:[<LUN>]:<targetname>
5 # [root=*] netroot=iscsi:[<servername>]:[<protocol>]:[<port>]:[<LUN>]:<targetname>
7 # Legacy formats:
8 # [net]root=[iscsi] iscsiroot=[<servername>]:[<protocol>]:[<port>]:[<LUN>]:<targetname>
9 # [net]root=[iscsi] iscsi_firmware
11 # root= takes precedence over netroot= if root=iscsi[...]
14 # Don't continue if root is ok
15 [ -n "$rootok" ] && return
17 # This script is sourced, so root should be set. But let's be paranoid
18 [ -z "$root" ] && root=$(getarg root=)
19 [ -z "$netroot" ] && netroot=$(getarg netroot=)
20 [ -z "$iscsiroot" ] && iscsiroot=$(getarg iscsiroot=)
21 [ -z "$iscsi_firmware" ] && getarg iscsi_firmware && iscsi_firmware="1"
23 [ -n "$iscsiroot" ] && [ -n "$iscsi_firmware" ] && die "Mixing iscsiroot and iscsi_firmware is dangerous"
25 # Root takes precedence over netroot
26 if [ "${root%%:*}" = "iscsi" ] ; then
27 if [ -n "$netroot" ] ; then
28 echo "Warning: root takes precedence over netroot. Ignoring netroot"
31 netroot=$root
34 # If it's not empty or iscsi we don't continue
35 [ -z "$netroot" ] || [ "${netroot%%:*}" = "iscsi" ] || return
37 if [ -n "$iscsiroot" ] ; then
38 [ -z "$netroot" ] && netroot=$root
40 # @deprecated
41 echo "Warning: Argument isciroot is deprecated and might be removed in a future"
42 echo "release. See http://apps.sourceforge.net/trac/dracut/wiki/commandline for"
43 echo "more information."
45 # Accept iscsiroot argument?
46 [ -z "$netroot" ] || [ "$netroot" = "iscsi" ] || \
47 die "Argument iscsiroot only accepted for empty root= or [net]root=iscsi"
49 # Override root with iscsiroot content?
50 [ -z "$netroot" ] || [ "$netroot" = "iscsi" ] && netroot=iscsi:$iscsiroot
53 # iscsi_firmware does not need argument checking
54 if [ -n "$iscsi_firmware" ] ; then
55 netroot=${netroot:-iscsi}
58 # If it's not iscsi we don't continue
59 [ "${netroot%%:*}" = "iscsi" ] || return
61 # Check required arguments. there's only one, but it's at the end
62 if [ -z "$iscsi_firmware" ] ; then
63 case "${netroot##iscsi:*:*:*:*:}" in
64 $netroot|'') die "Argument targetname for iscsiroot is missing";;
65 esac
68 # ISCSI actually supported?
69 [ -e /sys/devices/virtual/iscsi_transport ] || modprobe iscsi_tcp || die "iscsiroot requested but kernel/initrd does not support iscsi"
71 # Done, all good!
72 rootok=1
74 # Shut up init error check
75 [ -z "$root" ] && root="iscsi"