#!/bin/bash
#----------------------------------------------------------------------------
. /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 &
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
}
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
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 "" >> /tmp/linhes.xml.tmp
echo " " >> /tmp/linhes.xml.tmp
echo "" >> /tmp/linhes.xml.tmp
echo "" >> /tmp/linhes.xml.tmp
mv /tmp/linhes.xml.tmp /usr/share/mythtv/themes/defaultmenu/linhes.xml
echo "" > /tmp/update3.xml.tmp
if grep kernel26 /tmp/to_be_upgraded || grep nvidia /tmp/to_be_upgraded
then
echo "" >> /tmp/update3.xml.tmp
echo " " >> /tmp/update3.xml.tmp
fi
while read line; do
echo "" >> /tmp/update3.xml.tmp
echo " " >> /tmp/update3.xml.tmp
done < "/tmp/to_be_upgraded"
echo "" >> /tmp/update3.xml.tmp
mv /tmp/update3.xml.tmp /usr/share/mythtv/themes/defaultmenu/update3.xml
dsply
fi
}
dsply
chck