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