From 19558d2bbdf4b31e21c7707c86a077d62ab26d3c Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Wed, 9 Jan 2013 16:44:26 -0600
Subject: LinHES-system, runit-scripts, mythdb-initial:  autocard.py will run
 when mythbackend starts if /etc/udev/mv-persistent-video.description is not
 present.

LinHES-system: wait for autocard to finish before stopping the be

mythdb-initial:  add a dummy tuner, so that myth backend will start.  This get around the chicken/egg problem of needing tuners defined before MBE can start.  However to add tuners via the API mythbe must be started.

refs #892
---
 abs/core/LinHES-system/LinHES-session                        |  7 ++++++-
 abs/core/LinHES-system/PKGBUILD                              |  4 ++--
 abs/core/mythdb-initial/PKGBUILD                             |  4 ++--
 abs/core/mythdb-initial/custom.sql                           | 11 +++++++++++
 abs/core/runit-scripts/PKGBUILD                              |  2 +-
 abs/core/runit-scripts/runitscripts/services/mythbackend/run | 11 +++++++++++
 6 files changed, 33 insertions(+), 6 deletions(-)

diff --git a/abs/core/LinHES-system/LinHES-session b/abs/core/LinHES-system/LinHES-session
index 1eb991e..e181a1a 100755
--- a/abs/core/LinHES-system/LinHES-session
+++ b/abs/core/LinHES-system/LinHES-session
@@ -287,13 +287,18 @@ function first_configure_mv(){
     then
         if [  -f ~/.configure ]
         then
-            msg "This is the first time starting MythTV.\nThe MythTV backend process will be stopped for setup."
+            msg "New install of LinHES; starting setup."
             #for now skip these
             #autocard.py -g &
             #MythVantage -b
             #0 yes
             #1 yes/autodetech
             #2  no
+            while [ -e '/var/run/autocard.lock' ]
+            do
+                msg "Waiting for capture card detection to complete"
+                sleep 5
+            done
             STATUS=$?
             if [ ! $STATUS = 2 ]
             then
diff --git a/abs/core/LinHES-system/PKGBUILD b/abs/core/LinHES-system/PKGBUILD
index 6731cf0..f6b7019 100755
--- a/abs/core/LinHES-system/PKGBUILD
+++ b/abs/core/LinHES-system/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=LinHES-system
 pkgver=2
-pkgrel=135
+pkgrel=138
 arch=('i686' 'x86_64')
 MVDIR=$startdir/pkg/usr/LH
 BINDIR=$startdir/pkg/usr/bin
@@ -80,7 +80,7 @@ build() {
 
 
 }
-md5sums=('53bc3d73641c7227fe1da4084f69a7a1'
+md5sums=('4587b20bce8d5a0396f97a7b9793a03a'
          '5881bdb43d578ec3a79d1f77ea58a3db'
          'a875ee97f86e46f34a741c2bc455f894'
          '76b2637cac0452b3acdbeeb4e8a5474b'
diff --git a/abs/core/mythdb-initial/PKGBUILD b/abs/core/mythdb-initial/PKGBUILD
index 320ae30..fda32db 100755
--- a/abs/core/mythdb-initial/PKGBUILD
+++ b/abs/core/mythdb-initial/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=mythdb-initial
 pkgver=2
-pkgrel=47
+pkgrel=48
 pkgdesc="setup the initial mythtv database for linhes"
 url=""
 license=""
@@ -21,4 +21,4 @@ build() {
 }
 md5sums=('9dcf8c574e69fde6b1b2fa1eed95ded4'
          'ad0e57ac5e7c3677808a670e16634bba'
-         '993fe1bff5df6005d06bd6fbdf3e6ce1')
+         '814622daded79510217a96da960b24bd')
diff --git a/abs/core/mythdb-initial/custom.sql b/abs/core/mythdb-initial/custom.sql
index 6cc9663..de8e948 100644
--- a/abs/core/mythdb-initial/custom.sql
+++ b/abs/core/mythdb-initial/custom.sql
@@ -147,4 +147,15 @@ INSERT INTO `settings` (`value`, `data`, `hostname`) VALUES
 ('HostUseALLdata',  '1'    ,   'apheleia'),
 ('HOSTdatafstype',  'xfs'  ,   'apheleia');
 
+-- Add a dummy tuner so BE will at least start
+INSERT INTO `capturecard` (`videodevice`,`cardtype`,`defaultinput`,`hostname`) VALUES
+('file://tmp/demo.mpg' , 'DEMO', 'Television', 'apheleia');
+
+INSERT INTO `videosource` (`name`, `xmltvgrabber`) VALUES
+('DEMO_VIDEO_SOURCE' , '/bin/true');
+
+INSERT INTO  `cardinput` (`cardid`,`sourceid`,`inputname`) VALUES
+('1','1','MPEG2TS');
+
+
 
diff --git a/abs/core/runit-scripts/PKGBUILD b/abs/core/runit-scripts/PKGBUILD
index dc75fa8..36c9ddd 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=105
+pkgrel=107
 pkgdesc="collection of startup scripts for runit"
 url="http://smarden.org/runit/"
 license="BSD"
diff --git a/abs/core/runit-scripts/runitscripts/services/mythbackend/run b/abs/core/runit-scripts/runitscripts/services/mythbackend/run
index 7bcf0a1..903979c 100755
--- a/abs/core/runit-scripts/runitscripts/services/mythbackend/run
+++ b/abs/core/runit-scripts/runitscripts/services/mythbackend/run
@@ -5,6 +5,12 @@ export TERM=linux
 . /etc/rc.conf
 . /etc/rc.d/functions
 
+#Run autocard
+if [ ! -e /etc/udev/mv-persistent-video.description ]
+then
+    /usr/MythVantage/bin/autocard.py insertdb >/tmp/autocard.log &
+fi
+
 #wait for mysql
 if [ -e /service/mysql ]
 then
@@ -39,6 +45,11 @@ then
 fi
 
 
+
+
+
+
+
 export HOME=/root
 # 	if [ -f /tmp/debug ]
 # 		then
-- 
cgit v0.12

