1 #!/bin/sh 2 # 3 # $NetBSD: iscsid,v 1.3 2020/09/08 12:52:18 martin Exp $ 4 # 5 6 # PROVIDE: iscsid 7 # REQUIRE: NETWORKING CRITLOCALMOUNTED 8 # BEFORE: securelevel mountcritremote 9 10 $_rc_subr_loaded . /etc/rc.subr 11 12 name="iscsid" 13 rcvar=$name 14 command="/sbin/${name}" 15 pidfile="/var/run/${name}.pid" 16 start_precmd="iscsid_precmd" 17 18 find_module() 19 { 20 local module rest 21 /sbin/modstat $1 | while read module rest; do 22 if [ "$module" = "$1" ]; then 23 echo found 24 break 25 fi 26 done 27 } 28 29 iscsid_precmd() 30 { 31 if [ "$(find_module iscsi)" != "found" ]; then 32 /sbin/modload iscsi 33 fi 34 } 35 36 load_rc_config $name 37 run_rc_command "$1" 38