staticroute revision 1.4
1#!/bin/sh 2# 3# $NetBSD: staticroute,v 1.4 2009/10/07 07:51:28 tron Exp $ 4# 5 6# PROVIDE: staticroute 7# REQUIRE: network 8# BEFORE: NETWORKING 9 10# See the route.conf(5) manual page for details. 11 12$_rc_subr_loaded . /etc/rc.subr 13 14name="staticroute" 15start_cmd="staticroute_doit Adding add" 16stop_cmd="staticroute_doit Deleting delete" 17 18staticroute_doit() { 19 if [ -s /etc/route.conf ]; then 20 echo "$1 static routes." 21 while read args; do 22 [ -z "$args" ] && continue 23 case "$args" in 24 "#"*) 25 ;; 26 "+"*) 27 [ $2 = "add" ] && eval ${args#*+} 28 ;; 29 "-"*) 30 [ $2 = "delete" ] && eval ${args#*-} 31 ;; 32 *) 33 route -q $2 -$args 34 ;; 35 esac 36 done < /etc/route.conf 37 fi 38 39 return 0 40} 41 42load_rc_config $name 43run_rc_command "$1" 44