From ab5cfcecea2c03037d5829f7cc8f19153b25b343 Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Mon, 16 Sep 2013 11:05:36 -0500
Subject: LinHES-system: linhes_update*: update to use msg_client.py

---
 abs/core/LinHES-system/PKGBUILD          | 14 +++---
 abs/core/LinHES-system/linhes_update.sh  | 80 +++++++++++++++-----------------
 abs/core/LinHES-system/linhes_update2.sh | 31 ++++---------
 abs/core/LinHES-system/linhes_update3.sh | 28 -----------
 4 files changed, 51 insertions(+), 102 deletions(-)
 delete mode 100644 abs/core/LinHES-system/linhes_update3.sh

diff --git a/abs/core/LinHES-system/PKGBUILD b/abs/core/LinHES-system/PKGBUILD
index 3b9b419..5bc00d4 100755
--- a/abs/core/LinHES-system/PKGBUILD
+++ b/abs/core/LinHES-system/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=LinHES-system
 pkgver=8.0
-pkgrel=7
+pkgrel=8
 arch=('i686' 'x86_64')
 install=system.install
 pkgdesc="Everything that makes LinHES an automated system"
@@ -9,7 +9,7 @@ depends=('linhes-sounds' 'xdotool' 'tilda' 'keylaunch'
         'python_aosd' 'linhes-scripts>=7-24' 'udisks' 
         'LinHES-config>=2.3-59' 'sudo' 'python2-dbus' 'unclutter'
         'wmctrl' 'archlinux-xdg-menu' 'ethtool' 'gnu-netcat')
-backup=('etc/modprobe.d/alsa-base')
+backup=('etc/modprobe.d/alsa-base.conf')
 binfiles="LinHES-start optimize_mythdb.py myth_mtc.py myth_mtc.sh
  LinHES-run load-modules-mythvantage.sh unclutter-toggle.sh tvterm.sh
  mythfrontend-start set_windowmanager.sh myth_status.py myth_status.sh
@@ -23,11 +23,10 @@ binfiles="LinHES-start optimize_mythdb.py myth_mtc.py myth_mtc.sh
  misc_upcoming_recordings.pl misc_which_recorder.pl
  change_channel.sh change_channel_wrapper.sh
  be_check.py checkXFSfrag.sh find_orphans.py idle.sh xwin_find.sh
- linhes_update.sh linhes_update2.sh linhes_update3.sh
+ linhes_update.sh linhes_update2.sh
  mythwelcome-config.py mythwelcome-set-alarm.sh mythwelcome-test-wakeup.sh"
 
