port lots of init scripts over to rc.common (more to come)
[openwrt/svn-archive/archive.git] / net / miredo / files / miredo.init
index e305472acad81275761936f7ff40095cb7450024..7fe13d963fbf9f9668001ee0dbaa96882bbb031a 100644 (file)
@@ -1,4 +1,5 @@
-#!/bin/sh
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006 OpenWrt.org
 
 BIN=miredo
 DEFAULT=/etc/default/$BIN
 
 BIN=miredo
 DEFAULT=/etc/default/$BIN
@@ -6,23 +7,13 @@ RUN_D=/var/run
 PID_F=$RUN_D/$BIN.pid
 [ -f $DEFAULT ] && . $DEFAULT
 
 PID_F=$RUN_D/$BIN.pid
 [ -f $DEFAULT ] && . $DEFAULT
 
-case $1 in
- start)
-  [ -d $RUN_D ] || mkdir -p $RUN_D
-  insmod ipv6
-  insmod tun
-  $BIN $OPTIONS
-  ;;
- stop)
-  [ -f $PID_F ] && kill $(cat $PID_F)
-  ;;
- restart)
-  $0 stop
-  $0 start
-  ;;
- *)
-  echo "usage: $0 (start|stop|restart)"
-  exit 1
-esac
+start() {
+       [ -d $RUN_D ] || mkdir -p $RUN_D
+       insmod ipv6
+       insmod tun
+       $BIN $OPTIONS
+}
 
 
-exit $?
+stop() {
+       [ -f $PID_F ] && kill $(cat $PID_F)
+}