From: Andrew Ruthven <andrew@etc.gen.nz>
Date: Sat, 19 Apr 2008 04:20:45 +0000 (+1200)
Subject: Add a molly-guard check.
X-Git-Tag: 0.7.4~4
X-Git-Url: http://git.etc.gen.nz/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a87cd7f8d0f8744f49af073f0c3068ff600d6b12;p=mythtv-status.git

Add a molly-guard check.
---

diff --git a/ChangeLog b/ChangeLog
index f75393b..d72bfd2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+2008-04-19	Andrew Ruthven
+	Add a molly-guard check
+
 2008-04-11	Andrew Ruthven
 	Provide helper scripts that'll return true if the MythTV backend
 	is:
diff --git a/debian/control b/debian/control
index b546e26..9a80f15 100644
--- a/debian/control
+++ b/debian/control
@@ -11,7 +11,7 @@ Vcs-Browser: http://git.etc.gen.nz/cgi-bin/gitweb.cgi?p=mythtv-status.git;a=summ
 Package: mythtv-status
 Architecture: all
 Depends: ${misc:Depends}, ${perl:Depends}, libwww-perl, libxml-libxml-perl, libdate-manip-perl, libmime-perl
-Suggests: libmythtv-perl
+Suggests: libmythtv-perl, molly-guard (>= 0.3.3-1)
 Description: Show the status of a MythTV backend
  Shows the current status of a local or remote MythTV backend and up to
  the next 10 recordings for today and tomorrow.
diff --git a/debian/install b/debian/install
index 5064406..7eaaa8c 100644
--- a/debian/install
+++ b/debian/install
@@ -1,3 +1,4 @@
 bin/mythtv-status usr/bin
 bin/mythtv_recording_now usr/bin
 bin/mythtv_recording_soon usr/bin
+molly-guard/mythtv-recording-soon usr/share/molly-guard/checks.d/40-mythtv-recording-now
diff --git a/molly-guard/mythtv-recording-soon b/molly-guard/mythtv-recording-soon
new file mode 100755
index 0000000..f9604bc
--- /dev/null
+++ b/molly-guard/mythtv-recording-soon
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+ME=molly-guard
+
+if [ ! -f /usr/bin/mythtv_recording_soon ]; then
+  echo "I: I can't find /usr/bin/mythtv_recording_soon, skipping check"
+  exit 0;
+fi
+
+HOSTNAME="$(hostname --short)"
+
+sigh()
+{
+  echo "Good thing I asked; I won't $CMD $HOSTNAME ..."
+  exit 1
+}
+
+
+if /usr/bin/mythtv_recording_soon; then
+  trap 'echo;sigh' 1 2 3 9 10 12 15
+  echo -n "MythTV is either recording now, or will be soon. Type YES to $CMD: "
+  read CONFIRM || :
+
+  [ $(echo "x$CONFIRM" | tr 'A-Z' 'a-z') = "xyes" ] || sigh
+
+  trap - 1 2 3 9 10 12 15
+fi
+
+exit 0
+