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