From c4a526ab0e33d6667b59351ddbe2ac0cd098a1c1 Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Sat, 12 May 2012 17:12:33 -0500
Subject: LinHES-system:  couple things here, but mostly fix the osd message
 system - add lh_message.sh - Move OSD stuff out of linHES-session and instead
 have it call lh_message.sh - add switch_web.sh

---
 abs/core/LinHES-system/LinHES-session | 52 ++++++++++++++--------------
 abs/core/LinHES-system/PKGBUILD       |  8 +++--
 abs/core/LinHES-system/lh_message.sh  | 65 +++++++++++++++++++++++++++++++++++
 abs/core/LinHES-system/switch_web.sh  | 29 ++++++++++++++++
 4 files changed, 125 insertions(+), 29 deletions(-)
 create mode 100644 abs/core/LinHES-system/lh_message.sh
 create mode 100644 abs/core/LinHES-system/switch_web.sh

diff --git a/abs/core/LinHES-system/LinHES-session b/abs/core/LinHES-system/LinHES-session
index 1a460b5..f01e569 100755
--- a/abs/core/LinHES-system/LinHES-session
+++ b/abs/core/LinHES-system/LinHES-session
@@ -36,16 +36,16 @@ export MALLOC_CHECK_=0
 # }
 
 
-
-. /etc/osd_cat.cfg || {
-        color=yellow
-        outline=2
-        outlinecolour=black
-        shadow=0
-        shadowcolour=black
-        font="-adobe-helvetica-bold-*-*-*-34-*-*-*-*-*-*-*"
-}
-
+#
+# . /etc/osd_cat.cfg || {
+#         color=yellow
+#         outline=2
+#         outlinecolour=black
+#         shadow=0
+#         shadowcolour=black
+#         font="-adobe-helvetica-bold-*-*-*-34-*-*-*-*-*-*-*"
+# }
+#
 function delay_osd(){
     if [ x$STARTUP_STYLE = xmythvantage ]
     then
@@ -65,23 +65,23 @@ function delay_osd(){
 
 
     }
-
-function msg_osd(){
-    echo -e "$1"  | osd_cat --pos=middle --align=center --offset=200 --delay=5 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font
-}
-
-function msg_pyosd(){
-    /usr/LH/bin/xmsg.py -m "$1"
-}
+#
+# function msg_osd(){
+#     echo -e "$1"  | osd_cat --pos=middle --align=center --offset=200 --delay=5 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font
+# }
+#
+# function msg_pyosd(){
+#     /usr/LH/bin/xmsg.py -m "$1"
+# }
 
 function msg(){
-    if [ x$STARTUP_STYLE = xmythvantage ]
-    then
-        msg_pyosd "$1"
-    else
-        msg_osd "$1"
-    fi
-
+#     if [ x$STARTUP_STYLE = xmythvantage ]
+#     then
+#         msg_pyosd "$1"
+#     else
+#         msg_osd "$1"
+#     fi
+    /usr/LH/bin/lh_message.sh "$1"
 }
 
 
@@ -132,7 +132,7 @@ function run_tilda(){
 
         width=`/usr/bin/xwininfo -root|grep Width | awk '{ print $2}'`
         height=`/usr/bin/xwininfo -root|grep Height | awk '{ print $2}'`
-	center=$[width/2]
+        center=$[width/2]
         sixtypercent=`echo "scale=0; ( $width*.6) / 1" |bc`
         quarter_height=`echo "scale=0; ($height*.35) /1" |bc`
 
diff --git a/abs/core/LinHES-system/PKGBUILD b/abs/core/LinHES-system/PKGBUILD
index 73bfb69..3a0c60f 100644
--- a/abs/core/LinHES-system/PKGBUILD
+++ b/abs/core/LinHES-system/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=LinHES-system
 pkgver=2
-pkgrel=47
+pkgrel=50
 arch=('i686')
 MVDIR=$startdir/pkg/usr/LH
 BINDIR=$startdir/pkg/usr/bin
@@ -21,7 +21,7 @@ binfiles="LinHES-start optimize_mythdb.py
  lh_system_all_host_update
  add_storage.py
  diskspace.sh
- cacheclean"
+ cacheclean lh_message.sh switch_web.sh"
 
 source=(LinHES-session LinHES-profile.sh $binfiles alsa-base myth_mtc.lr 
  diskspace smolt.cron cacheclean.cron)
@@ -52,7 +52,7 @@ build() {
         mkdir $startdir/pkg/etc/logrotate.d
         cp $startdir/myth_mtc.lr $startdir/pkg/etc/logrotate.d
 }
-md5sums=('c26486418b0fc1eee4fc4e24c0a44988'
+md5sums=('e62397288e9b3b41c5ca2a73500db865'
          '5881bdb43d578ec3a79d1f77ea58a3db'
          'a875ee97f86e46f34a741c2bc455f894'
          '76b2637cac0452b3acdbeeb4e8a5474b'
@@ -76,6 +76,8 @@ md5sums=('c26486418b0fc1eee4fc4e24c0a44988'
          '6faeba0aeb38e772121f751cabda8683'
          '68e3e87571f3b0fa4a48a10df50dc220'
          '9603b0ca6e090eff31e76482a3c335e7'
+         'b798ee0796d1b760a2998f90eb8ce9cc'
+         '4a3cd8f9b33b2b86fdba47a8f1fa2859'
          'eb879fee9603a05d5420d4ce8ed9e450'
          'f1870a9522c79e6b248fcbf81dec3280'
          '84492954db16740f949d795b74383189'
diff --git a/abs/core/LinHES-system/lh_message.sh b/abs/core/LinHES-system/lh_message.sh
new file mode 100644
index 0000000..203d127
--- /dev/null
+++ b/abs/core/LinHES-system/lh_message.sh
@@ -0,0 +1,65 @@
+#!/bin/bash
+MYTH_RUN_STATUS="1"
+. /etc/profile
+. /etc/systemconfig
+
+
+if [ -e /etc/X11/WINDOWMANAGER ]
+then
+    . /etc/X11/WINDOWMANAGER
+fi
+
+
+. /etc/osd_cat.cfg || {
+        color=yellow
+        outline=2
+        outlinecolour=black
+        shadow=0
+        shadowcolour=black
+        font="-adobe-helvetica-bold-*-*-*-34-*-*-*-*-*-*-*"
+}
+
+function delay_osd(){
+    if [ x$STARTUP_STYLE = xmythvantage ]
+    then
+        cmd="ps -ef | grep -v grep | grep -q  xmsg.py"
+    else
+        cmd="ps -ef | grep -v grep | grep -q osd_cat"
+    fi
+
+    eval $cmd
+
+    rc=$?
+    while [ $rc = 0 ]
+    do
+        eval $cmd
+        rc=$?
+    done
+
+
+    }
+
+function msg_osd(){
+    DISPLAY=127.0.0.1:0   echo -e "$1"  | DISPLAY=127.0.0.1:0 osd_cat --pos=middle --align=center --offset=200 --delay=5 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font
+}
+
+function msg_pyosd(){
+    DISPLAY=127.0.0.1:0 /usr/LH/bin/xmsg.py -m "$1"
+}
+
+function msg(){
+    if [ x$STARTUP_STYLE = xmythvantage ]
+    then
+        msg_pyosd "$1"
+    else
+        msg_osd "$1"
+    fi
+
+}
+
+if [ x"${@}" = x ]
+then
+    print "nothing to display"
+else
+    msg "${@}"
+fi
diff --git a/abs/core/LinHES-system/switch_web.sh b/abs/core/LinHES-system/switch_web.sh
new file mode 100644
index 0000000..bf57764
--- /dev/null
+++ b/abs/core/LinHES-system/switch_web.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+#This script is used to switch the default homepage between supplementalweb and
+#the standard local webpage
+. /etc/systemconfig
+DATADIR=/data/srv/httpd/htdocs
+
+function rmindex {
+    if [ -L $DATADIR/index.html ]
+    then
+        rm -f $DATADIR/index.html
+    fi
+}
+
+if [ $SystemType = Master_backend -o  $SystemType = Standalone ]
+then
+    if [ x$1 = xsupplemental ]
+    then
+        rmindex
+        ln -s $DATADIR/alt_index.html $DATADIR/index.html
+   else
+       rmindex
+       ln -s $DATADIR/index.htm $DATADIR/index.html
+   fi
+else
+	echo "This service is only available for StandAlone or Master_backend LinHES systems"
+
+fi
+
+
-- 
cgit v0.12