Home | History | Annotate | Line # | Download | only in rc.d
staticroute revision 1.1
      1 #!/bin/sh
      2 #
      3 # $NetBSD: staticroute,v 1.1 2003/01/09 15:57:02 christos Exp $
      4 #
      5 
      6 # PROVIDE: staticroute
      7 # REQUIRE: network
      8 # BEFORE:  NETWORKING
      9 
     10 . /etc/rc.subr
     11 
     12 name="staticroute"
     13 start_cmd="staticroute_doit Adding add"
     14 stop_cmd="staticroute_doit Deleting delete"
     15 
     16 staticroute_doit() {
     17 	if [ -s /etc/route.conf ]; then
     18 		echo "$1 static routes."
     19 		while read args; do
     20 			[ -z "$args" ] && continue
     21 			case "$args" in
     22 			"#"*)
     23 				;;
     24 			"+"*)
     25 				[ $2 = "add" ] && eval ${args#*+}
     26 				;;
     27 			"-"*)
     28 				[ $2 = "delete" ] && eval ${args#*-}
     29 				;;
     30 			*)
     31 				route -q $2 -$args
     32 				;;
     33 			esac
     34 		done < /etc/route.conf
     35 	fi
     36 }
     37 
     38 load_rc_config $name
     39 run_rc_command "$1"
     40