summaryrefslogtreecommitdiffstats
path: root/abs/core/linhes-scripts/linhes_update.sh
blob: e5dd2adeeff453772f2ac0093f23212c9716a0d5 (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/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 "<!--#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
		if grep kernel26 /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

		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