diff options
Diffstat (limited to 'abs/core/LinHES-system/linhes_update.sh')
-rw-r--r-- | abs/core/LinHES-system/linhes_update.sh | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/abs/core/LinHES-system/linhes_update.sh b/abs/core/LinHES-system/linhes_update.sh new file mode 100644 index 0000000..87ac8a1 --- /dev/null +++ b/abs/core/LinHES-system/linhes_update.sh @@ -0,0 +1,68 @@ +#!/bin/bash +#Called from LinHES Service Menu Check for Updates Menu + +dsply () { + 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 + 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 + 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 + 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 " <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=\"LinHES\">" > /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 + dsply + fi + } + +dsply +chck |