From daf5a55912f10a1d4053e173f286eb2c59cea1dd Mon Sep 17 00:00:00 2001
From: Michael Hanson <hansonorders@verizon.net>
Date: Wed, 3 Aug 2011 22:50:37 +0000
Subject: runit-scripts: Add mythexport

---
 abs/core/runit-scripts/PKGBUILD                                |  2 +-
 abs/core/runit-scripts/runit-scripts-2.1.1-23.src.tar.gz       |  1 +
 abs/core/runit-scripts/runitscripts/services/mythexport/finish |  4 ++++
 abs/core/runit-scripts/runitscripts/services/mythexport/run    | 10 ++++++++++
 4 files changed, 16 insertions(+), 1 deletion(-)
 create mode 120000 abs/core/runit-scripts/runit-scripts-2.1.1-23.src.tar.gz
 create mode 100755 abs/core/runit-scripts/runitscripts/services/mythexport/finish
 create mode 100755 abs/core/runit-scripts/runitscripts/services/mythexport/run

diff --git a/abs/core/runit-scripts/PKGBUILD b/abs/core/runit-scripts/PKGBUILD
index f6cace4..aa7b767 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=22
+pkgrel=23
 pkgdesc="collection of startup scripts for runit"
 url="http://smarden.org/runit/"
 license="BSD"
diff --git a/abs/core/runit-scripts/runit-scripts-2.1.1-23.src.tar.gz b/abs/core/runit-scripts/runit-scripts-2.1.1-23.src.tar.gz
new file mode 120000
index 0000000..0f2b2fa
--- /dev/null
+++ b/abs/core/runit-scripts/runit-scripts-2.1.1-23.src.tar.gz
@@ -0,0 +1 @@
+/data/pkg_repo/packages/runit-scripts-2.1.1-23.src.tar.gz
\ No newline at end of file
diff --git a/abs/core/runit-scripts/runitscripts/services/mythexport/finish b/abs/core/runit-scripts/runitscripts/services/mythexport/finish
new file mode 100755
index 0000000..b7fa7a6
--- /dev/null
+++ b/abs/core/runit-scripts/runitscripts/services/mythexport/finish
@@ -0,0 +1,4 @@
+#!/bin/bash
+
+# runit only knows about the run script wrapper, so kill the daemon ourselves
+  kill `pidof -o %PPID -x /usr/bin/mythexport-daemon` >/dev/null 2>&1
diff --git a/abs/core/runit-scripts/runitscripts/services/mythexport/run b/abs/core/runit-scripts/runitscripts/services/mythexport/run
new file mode 100755
index 0000000..45f77fd
--- /dev/null
+++ b/abs/core/runit-scripts/runitscripts/services/mythexport/run
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+/sbin/chpst -u mythtv /usr/bin/mythexport-daemon
+
+PID=`pidof -o %PPID -x /usr/bin/mythexport-daemon`
+
+# Wait until daemon dies, else runit can't supervise us
+  while [ "`pidof -o %PPID -x /usr/bin/mythexport-daemon`" == "$PID" ]; do
+    sleep 2
+  done
-- 
cgit v0.12

