summaryrefslogtreecommitdiffstats
path: root/abs/core/linhes-scripts/linhes_update.sh
blob: 39d28177e14ccea78633c13a8c5e5f221cf33887 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
dsply ()  {
	if grep -q Updates\ Available /usr/share/mythtv/themes/defaultmenu/linhes.xml
		then
		killall -9 osd_cat
		echo -e "Updates available!\n  Exit and reenter Service Menu\n to perform updates." | osd_cat -p middle -s 5 -f"-adobe-courier-bold-*-*-*-34-*-*-*-*-*" -d 10 -A centre
		exit
		else
		killall -9 osd_cat
		echo -e "Checking for updates." | osd_cat -p middle -s 5 -f"-adobe-courier-bold-*-*-*-34-*-*-*-*-*" -d 300 -A centre &
	fi
}
chck ()  {
	sudo pacman -Sy
	sudo pacman -Qu > /tmp/to_be_upgraded
#	sudo grep Target /tmp/check_update > /tmp/to_be_upgraded
	if grep -q no\ upgrades\ found /tmp/check_update
		then
		killall -9 osd_cat
		echo -e "No updates available\n at this time." | osd_cat -p middle -s 5 -f"-adobe-courier-bold-*-*-*-34-*-*-*-*-*" -d 5 -A centre
		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
  		dsply
	fi
	}
dsply
chck