From 094bbec4072b32b2d9d81fb94fd262f60611f7e8 Mon Sep 17 00:00:00 2001 From: James Meyer Date: Wed, 15 Aug 2012 11:10:16 -0500 Subject: LinHES-system: -updated for python2 -removed firstboot -added msg_client and msg_daemon -moved displaying help to later in the seq. LinHES-session now uses msg_client --- abs/core/LinHES-system/LinHES-session | 53 ++++++++++----------- abs/core/LinHES-system/PKGBUILD | 28 +++++++----- abs/core/LinHES-system/cacheclean | 2 +- abs/core/LinHES-system/create_media_dirs.sh | 71 +++++++++++++++++++++++++++++ abs/core/LinHES-system/diskspace.sh | 8 ++-- abs/core/LinHES-system/firstboot.sh | 2 +- abs/core/LinHES-system/lh_message.sh | 39 ++++++++-------- abs/core/LinHES-system/msg_client.py | 42 +++++++++++++++++ abs/core/LinHES-system/msg_daemon.py | 46 +++++++++++++++++++ abs/core/LinHES-system/myth_mtc.py | 6 +-- 10 files changed, 226 insertions(+), 71 deletions(-) mode change 100644 => 100755 abs/core/LinHES-system/PKGBUILD create mode 100644 abs/core/LinHES-system/create_media_dirs.sh create mode 100755 abs/core/LinHES-system/msg_client.py create mode 100755 abs/core/LinHES-system/msg_daemon.py diff --git a/abs/core/LinHES-system/LinHES-session b/abs/core/LinHES-system/LinHES-session index 918406d..8e5d72b 100755 --- a/abs/core/LinHES-system/LinHES-session +++ b/abs/core/LinHES-system/LinHES-session @@ -46,25 +46,25 @@ export MALLOC_CHECK_=0 # 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 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(){ # 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 @@ -75,13 +75,8 @@ function delay_osd(){ # } function msg(){ -# if [ x$STARTUP_STYLE = xmythvantage ] -# then -# msg_pyosd "$1" -# else -# msg_osd "$1" -# fi - /usr/LH/bin/lh_message.sh "$1" + #/usr/LH/bin/lh_message.sh "$1" + /usr/LH/bin/msg_client.py "$1" } @@ -180,7 +175,7 @@ function show_help_tip(){ if [ x$ShowTips = "x1" ] then - msg "Alt+h for help" & + msg "Alt+h for help" fi } @@ -286,7 +281,7 @@ function start_myth() { echo "=====================================================================" echo "Starting $STARTCMD" - firstboot.sh & + #firstboot.sh & #continue on with starting mythtv @@ -360,10 +355,10 @@ unclutter load_nvidia_settings run_tilda start_screensaver -show_help_tip notify_scan & update_apple_trailers first_configure +show_help_tip start_myth # wait for the windowmanger diff --git a/abs/core/LinHES-system/PKGBUILD b/abs/core/LinHES-system/PKGBUILD old mode 100644 new mode 100755 index 0dcefd7..8219d17 --- a/abs/core/LinHES-system/PKGBUILD +++ b/abs/core/LinHES-system/PKGBUILD @@ -1,16 +1,16 @@ pkgname=LinHES-system pkgver=2 -pkgrel=52 +pkgrel=54 arch=('i686' 'x86_64') MVDIR=$startdir/pkg/usr/LH BINDIR=$startdir/pkg/usr/bin #install=LinHES.install pkgdesc="scripts and things related to having an automated system" -depends=(linhes-sounds xdotool tilda keylaunch python_aosd 'linhes-scripts>=7-24' 'udisks' 'LinHES-config>=2.3-59' 'sudo') +depends=(linhes-sounds xdotool tilda keylaunch python_aosd 'linhes-scripts>=7-24' 'udisks' 'LinHES-config>=2.3-59' 'sudo' 'python2-dbus') 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 + load-modules-mythvantage.sh unclutter-toggle.sh tvterm.sh mythfrontend-start set_windowmanager.sh myth_status.py myth_status.sh @@ -21,9 +21,11 @@ binfiles="LinHES-start optimize_mythdb.py lh_system_all_host_update add_storage.py diskspace.sh - cacheclean lh_message.sh switch_web.sh" + cacheclean lh_message.sh switch_web.sh + create_media_dirs.sh + msg_client.py msg_daemon.py" -source=(LinHES-session LinHES-profile.sh $binfiles alsa-base myth_mtc.lr +source=(LinHES-session LinHES-profile.sh $binfiles alsa-base myth_mtc.lr diskspace smolt.cron cacheclean.cron) build() { @@ -44,7 +46,7 @@ build() { item=$i install -m755 -D $item $MVDIR/bin/$item echo $item - done + done install -m644 -D $startdir/src/alsa-base $startdir/pkg/etc/modprobe.d/alsa-base.conf install -m755 -D $startdir/src/smolt.cron $startdir/pkg/etc/cron.weekly/smolt.cron @@ -53,14 +55,13 @@ build() { mkdir $startdir/pkg/etc/logrotate.d cp $startdir/myth_mtc.lr $startdir/pkg/etc/logrotate.d } -md5sums=('d1a5963c5a440a608031c6d750232633' +md5sums=('c5bbcfbc2b426158d90e79103a524b7c' '5881bdb43d578ec3a79d1f77ea58a3db' 'a875ee97f86e46f34a741c2bc455f894' '76b2637cac0452b3acdbeeb4e8a5474b' - 'd1f27cb422010077c841376526fe46ea' + '781c977f8872543f033dad2caaf0458e' '2ef9f945e034119f77d9b6beb17e4fa5' '4b4585ccba30595cf958d202997c57f7' - 'cbe4cba14fa9d01a62e2196edc1bd98b' 'dc3eef2a624754e16805d72bbe488b67' 'dc0be354ce77ba2b89868fc29b942c43' '542e670e78d117657f93141e9689f54d' @@ -75,10 +76,13 @@ md5sums=('d1a5963c5a440a608031c6d750232633' '859a80ddb4c234506379c605114c1343' '47e093e8cfe4b5b96602358e1f540832' '6faeba0aeb38e772121f751cabda8683' - '68e3e87571f3b0fa4a48a10df50dc220' - '9603b0ca6e090eff31e76482a3c335e7' - 'b798ee0796d1b760a2998f90eb8ce9cc' + '8fb300778c0d9f03edb92fdd3d9f9158' + '6519d209e151cdc39ae7e1091d189c3e' + 'd318ea06dacdfe7a474121eac1f75be0' '4a3cd8f9b33b2b86fdba47a8f1fa2859' + '717b80d5069188ccef52001de0df0c21' + 'a182af47a7d373b2a63a27e1bb7485b2' + '5148fe4c6ac27fff8152c819c4d2b47a' 'eb879fee9603a05d5420d4ce8ed9e450' 'f1870a9522c79e6b248fcbf81dec3280' '84492954db16740f949d795b74383189' diff --git a/abs/core/LinHES-system/cacheclean b/abs/core/LinHES-system/cacheclean index d32d16b..cfc8d58 100755 --- a/abs/core/LinHES-system/cacheclean +++ b/abs/core/LinHES-system/cacheclean @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 """cacheclean - a simple python script to clean up the /data/var/cache/pacman/pkg directory. More versatile than 'pacman -Sc' in that you can select how many old versions to keep. diff --git a/abs/core/LinHES-system/create_media_dirs.sh b/abs/core/LinHES-system/create_media_dirs.sh new file mode 100644 index 0000000..0492feb --- /dev/null +++ b/abs/core/LinHES-system/create_media_dirs.sh @@ -0,0 +1,71 @@ +#!/bin/bash +#script to create the media directories +#call it like so +#create_media_dirs.sh /top_level_path + +topdir=$1 + +if [ x$topdir = "x" ] +then + echo "Top level dir is empty" + exit 1 +fi + +if [ ! -d "$topdir" ] +then + echo "$topdir is not a dir or does not exist" + exit 2 +fi + + + +while read dirname +do + mkdir -p "${topdir}/${dirname}" + touch "${topdir}/${dirname}/.media" + chown mythtv:users "${topdir}/${dirname}" + chmod 775 "${topdir}/${dirname}" + chmod 775 "${topdir}/${dirname}/.media" +done <>sys.stderr, 'connecting to %s' % server_address + try: + sock.connect(server_address) + except socket.error, msg: + print >>sys.stderr, msg + sys.exit(1) + try: + sock.sendall(message) + #amount_received = 0 + #amount_expected = len(message) + + #while amount_received < amount_expected: + # data = sock.recv(16) + # amount_received += len(data) + # print >>sys.stderr, 'received "%s"' % data + + finally: + #print >>sys.stderr, 'closing socket' + print "message sent" + sock.close() + + +if __name__ == "__main__": + if len(sys.argv) == 2: + send_message(sys.argv[1]) + else: + print "Unknown command" + print "usage: %s msg to display" % sys.argv[0] + sys.exit(2) + sys.exit(0) diff --git a/abs/core/LinHES-system/msg_daemon.py b/abs/core/LinHES-system/msg_daemon.py new file mode 100755 index 0000000..5ca5b09 --- /dev/null +++ b/abs/core/LinHES-system/msg_daemon.py @@ -0,0 +1,46 @@ +#!/usr/bin/python2 +#MythVantage osd message deamon. +#Use the client to send messages to localhost +import socket +import sys +import os +from subprocess import call + +server_address = '/run/msg_socket' + +# Make sure the socket does not already exist +try: + os.unlink(server_address) +except OSError: + if os.path.exists(server_address): + raise +# Create a UDS socket +sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) +# Bind the socket to the port +print >>sys.stderr, 'starting up on %s' % server_address +sock.bind(server_address) +#change permissions of socket +os.chmod(server_address,0777) + +# Listen for incoming connections +sock.listen(1) + +while True: + # Wait for a connection + connection, client_address = sock.accept() + try: + #print >>sys.stderr, 'connection from', client_address + msg="" + # Receive the data in small chunks and retransmit it + while True: + data = connection.recv(16) + msg+=data + if data: + continue + else: + call(["/usr/LH/bin/lh_message.sh", msg]) + break + + finally: + # Clean up the connection + connection.close() diff --git a/abs/core/LinHES-system/myth_mtc.py b/abs/core/LinHES-system/myth_mtc.py index 6fd53a7..a5f02a0 100755 --- a/abs/core/LinHES-system/myth_mtc.py +++ b/abs/core/LinHES-system/myth_mtc.py @@ -1,6 +1,4 @@ -#!/usr/bin/python - - +#!/usr/bin/python2 import sys, subprocess import optparse import re @@ -8,8 +6,6 @@ import socket import os import datetime,time - - try: from MythTV import MythBE mythtv = MythBE() -- cgit v0.12