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