From ddab9d26651122643ad4f993812c6bf38d9fd911 Mon Sep 17 00:00:00 2001 From: James Meyer Date: Wed, 21 Dec 2011 15:06:47 -0600 Subject: LinHES-system/config: add install_supplemental_service.sh This script will install and configure the extra web services and programs needed. LinHES-session: additional work on making the startup process a bit more modular. --- abs/core/LinHES-config/PKGBUILD | 4 +- abs/core/LinHES-config/systemconfig.py | 8 +- abs/core/LinHES-system/LinHES-session | 120 +++++++-------- abs/core/LinHES-system/PKGBUILD | 8 +- .../LinHES-system/install_supplemental_service.sh | 14 ++ abs/core/LinHES-system/xmsg.py | 163 +++++++++++++++++++++ 6 files changed, 244 insertions(+), 73 deletions(-) create mode 100644 abs/core/LinHES-system/install_supplemental_service.sh create mode 100644 abs/core/LinHES-system/xmsg.py diff --git a/abs/core/LinHES-config/PKGBUILD b/abs/core/LinHES-config/PKGBUILD index b373509..21b1614 100644 --- a/abs/core/LinHES-config/PKGBUILD +++ b/abs/core/LinHES-config/PKGBUILD @@ -1,6 +1,6 @@ pkgname=LinHES-config pkgver=2.3 -pkgrel=54 +pkgrel=55 conflicts=(MythVantage-config MythVantage-config-dev LinHES-config-dev LinHes-config ) pkgdesc="Install and configure your system" depends=('bc' 'libstatgrab' 'mysql-python' 'expect' 'curl' 'dnsutils' 'parted' @@ -133,6 +133,6 @@ md5sums=('f6bca2af75ddb0902f0fa9ff4b6e4fd7' 'f0988a801216b44c96bf17e24a23e3a9' '23d0e12b7ca1cc6ea6b993c1d7ff20b9' 'bce31dc826812d1b32003f77f9945ca9' - '892ba04c504b9be04b2573d015382eae' + '59dd4d49fd92a35f4111aa9b77fa21b6' '2596460462cf6c889cf8f95485537b20' 'a63ff9ef5250965aeabc74bfa8e43981') diff --git a/abs/core/LinHES-config/systemconfig.py b/abs/core/LinHES-config/systemconfig.py index aa94aec..a8bae81 100755 --- a/abs/core/LinHES-config/systemconfig.py +++ b/abs/core/LinHES-config/systemconfig.py @@ -62,7 +62,7 @@ def main(argv): global systemconfig systemconfig["MVROOT"]=MVROOT restartlcd = False - cmdmodule={"misc":False , "sleep":False , "hostype":False , "hostypec":False , "advanced":False , "audio":False , "network":False , "advancedX":False , "webuser":False , "restartfe":False , "reloadfe":False , "ddns":False , "screensaver":False , "ir":False , "this_is_install":False , "user":False, "software":False, "plugins":False, "smolt":False, "all":False, "dhcp_request":False } + cmdmodule={"misc":False , "sleep":False , "hostype":False , "hostypec":False , "advanced":False , "audio":False , "network":False , "advancedX":False , "webuser":False , "restartfe":False , "reloadfe":False , "ddns":False , "screensaver":False , "ir":False , "this_is_install":False , "user":False, "software":False, "plugins":False, "smolt":False, "all":False, "dhcp_request":False , "func":False} try: opts, args = getopt.getopt(argv, 'c:hm:d:', ["help","modules" ] ) except getopt.GetoptError, why: @@ -114,6 +114,12 @@ def main(argv): logging.debug(" Setting the frontend to restart due to network change") cmdmodule["restartfe"] = True + if cmdmodule["func"]: + from mv_hostype import setup_func_minion + setup_func_minion(systemconfig.get("dbhost"),systemconfig.get("hostname")) + + + if cmdmodule["hostype"]: import mv_hostype 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..9cc0aa9 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=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 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,7 +37,7 @@ build() { mkdir $startdir/pkg/etc/logrotate.d cp $startdir/myth_mtc.lr $startdir/pkg/etc/logrotate.d } -md5sums=('2836a90e5d191faae80fad37025a5c9b' +md5sums=('989c22c2eae00501f5b46f215dbf5e59' '5881bdb43d578ec3a79d1f77ea58a3db' 'a875ee97f86e46f34a741c2bc455f894' '76b2637cac0452b3acdbeeb4e8a5474b' @@ -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/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() + + -- cgit v0.12