summaryrefslogtreecommitdiff
path: root/install_widgets.sh
blob: 91f9fc5a5f9ad3048c275cdbeaeff64d9c23d35c (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
#!/bin/sh


#echo "Widget Installation"
#if [ "$(id -u)" != "0" ]; then
#   echo "This script must be run as root" >&2
#   exit 1
#fi

source /etc/tizen-platform.conf

wgtdir=${TZ_SYS_SHARE}/widget_demo
if [ -z "$(ls $wgtdir/*.wgt 2> /dev/null)" ]; then
   echo "$wgtdir doesn't contains any widgets (.wgt)" 1>&2
   exit 1
fi

for wgt in $wgtdir/*.wgt
do 
    echo "installing $wgt"
	if [ -x /usr/bin/wrt-installer ]; then
		wrt-installer -i $wgt
	else
		xwalkctl -i $wgt
	fi
done

repo=${TZ_USER_APP}/
chmod -R a+rw ${TZ_SYS_DB}/

if [ -x /usr/bin/wrt-launcher ]; then
	wrt-launcher --list |
	awk 'NR>2{print $2, $5, $6}' |
	while read name packid appid
	do
		bin=$repo/$packid/bin/$appid
		for x in $repo/$packid/res/wgt/*[iI][cC][oO][nN]*; do
		if [[ -f $x ]]; then
			res=$(file -b $x|cut -d , -f 2|tr -d ' '|egrep '[0-9]+x[0-9]+')
			if [[ -n "$res" ]]; then
			diric=${TZ_SYS_SHARE}/icons/hicolor/$res/apps
			[[ -d $diric ]] || mkdir -p $diric
			cp $x $diric/$name.png
			fi
		fi
	   done
		desk=${TZ_SYS_RO_DESKTOP_APP}/$name.desktop
		cat << EOC > $desk
	[Desktop Entry]
	Type=Application
	Name=$name
	Exec=$bin
	Icon=$name
	Terminal=false
	Categories=WRT;Game
EOC
	done
fi

#update-desktop-database
#xdg-icon-resource forceupdate