summaryrefslogtreecommitdiffstats
path: root/abs/core/linhes-scripts/linhes_update2.sh
blob: a48a9969aa33e9133e8beff83d14de0f5987f97e (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
#!/bin/bash

#----------------------------------------------------------------------------
. /etc/osd_cat.cfg || {
	color=yellow
	outline=2
	outlinecolour=black
	shadow=0
	shadowcolour=black
	font="-adobe-helvetica-bold-*-*-*-34-*-*-*-*-*-*-*"
}
#----------------------------------------------------------------------------

if [[ "$1" = "install" ]]
then
	killall -9 osd_cat
	echo -e "Updating..." | osd_cat --pos=middle --align=center --delay=300000 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font & 
	echo -e "Updating..." | osd_cat --pos=middle --align=center --delay=300000 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font &
	sudo pacman -Suf --noconfirm && sudo killall -9 osd_cat
	killall -9 osd_cat
	echo -e "\nUpdates complete." | osd_cat --pos=middle --align=center --delay=3 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font &
	echo -e "\nUpdates complete." | osd_cat --pos=middle --align=center --delay=3 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font &
else
	killall -9 osd_cat
	echo -e "\nUpdates canceled." | osd_cat --pos=middle --align=center --delay=3 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font &
	echo -e "\nUpdates canceled." | osd_cat --pos=middle --align=center --delay=3 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font &
fi

rm -fr /tmp/to_be_upgraded

if grep -q Updates\ Available /usr/share/mythtv/themes/defaultmenu/linhes.xml
then
	mv /usr/share/mythtv/themes/defaultmenu/linhes.xml /tmp/linhes.xml.tmp
	sed -e '/\#UpdatesAv/,/\#UpdatesAv/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 "<!--#Check for updates-->" >> /tmp/linhes.xml.tmp
	echo "   <button>" >> /tmp/linhes.xml.tmp
	echo "     <type>UPGRADE</type>" >> /tmp/linhes.xml.tmp
	echo "     <text>Update LinHES</text>" >> /tmp/linhes.xml.tmp
	echo "     <action>MENU update.xml</action>" >> /tmp/linhes.xml.tmp
	echo "   </button>" >> /tmp/linhes.xml.tmp
	echo "<!--#Check for updates-->" >> /tmp/linhes.xml.tmp
	echo "" >> /tmp/linhes.xml.tmp
	echo "</mythmenu>" >> /tmp/linhes.xml.tmp
	mv /tmp/linhes.xml.tmp /usr/share/mythtv/themes/defaultmenu/linhes.xml
fi