Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/etc/rc.d * Use functions from rc.subr, and indent the code.



details:   https://anonhg.NetBSD.org/src/rev/a4e7e7817f89
branches:  trunk
changeset: 747210:a4e7e7817f89
user:      apb <apb%NetBSD.org@localhost>
date:      Sat Sep 05 16:26:07 2009 +0000

description:
* Use functions from rc.subr, and indent the code.
* Add "KEYWORD: nostart", so /etc/rc doesn't try to run this (it would
  have been harmless anyway).

diffstat:

 etc/rc.d/downinterfaces |  50 +++++++++++++++++++++++++++---------------------
 1 files changed, 28 insertions(+), 22 deletions(-)

diffs (63 lines):

diff -r 6e3020dd2a46 -r a4e7e7817f89 etc/rc.d/downinterfaces
--- a/etc/rc.d/downinterfaces   Sat Sep 05 16:24:03 2009 +0000
+++ b/etc/rc.d/downinterfaces   Sat Sep 05 16:26:07 2009 +0000
@@ -1,31 +1,37 @@
 #!/bin/sh
 #
-# $NetBSD: downinterfaces,v 1.5 2004/10/11 15:00:51 christos Exp $
+# $NetBSD: downinterfaces,v 1.6 2009/09/05 16:26:07 apb Exp $
 #
 
 # PROVIDE: downinterfaces
-# KEYWORD: shutdown
+# KEYWORD: nostart shutdown
+
+$_rc_subr_loaded . /etc/rc.subr
 
-if [ "x$1" = "xstop" ]; then
-
-. /etc/rc.conf
+name="downinterfaces"
+start_cmd=":"
+stop_cmd="downinterfaces_stop"
 
-tmp=$(ifconfig -lu)
-iflist=""
-for int in $tmp; do
-       case $int in
-       pppoe*) iflist="$iflist $int"
-               ;;
-       esac
-done
-iflist="$iflist $force_down_interfaces"
-if [ "$iflist" != "" ] && [ "$iflist" != " " ]
-then
+downinterfaces_stop()
+{
+       tmp=$(ifconfig -lu)
+       iflist=""
+       for int in $tmp; do
+               case $int in
+               pppoe*) iflist="$iflist $int"
+                       ;;
+               esac
+       done
+       iflist="$iflist $force_down_interfaces"
+       if [ "$iflist" != "" ] && [ "$iflist" != " " ]
+       then
 
-       echo "Shutting down interfaces:$iflist"
-       for int in $iflist; do
-               ifconfig $int down
-       done
-fi
+               echo "Shutting down interfaces:$iflist"
+               for int in $iflist; do
+                       ifconfig $int down
+               done
+       fi
+}
 
-fi
+load_rc_config $name
+run_rc_command "$1"



Home | Main Index | Thread Index | Old Index