Browse Source

OpenRC init script

Norman Rieß 9 years ago
parent
commit
477b4d9151
1 changed files with 32 additions and 0 deletions
  1. 32 0
      contrib/openrc/cjdns

+ 32 - 0
contrib/openrc/cjdns

@@ -0,0 +1,32 @@
+#!/sbin/runscript
+description="Encrypted networking for regular people."
+
+CONFFILE=/etc/cjdroute.conf
+
+command="/usr/sbin/cjdroute"
+
+depend() {
+	use net dns
+	after precursor
+}
+
+start() {
+	if [ ! -e /dev/net/tun ]; then
+		ebegin "Inserting TUN module"
+        
+		if ! modprobe tun;  then
+            	eerror "Failed to insert TUN kernel module"
+            	exit 1
+        	fi
+    	fi
+
+    	ebegin "Starting CJDNS"
+    	start-stop-daemon --start --quiet --exec "${command}" -- < "${CONFFILE}" 
+    	eend $?
+}
+
+stop() {
+	ebegin "Stopping CJDNS"
+	start-stop-daemon --stop --exec "${command}" 
+	eend $?
+}