From 214fa024f53003b4ce5aa0a7888f12f80684703f Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Mon, 23 Nov 2015 17:54:42 +0000
Subject: LinHES-system: linhes_update.sh & linhes_update2.sh: fix linhes.xml
 from being incomplete

grep 2.22 changed of behavior so changed the options

don't use pkill -USR1 mythfrontend as it causes some keybindings to not work after.
---
 abs/core/LinHES-system/PKGBUILD          |  6 +--
 abs/core/LinHES-system/linhes_update.sh  | 72 +++++++++++++-------------------
 abs/core/LinHES-system/linhes_update2.sh | 49 ++++++++++------------
 3 files changed, 54 insertions(+), 73 deletions(-)

diff --git a/abs/core/LinHES-system/PKGBUILD b/abs/core/LinHES-system/PKGBUILD
index e3c1700..e8f220d 100755
--- a/abs/core/LinHES-system/PKGBUILD
+++ b/abs/core/LinHES-system/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=LinHES-system
 pkgver=8.3
-pkgrel=19
+pkgrel=20
 arch=('i686' 'x86_64')
 install=system.install
 pkgdesc="Everything that makes LinHES an automated system"
@@ -124,8 +124,8 @@ md5sums=('76842f8cff548d2c1289e0992a8b84dd'
          'cd28dd67a78f3b7da704e31db0298916'
          'e9f545c3bcf9c85b45496c281fc6a1b8'
          'a94fe6d980f4b810f2e2ae5352084b39'
-         '384956b4fd9bf40907856bab0e67b169'
-         'f4ce577e2ab1b6dbf9def46a8ab86e2d'
+         '0d1632ea63d8145c173c6aecf0b007f0'
+         'ff689f2e9572a78d88384b2e5774f579'
          '28f29578e5b3ba84fdf2aa57cf475bcf'
          '4a1fda884dcd7d65fb2690fbdbd92a83'
          '2b7fe3b57592823a4c7e3ec132dcb7f4'
diff --git a/abs/core/LinHES-system/linhes_update.sh b/abs/core/LinHES-system/linhes_update.sh
index d563504..3ac2a56 100644
--- a/abs/core/LinHES-system/linhes_update.sh
+++ b/abs/core/LinHES-system/linhes_update.sh
@@ -9,17 +9,6 @@ usage () {
     exit $1
 }
 
-restart_mfe () {
-    #check if started from mythfrontend-start and if so just kill mfe
-    #otherwise reload mfe
-    if [[ `pgrep -fx "/bin/bash /usr/LH/bin/mythfrontend-start"` ]]
-    then
-        killall mythfrontend
-    else
-        pkill -USR1 mythfrontend
-    fi
-}
-
 dsply ()  {
     if grep -q "Updates Available" /usr/share/mythtv/themes/defaultmenu/linhes.xml
     then
@@ -28,10 +17,10 @@ dsply ()  {
             msg_client.py --kill
             msg_client.py --msg "Updates available!\nGo to the Service Menu to install the updates.|middle"
         else
-            restart_mfe
+            killall mythfrontend
         fi
         echo "    Updates available!"
-		exit
+        exit
     else
         [ "$1" = false ] && { msg_client.py --msg "Checking for updates...|middle" --timeout 600 --tag "checkUpdates"; }
         echo "    Checking for updates..."
@@ -39,11 +28,11 @@ dsply ()  {
 }
 
 chck ()  {
-	sudo pacman -Sy
+    sudo pacman -Sy
     [ -f /tmp/to_be_upgraded ] && sudo rm /tmp/to_be_upgraded
-	sudo pacman -Qu > /tmp/to_be_upgraded
-	if [[ ! -s /tmp/to_be_upgraded ]]
-	then
+    sudo pacman -Qu > /tmp/to_be_upgraded
+    if [[ ! -s /tmp/to_be_upgraded ]]
+    then
         #hide LinHES update message on main menu
         echo "    Hiding update message in LinHES theme."
         sudo sed -i '/LinHES UPDATE MESSAGE/c\        <!--LinHES UPDATE MESSAGE' /usr/share/mythtv/themes/LinHES/menu-ui.xml
@@ -51,33 +40,33 @@ chck ()  {
         if [ "$1" = false ]; then
             msg_client.py --clear --tag "checkUpdates"
             msg_client.py --kill
-		    msg_client.py --msg "No updates available.\nReturning to Main Menu.|middle"
+            msg_client.py --msg "No updates available.\nReturning to Main Menu.|middle"
         else
-            restart_mfe
+            killall mythfrontend
         fi
         echo "    No updates available."
-	else
+    else
         echo "    Update menu to show Updates Available."
-		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
-		grep -v -e /mythmenu /tmp/linhes.xml > /tmp/linhes.xml.tmp
-		echo "<!--#UpdatesAvailable-->" >> /tmp/linhes.xml.tmp
-		echo "   <button>" >> /tmp/linhes.xml.tmp
-		echo "     <type>UPGRADE</type>" >> /tmp/linhes.xml.tmp
-		echo "     <text>Updates Available</text>" >> /tmp/linhes.xml.tmp
-		echo "     <description>Updates for the LinHES system</description>" >> /tmp/linhes.xml.tmp
-		echo "     <action>MENU update2.xml</action>" >> /tmp/linhes.xml.tmp
-		echo "   </button>" >> /tmp/linhes.xml.tmp
-		echo "<!--#UpdatesAvailable-->" >> /tmp/linhes.xml.tmp
-		echo "</mythmenu>" >> /tmp/linhes.xml.tmp
-		mv /tmp/linhes.xml.tmp /usr/share/mythtv/themes/defaultmenu/linhes.xml
+        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
+        grep -va '/mythmenu' /tmp/linhes.xml > /tmp/linhes.xml.tmp
+        echo "<!--#UpdatesAvailable-->" >> /tmp/linhes.xml.tmp
+        echo "   <button>" >> /tmp/linhes.xml.tmp
+        echo "     <type>UPGRADE</type>" >> /tmp/linhes.xml.tmp
+        echo "     <text>Updates Available</text>" >> /tmp/linhes.xml.tmp
+        echo "     <description>Updates for the LinHES system</description>" >> /tmp/linhes.xml.tmp
+        echo "     <action>MENU update2.xml</action>" >> /tmp/linhes.xml.tmp
+        echo "   </button>" >> /tmp/linhes.xml.tmp
+        echo "<!--#UpdatesAvailable-->" >> /tmp/linhes.xml.tmp
+        echo "</mythmenu>" >> /tmp/linhes.xml.tmp
+        mv /tmp/linhes.xml.tmp /usr/share/mythtv/themes/defaultmenu/linhes.xml
 
-		echo "<mythmenu name=\"LH_UPDATE\">" > /tmp/update3.xml.tmp
+        echo "<mythmenu name=\"LH_UPDATE\">" > /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
+        then
             echo "" >> /tmp/update3.xml.tmp
             echo "   <button>" >> /tmp/update3.xml.tmp
             echo "     <type>UPGRADE</type>" >> /tmp/update3.xml.tmp
@@ -85,10 +74,10 @@ chck ()  {
             echo "     <description>Some packages require a reboot</description>" >> /tmp/update3.xml.tmp
             echo "     <action>NONE</action>" >> /tmp/update3.xml.tmp
             echo "   </button>" >> /tmp/update3.xml.tmp
-		fi
+        fi
 
         #create menu items for each pkg to be upgraded
-		while read line; do
+        while read line; do
             echo "" >> /tmp/update3.xml.tmp
             echo "   <button>" >> /tmp/update3.xml.tmp
             echo "     <type>UPGRADE</type>" >> /tmp/update3.xml.tmp
@@ -104,9 +93,9 @@ chck ()  {
         echo "    Showing update message in LinHES theme."
         sudo sed -i '/LinHES UPDATE MESSAGE/c\        <!--LinHES UPDATE MESSAGE-->' /usr/share/mythtv/themes/LinHES/menu-ui.xml
 
-  		dsply $1
-	fi
-	}
+        dsply $1
+    fi
+    }
 
 # Command line argument handling
 SILENT=false
@@ -123,4 +112,3 @@ shift $(($OPTIND - 1))
 
 dsply $SILENT
 chck $SILENT
-#pkill -USR1 mythfrontend
diff --git a/abs/core/LinHES-system/linhes_update2.sh b/abs/core/LinHES-system/linhes_update2.sh
index 5c05c99..6c249d3 100644
--- a/abs/core/LinHES-system/linhes_update2.sh
+++ b/abs/core/LinHES-system/linhes_update2.sh
@@ -4,14 +4,14 @@
 if [[ "$1" = "install" ]]
 then
     msg_client.py --msg "Updating...|middle" --timeout 600 --tag "Updating"
-	sudo pacman -Su --force --noconfirm
+    sudo pacman -Su --force --noconfirm
     msg_client.py --clear --tag "Updating"
     msg_client.py --kill
     msg_client.py --msg "Updates complete.\nReturning to Main Menu.|middle"
-	if grep linux /tmp/to_be_upgraded || grep nvidia /tmp/to_be_upgraded
-	then
+    if grep linux /tmp/to_be_upgraded || grep nvidia /tmp/to_be_upgraded
+    then
         msg_client.py --msg "Updates require a reboot.|middle"
-	fi
+    fi
 else
     msg_client.py --msg "Updates canceled.|middle"
 fi
@@ -20,32 +20,25 @@ sudo rm -fr /tmp/to_be_upgraded
 
 if grep -q Updates\ Available /usr/share/mythtv/themes/defaultmenu/linhes.xml
 then
-	mv /usr/share/mythtv/themes/defaultmenu/linhes.xml /tmp/linhes.xml.tmp
-	sed -e '/\#UpdatesAv/,/\#UpdatesAv/d' < /tmp/linhes.xml.tmp > /usr/share/mythtv/themes/defaultmenu/linhes.xml
-	mv /usr/share/mythtv/themes/defaultmenu/linhes.xml /tmp
-	grep -v -e /mythmenu /tmp/linhes.xml > /tmp/linhes.xml.tmp
-	echo "<!--#Check for updates-->" >> /tmp/linhes.xml.tmp
-	echo "   <button>" >> /tmp/linhes.xml.tmp
-	echo "     <type>UPGRADE</type>" >> /tmp/linhes.xml.tmp
-	echo "     <text>Update LinHES</text>" >> /tmp/linhes.xml.tmp
-	echo "     <description>Update the LinHES system</description>" >> /tmp/linhes.xml.tmp
-	echo "     <action>MENU update.xml</action>" >> /tmp/linhes.xml.tmp
-	echo "   </button>" >> /tmp/linhes.xml.tmp
-	echo "<!--#Check for updates-->" >> /tmp/linhes.xml.tmp
-	echo "" >> /tmp/linhes.xml.tmp
-	echo "</mythmenu>" >> /tmp/linhes.xml.tmp
-	mv /tmp/linhes.xml.tmp /usr/share/mythtv/themes/defaultmenu/linhes.xml
+    mv /usr/share/mythtv/themes/defaultmenu/linhes.xml /tmp/linhes.xml.tmp
+    sed -e '/\#UpdatesAv/,/\#UpdatesAv/d' < /tmp/linhes.xml.tmp > /usr/share/mythtv/themes/defaultmenu/linhes.xml
+    mv /usr/share/mythtv/themes/defaultmenu/linhes.xml /tmp
+    grep -va '/mythmenu' /tmp/linhes.xml > /tmp/linhes.xml.tmp
+    echo "<!--#Check for updates-->" >> /tmp/linhes.xml.tmp
+    echo "   <button>" >> /tmp/linhes.xml.tmp
+    echo "     <type>UPGRADE</type>" >> /tmp/linhes.xml.tmp
+    echo "     <text>Update LinHES</text>" >> /tmp/linhes.xml.tmp
+    echo "     <description>Update the LinHES system</description>" >> /tmp/linhes.xml.tmp
+    echo "     <action>MENU update.xml</action>" >> /tmp/linhes.xml.tmp
+    echo "   </button>" >> /tmp/linhes.xml.tmp
+    echo "<!--#Check for updates-->" >> /tmp/linhes.xml.tmp
+    echo "" >> /tmp/linhes.xml.tmp
+    echo "</mythmenu>" >> /tmp/linhes.xml.tmp
+    mv /tmp/linhes.xml.tmp /usr/share/mythtv/themes/defaultmenu/linhes.xml
 fi
 
 #hide LinHES update message on main menu
 sudo sed -i '/LinHES UPDATE MESSAGE/c\        <!--LinHES UPDATE MESSAGE' /usr/share/mythtv/themes/LinHES/menu-ui.xml
 
-#reload theme
-#check if started from mythfrontend-start and if so just kill mfe
-#otherwise reload mfe
-if [[ `pgrep -fx "/bin/bash /usr/LH/bin/mythfrontend-start"` ]]
-then
-    killall mythfrontend
-else
-    pkill -USR1 mythfrontend
-fi
+#reload mythfrontend
+killall mythfrontend
-- 
cgit v0.12