-source=(LinHES-session
-    LinHES-profile.sh $binfiles
+source=(LinHES-session LinHES-profile.sh $binfiles
     alsa-base myth_mtc.lr
     diskspace.cron cacheclean.cron xfs_defrag.cron
     readme_is_xml readme_light add_storage.readme
@@ -120,9 +119,8 @@ md5sums=('8fc4b7c1ddf8f3c4d2266ce55086b4d4'
          '34fc1f58ad1eabf4eff4979d420760c0'
          'c3ada01d3a739abe3f920b02d4ea3f6e'
          'a94fe6d980f4b810f2e2ae5352084b39'
-         '9d077c24d102fa02e4f417d639d8b00a'
-         '98979920c30bb48c02d00f6943e9e50e'
-         '460861e6d0cf999629b734912eea0acf'
+         'e1011e0df090372cccc03ecf9d6805c7'
+         'd14335afe7dafa035a70399210e0df1a'
          '92950f0ffb1faf1ed64c6be2b8fbc3f6'
          '95c092f67036a361ef7a57436f44332e'
          '410795ef9039e4c6c0484e706ecfd567'
diff --git a/abs/core/LinHES-system/linhes_update.sh b/abs/core/LinHES-system/linhes_update.sh
index e5dd2ad..87ac8a1 100644
--- a/abs/core/LinHES-system/linhes_update.sh
+++ b/abs/core/LinHES-system/linhes_update.sh
@@ -1,37 +1,27 @@
 #!/bin/bash
+#Called from LinHES Service Menu Check for Updates Menu
 
-#----------------------------------------------------------------------------
-. /etc/osd_cat.cfg || {
-	color=yellow
-	outline=2
-	outlinecolour=black
-	shadow=0
-	shadowcolour=black
-	font="-adobe-helvetica-bold-*-*-*-34-*-*-*-*-*-*-*"
-}
-#----------------------------------------------------------------------------
 dsply ()  {
-	if grep -q Updates\ Available /usr/share/mythtv/themes/defaultmenu/linhes.xml
-		then
-		killall -9 osd_cat
-		echo -e "\nUpdates available!\nExit and re-enter Service Menu\n to install the updates." | osd_cat --pos=middle --align=center --delay=5 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font &
-		echo -e "\nUpdates available!\nExit and re-enter Service Menu\n to install the updates." | osd_cat --pos=middle --align=center --delay=5 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font &
+    if grep -q Updates\ Available /usr/share/mythtv/themes/defaultmenu/linhes.xml
+    then
+        msg_client.py --clear --tag "checkUpdates"
+        msg_client.py --kill
+        msg_client.py --msg "Updates available!\nExit and re-enter Service Menu\nto install the updates.|middle"
 		exit
-		else
-		killall -9 osd_cat
-		echo -e "Checking for updates..." | osd_cat --pos=middle --align=center --delay=300 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font &
-		echo -e "Checking for updates..." | osd_cat --pos=middle --align=center --delay=300 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font &
-	fi
+    else
+        msg_client.py --msg "Checking for updates...|middle" --timeout 600 --tag "checkUpdates"
+    fi
 }
+
 chck ()  {
 	sudo pacman -Sy
 	sudo pacman -Qu > /tmp/to_be_upgraded
 	if [[ ! -s /tmp/to_be_upgraded ]]
-		then
-		killall -9 osd_cat
-		echo -e "\nNo updates available." | osd_cat --pos=middle --align=center --delay=5 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font &
-		echo -e "\nNo updates available." | osd_cat --pos=middle --align=center --delay=5 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font &
-		else
+	then
+        msg_client.py --clear --tag "checkUpdates"
+        msg_client.py --kill
+		msg_client.py --msg "No updates available.|middle"
+	else
 		mv /usr/share/mythtv/themes/defaultmenu/linhes.xml /tmp/linhes.xml.tmp
 		sed -e '/\#Check/,/\#Check/d' < /tmp/linhes.xml.tmp > /usr/share/mythtv/themes/defaultmenu/linhes.xml
 		mv /usr/share/mythtv/themes/defaultmenu/linhes.xml /tmp
@@ -47,28 +37,32 @@ chck ()  {
 		mv /tmp/linhes.xml.tmp /usr/share/mythtv/themes/defaultmenu/linhes.xml
 
 		echo "<mythmenu name=\"LinHES\">" > /tmp/update3.xml.tmp
-		if grep kernel26 /tmp/to_be_upgraded || grep nvidia /tmp/to_be_upgraded
- 			then
-                        echo "" >> /tmp/update3.xml.tmp
-                        echo "   <button>" >> /tmp/update3.xml.tmp
-                        echo "     <type>UPGRADE</type>" >> /tmp/update3.xml.tmp
-                        echo "     <text>REBOOT REQUIRED</text>" >> /tmp/update3.xml.tmp
-                        echo "     <action>NONE</action>" >> /tmp/update3.xml.tmp
-                        echo "   </button>" >> /tmp/update3.xml.tmp
+		
+        #check for kernel update and warn reboot is required
+        if grep linux /tmp/to_be_upgraded || grep nvidia /tmp/to_be_upgraded
+ 		then
+            echo "" >> /tmp/update3.xml.tmp
+            echo "   <button>" >> /tmp/update3.xml.tmp
+            echo "     <type>UPGRADE</type>" >> /tmp/update3.xml.tmp
+            echo "     <text>REBOOT REQUIRED</text>" >> /tmp/update3.xml.tmp
+            echo "     <action>NONE</action>" >> /tmp/update3.xml.tmp
+            echo "   </button>" >> /tmp/update3.xml.tmp
 		fi
-
+        
+        #create menu items for each pkg to be upgraded
 		while read line; do
-                        echo "" >> /tmp/update3.xml.tmp
-                        echo "   <button>" >> /tmp/update3.xml.tmp
-                        echo "     <type>UPGRADE</type>" >> /tmp/update3.xml.tmp
-                        echo "     <text>$line</text>" >> /tmp/update3.xml.tmp
-                        echo "     <action>NONE</action>" >> /tmp/update3.xml.tmp
-                        echo "   </button>" >> /tmp/update3.xml.tmp
-                done < "/tmp/to_be_upgraded"
-                echo "</mythmenu>" >> /tmp/update3.xml.tmp
-                mv /tmp/update3.xml.tmp /usr/share/mythtv/themes/defaultmenu/update3.xml
+            echo "" >> /tmp/update3.xml.tmp
+            echo "   <button>" >> /tmp/update3.xml.tmp
+            echo "     <type>UPGRADE</type>" >> /tmp/update3.xml.tmp
+            echo "     <text>$line</text>" >> /tmp/update3.xml.tmp
+            echo "     <action>NONE</action>" >> /tmp/update3.xml.tmp
+            echo "   </button>" >> /tmp/update3.xml.tmp
+        done < "/tmp/to_be_upgraded"
+        echo "</mythmenu>" >> /tmp/update3.xml.tmp
+        mv /tmp/update3.xml.tmp /usr/share/mythtv/themes/defaultmenu/update3.xml
   		dsply
 	fi
 	}
+
 dsply
 chck
diff --git a/abs/core/LinHES-system/linhes_update2.sh b/abs/core/LinHES-system/linhes_update2.sh
index d6984ed..cd04e3d 100644
--- a/abs/core/LinHES-system/linhes_update2.sh
+++ b/abs/core/LinHES-system/linhes_update2.sh
@@ -1,34 +1,19 @@
 #!/bin/bash
 
-#----------------------------------------------------------------------------
-. /etc/osd_cat.cfg || {
-	color=yellow
-	outline=2
-	outlinecolour=black
-	shadow=0
-	shadowcolour=black
-	font="-adobe-helvetica-bold-*-*-*-34-*-*-*-*-*-*-*"
-}
-#----------------------------------------------------------------------------
 
 if [[ "$1" = "install" ]]
 then
-	killall -9 osd_cat
-	echo -e "Updating..." | osd_cat --pos=middle --align=center --delay=300000 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font & 
-	echo -e "Updating..." | osd_cat --pos=middle --align=center --delay=300000 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font &
-	sudo pacman -Suf --noconfirm && sudo killall -9 osd_cat
-	killall -9 osd_cat
-	echo -e "\nUpdates complete." | osd_cat --pos=middle --align=center --delay=3 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font &
-	echo -e "\nUpdates complete." | osd_cat --pos=middle --align=center --delay=3 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font &
-	if grep kernel26 /tmp/to_be_upgraded || grep nvidia /tmp/to_be_upgraded
+    msg_client.py --msg "Updating...|middle" --timeout 600 --tag "Updating"
+	sudo pacman -Suf --noconfirm
+    msg_client.py --clear --tag "Updating"
+    msg_client.py --kill
+    msg_client.py --msg "Updates complete.|middle"
+	if grep linux /tmp/to_be_upgraded || grep nvidia /tmp/to_be_upgraded
 	then
-		echo -e "\n\nUpdates require a reboot." | osd_cat --pos=middle --align=center --delay=3 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font &
-		echo -e "\n\nUpdates require a reboot." | osd_cat --pos=middle --align=center --delay=3 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font &
+        msg_client.py --msg "Updates require a reboot.|middle"
 	fi
 else
-	killall -9 osd_cat
-	echo -e "\nUpdates canceled." | osd_cat --pos=middle --align=center --delay=3 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font &
-	echo -e "\nUpdates canceled." | osd_cat --pos=middle --align=center --delay=3 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font &
+    msg_client.py --msg "Updates canceled.|middle"
 fi
 
 rm -fr /tmp/to_be_upgraded
diff --git a/abs/core/LinHES-system/linhes_update3.sh b/abs/core/LinHES-system/linhes_update3.sh
deleted file mode 100644
index 72641db..0000000
--- a/abs/core/LinHES-system/linhes_update3.sh
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/bin/bash
-#----------------------------------------------------------------------------
-. /etc/osd_cat.cfg || {
-	color=yellow
-	outline=2
-	outlinecolour=black
-	shadow=0
-	shadowcolour=black
-	font="-adobe-helvetica-bold-*-*-*-34-*-*-*-*-*-*-*"
-}
-#----------------------------------------------------------------------------
-
-sudo killall osd_cat
-cat /tmp/to_be_upgraded | sed 's/ /\n/g' | sed '/^$/d' | grep - > /tmp/to_be_upgraded2
-COUNT=$(wc -l /tmp/to_be_upgraded2 | awk '{print $1}')
-if [ $COUNT -lt 20 ]
-	then
-	cat /tmp/to_be_upgraded2 | osd_cat --lines=20 --pos=top --align=center --delay=12 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font &
-	else
-	cat /tmp/to_be_upgraded2 | osd_cat --lines=20 --pos=top --align=center --delay=1 --wait --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font &
-fi
-if grep kernel26 /tmp/to_be_upgraded2
-then
-	killall -9 osd_cat
-	echo -e "Please note:\The kernel will be upgraded.\nThis will require a reboot.\nPlease do so when no jobs are running." | osd_cat --pos=middle --align=center --delay=10 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font
-else
-	exit
-fi
-- 
cgit v0.12