init file for tinc

Signed-off-by: Jens Nachtigall <nachtiga at informatik.hu-berlin.de>

---
Index: net/tinc/files/tinc.init
===================================================================
--- net/tinc/files/tinc.init    (revision 0)
+++ net/tinc/files/tinc.init    (revision 0)
@@ -0,0 +1,63 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006 OpenWrt.org
+START=49
+
+DAEMON="/usr/sbin/tincd"
+NAME="tinc"
+DESC="tinc daemons"
+TCONF="/etc/tinc"
+NETSFILE="$TCONF/nets.boot"
+NETS=""
+
+find_nets () {
+  if [ ! -f $NETSFILE ] ; then
+    echo "Please create $NETSFILE."
+    exit 0
+  fi
+  NETS="`egrep '^[ ]*[a-zA-Z0-9_-]+[ ]*$' $NETSFILE`"
+}
+
+start () {
+    find_nets
+    echo -n "Starting $DESC:"
+        #do load the tun module - dpa
+        insmod tun
+
+    for n in $NETS ; do
+      echo -n " $n"
+      $DAEMON -n $n $EXTRA
+    done
+    echo "."
+}
+
+stop() {
+    find_nets
+    echo -n "Stopping $DESC:"
+    for n in $NETS ; do
+      echo -n " $n"
+      $DAEMON -n $n $EXTRA -k
+    done
+    echo "."
+}
+
+restart () {
+    find_nets
+    echo -n "Restarting $DESC:"
+    for n in $NETS ; do
+      echo -n " $n"
+      $DAEMON -n $n $EXTRA -k
+      sleep 1
+      $DAEMON -n $n $EXTRA
+    done
+    echo "."
+}
+
+reload () {
+    find_nets
+    echo -n "Reloading $DESC configuration:"
+    for n in $NETS ; do
+      echo -n " $n"
+      $DAEMON -n $n $EXTRA -kHUP
+    done
+    echo "."
+}

Property changes on: net/tinc/files/tinc.init
___________________________________________________________________
Name: svn:executable
   + *

Index: net/tinc/files/nets.boot
===================================================================
--- net/tinc/files/nets.boot    (revision 0)
+++ net/tinc/files/nets.boot    (revision 0)
@@ -0,0 +1,9 @@
+# Please enter the VPNs that should be automatically started while booting
+# and stopped at shutdown (via /etc/init.d/tinc). Each VPN corresponds to 
+# a directery in /etc/tinc/
+
+# vpn1
+# vpn2
+# ...
+
+
Index: net/tinc/Makefile
===================================================================
--- net/tinc/Makefile   (revision 11224)
+++ net/tinc/Makefile   (working copy)
@@ -48,7 +48,11 @@
 
 define Package/tinc/install    
        $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_DIR) $(1)/etc/tinc
+       $(CP) ./files/nets.boot $(1)/etc/tinc/
        $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/tincd $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/tinc.init $(1)/etc/init.d/tinc
 endef
 
 $(eval $(call BuildPackage,tinc))
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
http://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to