From 5fd9752d7444750a3bb4222ed15c8ddf6db858fe Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Wed, 23 Jan 2013 17:46:37 -0600
Subject: runit-scripts:  add cetonproxy or bridge service.  Added infinitv_usb
  service.

refs #899
refs #898
---
 abs/core/runit-scripts/PKGBUILD                    |  2 +-
 .../runitscripts/services/cetonproxy/finish        |  2 ++
 .../runitscripts/services/cetonproxy/run           | 25 ++++++++++++++++++++++
 .../runitscripts/services/infinitv_usb/log/run     |  7 ++++++
 .../runitscripts/services/infinitv_usb/run         | 10 +++++++++
 5 files changed, 45 insertions(+), 1 deletion(-)
 create mode 100755 abs/core/runit-scripts/runitscripts/services/cetonproxy/finish
 create mode 100755 abs/core/runit-scripts/runitscripts/services/cetonproxy/run
 create mode 100755 abs/core/runit-scripts/runitscripts/services/infinitv_usb/log/run
 create mode 100755 abs/core/runit-scripts/runitscripts/services/infinitv_usb/run

diff --git a/abs/core/runit-scripts/PKGBUILD b/abs/core/runit-scripts/PKGBUILD
index 70d3da9..c601d2f 100755
--- a/abs/core/runit-scripts/PKGBUILD
+++ b/abs/core/runit-scripts/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=runit-scripts
 pkgver=2.1.1
-pkgrel=110
+pkgrel=113
 pkgdesc="collection of startup scripts for runit"
 url="http://smarden.org/runit/"
 license="BSD"
diff --git a/abs/core/runit-scripts/runitscripts/services/cetonproxy/finish b/abs/core/runit-scripts/runitscripts/services/cetonproxy/finish
new file mode 100755
index 0000000..4d4d6da
--- /dev/null
+++ b/abs/core/runit-scripts/runitscripts/services/cetonproxy/finish
@@ -0,0 +1,2 @@
+#!/bin/bash
+/usr/bin/killall -9 balance
diff --git a/abs/core/runit-scripts/runitscripts/services/cetonproxy/run b/abs/core/runit-scripts/runitscripts/services/cetonproxy/run
new file mode 100755
index 0000000..c8c7fcf
--- /dev/null
+++ b/abs/core/runit-scripts/runitscripts/services/cetonproxy/run
@@ -0,0 +1,25 @@
+#!/bin/bash
+exec 2>&1
+export TERM=linux
+. /etc/rc.conf
+. /etc/rc.d/functions
+stat_runit "Starting Ceton bridge"
+pid_string=''
+
+for i in `ls /etc/ceton_proxy.d/|sort -r`
+do
+    . /etc/ceton_proxy.d/$i
+    #forcing foreground and then running with & is to capture the pid
+    balance -f $port $ip:80  >/dev/null &
+    stat_runit "    proxy $ip on port $port"
+    pid=$!
+    pid_string="$pid_string $pid"
+done
+
+if [ "x$pid_string" = "x" ]
+then
+    sv stop cetonproxy
+else
+    wait $pid_string
+fi
+
diff --git a/abs/core/runit-scripts/runitscripts/services/infinitv_usb/log/run b/abs/core/runit-scripts/runitscripts/services/infinitv_usb/log/run
new file mode 100755
index 0000000..f4de0e2
--- /dev/null
+++ b/abs/core/runit-scripts/runitscripts/services/infinitv_usb/log/run
@@ -0,0 +1,7 @@
+#!/bin/sh
+exec 2>&1
+#export TERM=linux
+#. /etc/rc.conf
+#. /etc/rc.d/functions
+/usr/bin/logger -p info -t infinitv_usb
+
diff --git a/abs/core/runit-scripts/runitscripts/services/infinitv_usb/run b/abs/core/runit-scripts/runitscripts/services/infinitv_usb/run
new file mode 100755
index 0000000..e1f5764
--- /dev/null
+++ b/abs/core/runit-scripts/runitscripts/services/infinitv_usb/run
@@ -0,0 +1,10 @@
+#!/bin/sh
+#
+# Start/stop the usb infinitv service
+#
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+stat_runit "Starting InfinitTV_usb"
+exec /usr/bin/infinitv_usbd 
-- 
cgit v0.12

