aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-qtopia/xqtlauncher/xqtlauncher/xqtlauncher-convert.sh
blob: 59efad3be3055b84420a6ba7ccce7639504e5c2c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/ash
#This program converts /usr/share/applications/*.desktop in /usr/lib/opie/apps/XQt2/*.desktop files. 
for i in `find /usr/share/applications -name *.desktop`; do
	export name=$(echo $i | awk 'BEGIN {FS="."} {gsub("/",".")} {print $(NF-1)}')
	newfile=/usr/lib/opie/apps/XQt2/$name.desktop
	if [ ! -f $newfile ] ; then
		#cat $i | awk 'BEGIN {FS="="} {if ($1 == "Exec") {print "Exec=run"ENVIRON["name"]" " $2} else if ($1 == "Icon") {print "Icon=/usr/share/pixmaps/"$2} else  {print $0} }' > $newfile
		cat $i | awk 'BEGIN {FS="="} {if ($1 == "Exec") {print "Exec=/usr/lib/opie/bin/run"ENVIRON["name"]" " $2} else  {print $0} }' > $newfile
		icon=$(cat $i | awk 'BEGIN {FS="="} {if ($1 == "Icon") {print $2} }')
		ln -sf /usr/bin/xqtlauncher /usr/lib/opie/bin/run$name
		#We need to make symlinks for the pics because opie can not handle pics with paths :(		
		#Check if it has a leading /!
		if expr $icon : />/dev/null ; then
			echo $icon
			ln -sf $icon /usr/lib/opie/pics/$(echo $icon | awk 'BEGIN {FS="/"} {print $NF}')
		else
			echo $icon
			ln -sf $(find /usr/share/pixmaps -name $icon) /usr/lib/opie/pics/$(echo $icon | awk 'BEGIN {FS="/"} {print $NF}')
		fi
	fi
done
#update the icons
/usr/bin/icon-reload.sh