summaryrefslogtreecommitdiffstats
path: root/abs/core/LinHES-system
diff options
context:
space:
mode:
authorCecil <knoppmyth@gmail.com>2011-12-22 01:57:32 (GMT)
committerCecil <knoppmyth@gmail.com>2011-12-22 01:57:32 (GMT)
commit7c37daf6c751f73b0785bc6b851c7cc662f65447 (patch)
treec46d56f3c3c283dc3de31577befbea1ec9ed1bcf /abs/core/LinHES-system
parent69701681f4cd221164da333d0ef0f1baf99bbf52 (diff)
parent02750b0fe64c4da69ff0dfc16178f1a79cec0b18 (diff)
downloadlinhes_pkgbuild-7c37daf6c751f73b0785bc6b851c7cc662f65447.zip
linhes_pkgbuild-7c37daf6c751f73b0785bc6b851c7cc662f65447.tar.gz
linhes_pkgbuild-7c37daf6c751f73b0785bc6b851c7cc662f65447.tar.bz2
Merge branch 'testing' of ssh://cesman@linhes.org/mount/repository/linhes_pkgbuild into testing
Diffstat (limited to 'abs/core/LinHES-system')
-rwxr-xr-xabs/core/LinHES-system/LinHES-session120
-rwxr-xr-xabs/core/LinHES-system/PKGBUILD12
-rw-r--r--abs/core/LinHES-system/install_supplemental_service.sh14
-rwxr-xr-xabs/core/LinHES-system/myth_mtc.py35
-rwxr-xr-xabs/core/LinHES-system/myth_mtc.sh2
-rw-r--r--abs/core/LinHES-system/xmsg.py163
6 files changed, 259 insertions, 87 deletions
diff --git a/abs/core/LinHES-system/LinHES-session b/abs/core/LinHES-system/LinHES-session
index 39a60b0..626d346 100755
--- a/abs/core/LinHES-system/LinHES-session
+++ b/abs/core/LinHES-system/LinHES-session
@@ -46,10 +46,24 @@ export MALLOC_CHECK_=0
font="-adobe-helvetica-bold-*-*-*-34-*-*-*-*-*-*-*"
}
-function msg(){
+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
+
+}
+
function unclutter(){
if [ -e /etc/unclutter ]
@@ -101,14 +115,14 @@ function run_tilda(){
center=$[width/2]
sixtypercent=`echo "scale=0; ( $width*.6) / 1" |bc`
quarter_height=`echo "scale=0; ($height*.35) /1" |bc`
-
- if [ $sixtypercent -lt 700 ]
+
+ if [ $sixtypercent -lt 700 ]
then
sixtypercent=700
fi
- if [ $quarter_height -lt 350 ]
+ if [ $quarter_height -lt 350 ]
then
quarter_height=350
fi
@@ -202,16 +216,14 @@ function first_configure_default(){
function first_configure_mv(){
if [ ! $SystemType = "Frontend_only" ]
then
- if [ ! -f ~/.configured ]
- then
- autocard.py -g &
- MythVantage -b
- #/root/autocard.py -g &
- #/usr/local/bin/mythinstall -b
-
- #0 yes
- #1 yes/autodetech
- #2 no
+ if [ -f ~/.configure ]
+ then
+ #for now skip these
+ #autocard.py -g &
+ #MythVantage -b
+ #0 yes
+ #1 yes/autodetech
+ #2 no
STATUS=$?
if [ ! $STATUS = 2 ]
then
@@ -219,9 +231,10 @@ function first_configure_mv(){
/usr/local/bin/mythtv-setup
/usr/bin/backend_control.sh start BE 127.0.0.1
fi
- touch ~/.configured
- fi
+ rm ~/.configure
+ fi
fi
+
}
function start_myth() {
@@ -242,65 +255,39 @@ function start_myth() {
then
start_myth_mv
else
- start_myth_default
+ run_myth
fi
}
-function start_myth_default(){
-
+function run_myth(){
if [ -f /tmp/nomfe ]
- then
- exit 0
- else
- if [ -f /tmp/debug ]
then
- echo "using gbd/debug"
- gdb /usr/bin/mythfrontend -x $MV_ROOT/mfegdbcommands.txt
- mv gdb.txt gdb.txt.mythfrontend
- sleep 10
+ exit 0
else
- killall -9 irexec
- /usr/bin/irexec -d
- $STARTCMD 2>&1 &
+ if [ -f /tmp/debug ]
+ then
+ echo "using gbd/debug"
+ gdb /usr/bin/mythfrontend -x $MV_ROOT/mfegdbcommands.txt
+ mv gdb.txt gdb.txt.mythfrontend
+ sleep 5
+ else
+ killall -9 irexec
+ /usr/bin/irexec -d
+ $STARTCMD 2>&1 &
+ fi
fi
- fi
-
-
-
-
}
function start_myth_mv(){
-
while [ x = x ]
do
- if [ -f /tmp/nomfe ]
- then
- sleep 120
- else
- if [ -f /tmp/debug ]
- then
-
- echo "using gbd/debug"
- gdb /usr/local/bin/mythfrontend -x $MV_ROOT/mfegdbcommands.txt
- bash -c "osdClient.pl localhost 5000 'Restart: mdb.txt.mythfrontend:::SYS' "&
- mv gdb.txt gdb.txt.mythfrontend
- sleep 10
-
- else
- killall -9 irexec
- /usr/bin/irexec &
- $STARTCMD 2>&1
- fi
- fi
- echo "_______________________________________________________"
+ run_myth
+ echo "_______________________________________________________"
done
-
-
- }
+}
function set_background()
@@ -317,11 +304,8 @@ then
else
#if using mythvantage style, start the WM right away
# this is done so that starting mythtv can loop.
-
- if [ x$STARTUP_STYLE = xmythvantage ]
- then
- $WM &
- fi
+ $WM &
+ pid=$!
mouse_move
keylaunch
set_background
@@ -330,14 +314,16 @@ else
run_tilda
start_screensaver
show_help_tip
- #update_apple_trailers
+ update_apple_trailers
+
first_configure
start_myth
- # start windowmanger
+ # wait for the windowmanger
+ #This will make the session wait on the WM to exit.
if [ x$STARTUP_STYLE != xmythvantage ]
then
- $WM
+ wait $pid
fi
fi
diff --git a/abs/core/LinHES-system/PKGBUILD b/abs/core/LinHES-system/PKGBUILD
index df31953..d0012c1 100755
--- a/abs/core/LinHES-system/PKGBUILD
+++ b/abs/core/LinHES-system/PKGBUILD
@@ -1,6 +1,6 @@
pkgname=LinHES-system
pkgver=2
-pkgrel=11
+pkgrel=13
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 an automated system"
depends=(linhes-sounds xdotool fluxbox tilda keylaunch python_aosd)
backup=(etc/modprobe.d/alsa-base)
-binfiles="LinHES-start optimize_mythdb.py myth_mtc.py myth_mtc.sh LinHES-run firstboot.sh load-modules-mythvantage.sh unclutter-toggle.sh tvterm.sh myth_mtc.lr smolt.cron mythfrontend-start set_windowmanager.sh myth_status.py myth_status.sh"
+binfiles="LinHES-start optimize_mythdb.py myth_mtc.py myth_mtc.sh LinHES-run firstboot.sh load-modules-mythvantage.sh unclutter-toggle.sh tvterm.sh myth_mtc.lr smolt.cron mythfrontend-start set_windowmanager.sh myth_status.py myth_status.sh xmsg.py install_supplemental_service.sh"
source=(LinHES-session LinHES-profile.sh $binfiles alsa-base)
@@ -37,12 +37,12 @@ build() {
mkdir $startdir/pkg/etc/logrotate.d
cp $startdir/myth_mtc.lr $startdir/pkg/etc/logrotate.d
}
-md5sums=('2836a90e5d191faae80fad37025a5c9b'
+md5sums=('989c22c2eae00501f5b46f215dbf5e59'
'5881bdb43d578ec3a79d1f77ea58a3db'
'a875ee97f86e46f34a741c2bc455f894'
'76b2637cac0452b3acdbeeb4e8a5474b'
- 'c60b6c66f498809a6e5ca18a8c97d336'
- 'ccae1296ef248fa52ec3a7cb820a476e'
+ '6a42d3799fad2ebffac2fbf2411511ed'
+ '2ef9f945e034119f77d9b6beb17e4fa5'
'f7ecc552a2823cae63d75f58dc7435c4'
'18a884a73344ff6eb74f63b49745e0f5'
'dc3eef2a624754e16805d72bbe488b67'
@@ -54,4 +54,6 @@ md5sums=('2836a90e5d191faae80fad37025a5c9b'
'dae4dfb638b11c8c79fb1424a60b762a'
'361bf81a6a117d61c3bc32dda91c4cb9'
'ce72aad1fc66c575f863d4bfbf65ce16'
+ 'd03aedeeeda0f5e9c1eb437411c88477'
+ '94ce8f1d5085c0db7b267db8c2e9a3ff'
'eb879fee9603a05d5420d4ce8ed9e450')
diff --git a/abs/core/LinHES-system/install_supplemental_service.sh b/abs/core/LinHES-system/install_supplemental_service.sh
new file mode 100644
index 0000000..d33cb18
--- /dev/null
+++ b/abs/core/LinHES-system/install_supplemental_service.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+. /etc/systemconfig
+if [ $SystemType = Master_backend -o $SystemType = Standalone ]
+then
+ pacman -S --noconfirm supplemental-web
+ add_service.sh certmaster
+ add_service.sh funcd
+ add_service.sh xymon-server
+else
+ echo "This service is only available for StandAlone or Master_backend LinHES systems"
+
+fi
+
+
diff --git a/abs/core/LinHES-system/myth_mtc.py b/abs/core/LinHES-system/myth_mtc.py
index 5505b0a..1ed6c88 100755
--- a/abs/core/LinHES-system/myth_mtc.py
+++ b/abs/core/LinHES-system/myth_mtc.py
@@ -1,7 +1,7 @@
#!/usr/bin/python
-import sys,popen2
+import sys, subprocess
import optparse
import re
import socket
@@ -10,11 +10,11 @@ import datetime,time
-try:
- from MythTV import MythTV
- mythtv = MythTV()
-except:
- mythtv = None
+#try:
+from MythTV import MythBE
+mythtv = MythBE()
+#except:
+# mythtv = None
#print mythtv.db.getSetting( 'Theme', socket.gethostname())
@@ -86,14 +86,21 @@ def in_use():
return False
def mfd_check():
- ismfd=popen2.Popen3('/bin/ps cax|/bin/grep -v grep |/bin/grep mythfilldatabase')
- ismfd.wait()
- mfdIdle=ismfd.poll()
- if mfdIdle == 0:
- print "mythfilldatabase is running"
- return False
- else:
- return True
+ ps = subprocess.Popen("ps ax -o pid= -o args= ", shell=True, stdout=subprocess.PIPE)
+ ps_pid = ps.pid
+ output = ps.stdout.read()
+ ps.stdout.close()
+ ps.wait()
+ proc_name="mythfilldatabase"
+ for line in output.split("\n"):
+ res = re.findall("(\d+) (.*)", line)
+ if res:
+ pid = int(res[0][0])
+ if proc_name in res[0][1] and pid != os.getpid() and pid != ps_pid:
+ print "mythfilldatabase is running"
+ return False
+
+ return True
diff --git a/abs/core/LinHES-system/myth_mtc.sh b/abs/core/LinHES-system/myth_mtc.sh
index 487513b..12486c4 100755
--- a/abs/core/LinHES-system/myth_mtc.sh
+++ b/abs/core/LinHES-system/myth_mtc.sh
@@ -3,7 +3,7 @@
logFile='/var/log/mythtv/myth_mtc.log'
date=`date +%Y-%m-%d`
-myth_mtc.py > $logFile 2>&1
+MYTHCONFDIR=/usr/share/mythtv myth_mtc.py > $logFile 2>&1
if [ $? = 0 ]
then
echo "Finished $date" >> $logFile
diff --git a/abs/core/LinHES-system/xmsg.py b/abs/core/LinHES-system/xmsg.py
new file mode 100644
index 0000000..669a796
--- /dev/null
+++ b/abs/core/LinHES-system/xmsg.py
@@ -0,0 +1,163 @@
+#!/usr/bin/python2
+# other modules
+
+import sys, string
+import aosd
+import ConfigParser
+import getopt
+
+
+# =================================
+
+
+class msg():
+ def scroll(self,osd, width, height, display_time,position):
+ pos = position
+ step = 1
+
+ osd.set_position(pos, width, height)
+ (x, y, _, _) = osd.get_geometry()
+ osd.set_position_offset(width, height)
+ osd.show()
+
+ x -= 1
+ y += height - 1;
+ for i in range(1, height + 1, step):
+ osd.loop_for(5)
+ y -= step
+ osd.set_geometry(x, y, width, i)
+
+ osd.set_position(pos, width, height)
+ osd.set_position_offset(-1, -1)
+ (x, y, _, _) = osd.get_geometry()
+ #time to display
+ osd.loop_for(display_time)
+
+ for i in range(height, 0, -step):
+ y += step
+ osd.set_geometry(x, y, width, i);
+ osd.loop_for(1);
+
+ osd.hide();
+
+ def setup(self,font_color,font_type):
+ osd = aosd.AosdText()
+ osd.set_transparency(aosd.TRANSPARENCY_COMPOSITE)
+ if osd.get_transparency() != aosd.TRANSPARENCY_COMPOSITE:
+ osd.set_transparency(aosd.TRANSPARENCY_NONE)
+
+ osd.geom_x_offset = 10
+ osd.geom_y_offset = 0
+
+ osd.back_color = "white"
+ osd.back_opacity = 50
+
+ osd.shadow_color = "black"
+ osd.shadow_opacity = 127
+ osd.shadow_x_offset = 2
+ osd.shadow_y_offset = 2
+
+ osd.fore_color = font_color
+ osd.fore_opacity = 255
+
+ osd.set_font(font_type)
+ osd.wrap = aosd.PANGO_WRAP_WORD_CHAR
+ osd.alignment = aosd.PANGO_ALIGN_LEFT
+ osd.set_layout_width(osd.get_screen_wrap_width())
+ return osd
+
+ def set_string(self, osd, text):
+ osd.set_text(text)
+ return osd.get_text_size()
+
+ def setup_config(self):
+ module_config = ConfigParser.RawConfigParser()
+ try:
+ module_config.read('/usr/MythVantage/etc/msg.cfg')
+ except:
+ pass
+ return module_config
+
+
+
+ def display (self,flags):
+ """
+ parse the msg for display.
+ """
+ try:
+ text,config_section=flags.split("|")
+ if config_section == '':
+ config_section="default"
+ except:
+ text=flags
+ config_section="default"
+
+ module_config = self.setup_config()
+
+ display_time=5000
+ position=6
+ font_color="green"
+ font_type="Times New Roman Italic 36"
+ try:
+ display_time = int(module_config.get(config_section,"display_time"))
+ except:
+ pass
+ try:
+ position = int(module_config.get(config_section,"position"))
+ except:
+ pass
+ try:
+ font_color = module_config.get(config_section,"font_color")
+ except:
+ pass
+ try:
+ font_type = module_config.get(config_section,"font_type")
+ except:
+ pass
+
+ #this bit of code converts a \n to EOL/BREAK
+ textline=text.split('\\n')
+ try:
+ textline.remove(' ')
+ except:
+ pass
+ text=chr(10).join(textline)
+
+ #cmd = sub_process.Popen("/usr/bin/wall %s" % text,stdout=sub_process.PIPE,shell=True)
+ #data = cmd.communicate()[0]
+ osd = self.setup(font_color, font_type)
+ width, height = self.set_string(osd, text)
+ self.scroll(osd, width, height, display_time, position)
+
+ return ("Message delivered")
+
+
+
+
+def main():
+ try:
+ opts, args = getopt.getopt(sys.argv[1:], "hm:", ["help", "msg="])
+ except getopt.GetoptError, err:
+ # print help information and exit:
+ print str(err) # will print something like "option -a not recognized"
+ usage()
+ sys.exit(2)
+ in_msg = None
+
+ for o, a in opts:
+ if o in ("-h", "--help"):
+ usage()
+ sys.exit()
+ elif o in ("-m", "--msg"):
+ in_msg = a
+ else:
+ assert False, "unhandled option"
+ txt_msg=in_msg
+ out_msg=msg()
+
+ out_msg.display(txt_msg)
+
+if __name__ == "__main__":
+ main()
+
+