From e5077f0f7459d6f91d44a1135d7150910e0b1f62 Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Fri, 14 Nov 2008 10:08:56 -0600
Subject: Add smolt to start on first boot. correct link location for
 myth_mtc.py in cron.daily

---
 abs/core-testing/LinHES-config/PKGBUILD       |  2 +-
 abs/core-testing/LinHES-system/LinHES-run     |  4 +--
 abs/core-testing/LinHES-system/LinHES.install |  2 +-
 abs/core-testing/LinHES-system/PKGBUILD       |  6 ++--
 abs/core-testing/LinHES-system/firstboot.sh   | 44 +++++++++++++++++++++++++++
 abs/core-testing/LinHES-system/myth_mtc.py    |  4 +--
 6 files changed, 53 insertions(+), 9 deletions(-)
 create mode 100755 abs/core-testing/LinHES-system/firstboot.sh

diff --git a/abs/core-testing/LinHES-config/PKGBUILD b/abs/core-testing/LinHES-config/PKGBUILD
index 67046b3..c5c73b9 100755
--- a/abs/core-testing/LinHES-config/PKGBUILD
+++ b/abs/core-testing/LinHES-config/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=LinHES-config
 pkgver=1.0
-pkgrel=11
+pkgrel=12
 conflicts=(MythVantage-config MythVantage-config-dev LinHES-config-dev )
 pkgdesc="Install and configure your system"
 depends=(bc libstatgrab  mysql-python expect curl dnsutils parted sg3_utils nmbscan)
diff --git a/abs/core-testing/LinHES-system/LinHES-run b/abs/core-testing/LinHES-system/LinHES-run
index 0fc10fd..f04d5e0 100644
--- a/abs/core-testing/LinHES-system/LinHES-run
+++ b/abs/core-testing/LinHES-system/LinHES-run
@@ -31,7 +31,7 @@ then
         if [ ! $STATUS = 2 ]
         then
                 sudo sv stop mythbackend
-                xterm -e /usr/bin/mythtv-setup
+                xterm -fn *18* -e /usr/bin/mythtv-setup
                 sudo sv start mythbackend
                 nice -n 19 mythfilldatabase --quiet &
         fi
@@ -49,7 +49,7 @@ fi
 
 echo "====================================================================="
 echo "Starting $STARTCMD"
-
+firstboot.sh &
 
 # while [ x = x ]
 # do
diff --git a/abs/core-testing/LinHES-system/LinHES.install b/abs/core-testing/LinHES-system/LinHES.install
index e327edc..2d2bdf2 100644
--- a/abs/core-testing/LinHES-system/LinHES.install
+++ b/abs/core-testing/LinHES-system/LinHES.install
@@ -8,7 +8,7 @@ pre_install() {
 
 # arg 1:  the new package version
 post_install() {
-MVDIR=/usr/LinHES/bin
+MVDIR=/usr/LH/bin
 #	ln -s  $MVDIR/backup_job /etc/cron.daily/backup_cron
 #	ln -s  $MVDIR/update_system  /etc/cron.daily/xupdate_system_cron
 #	ln -s  $MVDIR/repo_sync.sh  /etc/cron.daily/zrepo_sync.sh
diff --git a/abs/core-testing/LinHES-system/PKGBUILD b/abs/core-testing/LinHES-system/PKGBUILD
index 0408398..21f196d 100644
--- a/abs/core-testing/LinHES-system/PKGBUILD
+++ b/abs/core-testing/LinHES-system/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=LinHES-system
 pkgver=1.0
-pkgrel=9
+pkgrel=12
 arch=('i686')
 MVDIR=$startdir/pkg/usr/LH
 BINDIR=$startdir/pkg/usr/bin
@@ -8,7 +8,7 @@ install=LinHES.install
 pkgdesc="scripts and things related to having a automated system"
 depends=()
 
-binfiles="LinHES-start optimize_mythdb.py myth_mtc.py myth_mtc.sh LinHES-run"
+binfiles="LinHES-start optimize_mythdb.py myth_mtc.py myth_mtc.sh LinHES-run firstboot.sh"
 
 source=(LinHES-session LinHES-profile.sh $binfiles)
 
@@ -16,7 +16,7 @@ build() {
         cd $startdir/src
         install -m755 -D LinHES-session $startdir/pkg/etc/X11/Sessions/LinHES
 	install -m755 -D LinHES-profile.sh $startdir/pkg/etc/profile.d/LinHES-profile.sh
-####### install to /usr/MythVantage/bin/
+####### install to /usr/LH/bin
 #mkdir -p $BINDIR
 
 for i in $binfiles
diff --git a/abs/core-testing/LinHES-system/firstboot.sh b/abs/core-testing/LinHES-system/firstboot.sh
new file mode 100755
index 0000000..366874a
--- /dev/null
+++ b/abs/core-testing/LinHES-system/firstboot.sh
@@ -0,0 +1,44 @@
+#!/bin/bash
+. ~/.configured
+ATTEMPT=0
+function try_smolt {
+	((ATTEMPT=ATTEMPT+1))
+	echo $ATTEMPT
+	status=$(echo "jump mythsmolt" | telnet localhost 6546 2>&1)
+	echo $status|grep -q refused
+ 	status=$?
+	if [ $status  != 0  ]
+	then
+		fb_status=0
+		echo "FB=NO" > ~/.configured
+	fi
+	if [ $ATTEMPT = 200 ]
+	then
+		fb_status=0
+	fi
+}
+
+if [ ! -e /tmp/debug ]
+then
+	if [ ! -e /tmp/nomfe ]
+	then
+		if [ ! -e ~/.mythtv/pub-uuid ]
+		then
+			if [ x$FB != xNO ]
+			then
+				fb_status=4
+				while [ $fb_status != 0 ]
+				do
+					try_smolt
+					if [ $fb_status != 0  ]
+					then
+						sleep 1
+					fi
+				done
+			fi
+		fi
+	fi
+fi
+
+
+
diff --git a/abs/core-testing/LinHES-system/myth_mtc.py b/abs/core-testing/LinHES-system/myth_mtc.py
index faeee84..5505b0a 100755
--- a/abs/core-testing/LinHES-system/myth_mtc.py
+++ b/abs/core-testing/LinHES-system/myth_mtc.py
@@ -112,10 +112,10 @@ def run_stuff():
         optimize()
 
 	print "Running backup"
-        os.system('/usr/MythVantage/bin/backup_job')
+        os.system('/usr/LH/bin/backup_job')
 
 	print "Running system_update"
-        os.system('/usr/MythVantage/bin/update_system')
+        os.system('/usr/LH/bin/update_system')
         continue_loop=False
     else:
         continue_loop=True
-- 
cgit v0.12