diff options
author | James Meyer <james.meyer@operamail.com> | 2012-08-15 16:10:16 (GMT) |
---|---|---|
committer | James Meyer <james.meyer@operamail.com> | 2012-08-15 16:10:16 (GMT) |
commit | 094bbec4072b32b2d9d81fb94fd262f60611f7e8 (patch) | |
tree | 3f8f21dbc101581d8e5055ca1dd687b0b0995fb6 /abs/core/LinHES-system | |
parent | 7279cd5152033f4d20b55392559581a8df72b66f (diff) | |
download | linhes_pkgbuild-094bbec4072b32b2d9d81fb94fd262f60611f7e8.zip linhes_pkgbuild-094bbec4072b32b2d9d81fb94fd262f60611f7e8.tar.gz linhes_pkgbuild-094bbec4072b32b2d9d81fb94fd262f60611f7e8.tar.bz2 |
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
Diffstat (limited to 'abs/core/LinHES-system')
-rwxr-xr-x | abs/core/LinHES-system/LinHES-session | 53 | ||||
-rwxr-xr-x[-rw-r--r--] | abs/core/LinHES-system/PKGBUILD | 28 | ||||
-rwxr-xr-x | abs/core/LinHES-system/cacheclean | 2 | ||||
-rw-r--r-- | abs/core/LinHES-system/create_media_dirs.sh | 71 | ||||
-rwxr-xr-x | abs/core/LinHES-system/diskspace.sh | 8 | ||||
-rwxr-xr-x | abs/core/LinHES-system/firstboot.sh | 2 | ||||
-rw-r--r-- | abs/core/LinHES-system/lh_message.sh | 39 | ||||
-rwxr-xr-x | abs/core/LinHES-system/msg_client.py | 42 | ||||
-rwxr-xr-x | abs/core/LinHES-system/msg_daemon.py | 46 | ||||
-rwxr-xr-x | abs/core/LinHES-system/myth_mtc.py | 6 |
10 files changed, 226 insertions, 71 deletions
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 index 0dcefd7..8219d17 100644..100755 --- 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 <<EOF +tv +gallery +music +games/nes/roms +games/nes/screens +games/nes +games/pc/screens +games/pc +games/snes/roms +games/snes/screens +games/snes +games/xmame/cabs +games/xmame/flyers +games/xmame/hiscores +games/xmame/history +games/xmame/roms +games/xmame/screens +games/xmame +games +backup +image_cache +video/.covers +video/archive +video +motion +tmp +archive +stream +pretty +video_stuff/trailers +video_stuff/coverart +video_stuff/fanart +video_stuff/screenshots +video_stuff/banners +games/screenshots +games/fanart +games/boxart +system_backups/restore +EOF + +chown -R mythtv:users ${topdir} +chmod -R 775 ${topdir} diff --git a/abs/core/LinHES-system/diskspace.sh b/abs/core/LinHES-system/diskspace.sh index 2173c6e..34e00cf 100755 --- a/abs/core/LinHES-system/diskspace.sh +++ b/abs/core/LinHES-system/diskspace.sh @@ -11,10 +11,10 @@ ALERT=90 # free space percentage to trigger an alert # Static Binary Paths # DF='/bin/df' -GREP='/bin/grep' -AWK='/bin/awk' -CUT='/bin/cut' -HOSTNAME='/bin/hostname' +GREP='/usr/bin/grep' +AWK='/usr/bin/awk' +CUT='/usr/bin/cut' +HOSTNAME='/usr/bin/hostname' DATE='/bin/date' OSD_CAT='/usr/bin/osd_cat' export DISPLAY=:0.0 diff --git a/abs/core/LinHES-system/firstboot.sh b/abs/core/LinHES-system/firstboot.sh index c405df8..2b974a2 100755 --- a/abs/core/LinHES-system/firstboot.sh +++ b/abs/core/LinHES-system/firstboot.sh @@ -55,7 +55,7 @@ then fb_status=4 while [ $fb_status != 0 ] do - fix_lirc_socket +# fix_lirc_socket # try_smolt if [ $fb_status != 0 ] then diff --git a/abs/core/LinHES-system/lh_message.sh b/abs/core/LinHES-system/lh_message.sh index 203d127..deddcff 100644 --- a/abs/core/LinHES-system/lh_message.sh +++ b/abs/core/LinHES-system/lh_message.sh @@ -19,25 +19,26 @@ fi 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(){ 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 @@ -59,7 +60,7 @@ function msg(){ if [ x"${@}" = x ] then - print "nothing to display" + echo "nothing to display" else msg "${@}" fi diff --git a/abs/core/LinHES-system/msg_client.py b/abs/core/LinHES-system/msg_client.py new file mode 100755 index 0000000..3c53857 --- /dev/null +++ b/abs/core/LinHES-system/msg_client.py @@ -0,0 +1,42 @@ +#!/usr/bin/python2 +#client for msg_daemon + +import socket +import sys + +# Create a UDS socket +sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) + +# Connect the socket to the port where the server is listening +server_address = '/run/msg_socket' +def send_message(message): + #print >>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() |