summaryrefslogtreecommitdiffstats
path: root/abs/core/LinHES-system/linhes_update.sh
diff options
context:
space:
mode:
authorBritney Fransen <brfransen@gmail.com>2014-02-13 21:18:16 (GMT)
committerBritney Fransen <brfransen@gmail.com>2014-02-13 21:18:16 (GMT)
commitb8f425e3dff10f18eb019157bbf553074e3fcc51 (patch)
tree00e57217183b1470580d42354a9048b8f81751e2 /abs/core/LinHES-system/linhes_update.sh
parent8565905f38cc3c1f59c1bcc4bec9e3ac21a39313 (diff)
downloadlinhes_pkgbuild-b8f425e3dff10f18eb019157bbf553074e3fcc51.zip
linhes_pkgbuild-b8f425e3dff10f18eb019157bbf553074e3fcc51.tar.gz
linhes_pkgbuild-b8f425e3dff10f18eb019157bbf553074e3fcc51.tar.bz2
LinHES-system: lh_system_host_update: add Notify option that calls linhes_update.sh. refs #959
linhes_update.sh: add -s option to silence OSD. Add sed to show and hide message in LH theme. linhes_update2.sh: add sed to hide message in LH theme.
Diffstat (limited to 'abs/core/LinHES-system/linhes_update.sh')
-rw-r--r--abs/core/LinHES-system/linhes_update.sh67
1 files changed, 54 insertions, 13 deletions
diff --git a/abs/core/LinHES-system/linhes_update.sh b/abs/core/LinHES-system/linhes_update.sh
index afaf6d5..21dfb6c 100644
--- a/abs/core/LinHES-system/linhes_update.sh
+++ b/abs/core/LinHES-system/linhes_update.sh
@@ -1,27 +1,49 @@
#!/bin/bash
#Called from LinHES Service Menu Check for Updates Menu
+usage () {
+ echo "Usage: $0 [-h] [-s]"
+ echo
+ echo "-h - Print this help/usage message and quit"
+ echo "-s - Run silently, no OSD messages"
+ exit $1
+}
+
dsply () {
- if grep -q Updates\ Available /usr/share/mythtv/themes/defaultmenu/linhes.xml
+ 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!\nGo to the Service Menu to install the updates.|middle"
+ if [ "$1" = false ]; then
+ msg_client.py --clear --tag "checkUpdates"
+ msg_client.py --kill
+ msg_client.py --msg "Updates available!\nGo to the Service Menu to install the updates.|middle"
+ fi
+ echo " Updates available!"
+ pkill -USR1 mythfrontend
exit
else
- msg_client.py --msg "Checking for updates...|middle" --timeout 600 --tag "checkUpdates"
+ [ "$1" = false ] && { msg_client.py --msg "Checking for updates...|middle" --timeout 600 --tag "checkUpdates"; }
+ echo " Checking for updates..."
fi
}
chck () {
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
- msg_client.py --clear --tag "checkUpdates"
- msg_client.py --kill
- msg_client.py --msg "No updates available.\nReturning to Main Menu.|middle"
+ #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
+
+ 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"
+ fi
+ echo " No updates available."
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
@@ -38,7 +60,7 @@ chck () {
mv /tmp/linhes.xml.tmp /usr/share/mythtv/themes/defaultmenu/linhes.xml
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
@@ -50,7 +72,7 @@ chck () {
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
@@ -63,9 +85,28 @@ chck () {
done < "/tmp/to_be_upgraded"
echo "</mythmenu>" >> /tmp/update3.xml.tmp
mv /tmp/update3.xml.tmp /usr/share/mythtv/themes/defaultmenu/update3.xml
- dsply
+
+ #show LinHES update message on main menu
+ 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
-chck
+# Command line argument handling
+SILENT=false
+while getopts "hs" OPT ; do
+ case $OPT in
+ h) usage 0 ;;
+ s) SILENT=true ;;
+ *) usage 1 ;;
+ esac
+done
+# Check for extra cruft on the command line...
+shift $(($OPTIND - 1))
+[ -n "$*" ] && usage 1
+
+dsply $SILENT
+chck $SILENT
+pkill -USR1 mythfrontend