From 8dccaace9c7f36aa3513639b67a18c331548714b Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Wed, 25 Jan 2012 20:23:03 -0600
Subject: runit-scripts: add back mythdroid scripts by mihanson.

---
 abs/core/runit-scripts/PKGBUILD                          |  2 +-
 .../runit-scripts/runitscripts/services/mythdroid/finish |  9 +++++++++
 .../runit-scripts/runitscripts/services/mythdroid/run    | 16 ++++++++++++++++
 3 files changed, 26 insertions(+), 1 deletion(-)
 create mode 100755 abs/core/runit-scripts/runitscripts/services/mythdroid/finish
 create mode 100755 abs/core/runit-scripts/runitscripts/services/mythdroid/run

diff --git a/abs/core/runit-scripts/PKGBUILD b/abs/core/runit-scripts/PKGBUILD
index 877fe18..b58966d 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=49
+pkgrel=50
 pkgdesc="collection of startup scripts for runit"
 url="http://smarden.org/runit/"
 license="BSD"
diff --git a/abs/core/runit-scripts/runitscripts/services/mythdroid/finish b/abs/core/runit-scripts/runitscripts/services/mythdroid/finish
new file mode 100755
index 0000000..c3d8b6b
--- /dev/null
+++ b/abs/core/runit-scripts/runitscripts/services/mythdroid/finish
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+[ -f /etc/conf.d/mdd.conf ] && . /etc/conf.d/mdd.conf
+
+    PID=$(pidof -o %PPID -x /usr/bin/vendor_perl/mdd.pl)
+    [[ -n $PID ]] && kill $PID &> /dev/null
diff --git a/abs/core/runit-scripts/runitscripts/services/mythdroid/run b/abs/core/runit-scripts/runitscripts/services/mythdroid/run
new file mode 100755
index 0000000..fa2cb48
--- /dev/null
+++ b/abs/core/runit-scripts/runitscripts/services/mythdroid/run
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+[ -f /etc/conf.d/mdd.conf ] && . /etc/conf.d/mdd.conf
+
+    stat_runit "Starting MythDroid daemon"
+
+    /sbin/chpst -u mythtv /usr/bin/vendor_perl/mdd.pl
+    PID=$(pidof -o %PPID -x /usr/bin/vendor_perl/mdd.pl)
+
+# Wait until daemon dies, else runit can't supervise us
+    while [ "`pidof -o %PPID -x /usr/bin/vendor_perl/mdd.pl`" == "$PID" ]; do
+      sleep 2
+    done
-- 
cgit v0.12

