/recipes/xqtlauncher/xqtlauncher/xqtlauncher-convert.sh
Shell | 23 lines | 17 code | 0 blank | 6 comment | 3 complexity | 71f5937fbc5c35a08780fd50fe294968 MD5 | raw file
Possible License(s): BSD-3-Clause, GPL-2.0, GPL-3.0, LGPL-2.0, LGPL-2.1, LGPL-3.0
- #!/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