xqtlauncher: added convert and cleanup scripts and .desktop files for them
authorBernhard Guillon <Bernhard.Guillon@opensimpad.org>
Sat, 6 Dec 2008 18:51:58 +0000 (19:51 +0100)
committerBernhard Guillon <Bernhard.Guillon@opensimpad.org>
Sat, 6 Dec 2008 18:51:58 +0000 (19:51 +0100)
- convert and cleanup now parses /usr/share/applications for .desktop files
  and convert them to opie compliant files

packages/xqtlauncher/xqtlauncher.bb
packages/xqtlauncher/xqtlauncher/cleanup.desktop [new file with mode: 0644]
packages/xqtlauncher/xqtlauncher/convert.desktop [new file with mode: 0644]
packages/xqtlauncher/xqtlauncher/xqtlauncher-cleanup.sh [new file with mode: 0755]
packages/xqtlauncher/xqtlauncher/xqtlauncher-convert.sh [new file with mode: 0755]

index 0897ddb..043ee56 100644 (file)
@@ -1,13 +1,17 @@
 DESCRIPTION = "xqtlauncher integrates X/Qt2 nicely into opie. You can launch applications with it from opies menue"
 HOMEPAGE = "http://angstrom-distribution.org/"
 LICENSE = "GPL"
-PR = "r0"
+PR = "r1"
 
 RDEPENDS = "xqt2 xorg-minimal-fonts"
 
 SRC_URI = "file://dot.directory \
        file://startxqt \
        file://startxqt-wrapper \
+       file://xqtlauncher-convert.sh \
+       file://xqtlauncher-cleanup.sh \
+       file://convert.desktop \
+       file://cleanup.desktop \
        file://xqtlauncher "
         
 do_install() {
@@ -15,8 +19,16 @@ do_install() {
        install -d ${D}${bindir}
        install -m 0755 startxqt startxqt-wrapper xqtlauncher ${D}${bindir}
        install -d ${D}${palmtopdir}/apps/XQt2/
-       install -m 0644 dot.directory ${D}${palmtopdir}/apps/XQt2
+       install -m 0644 dot.directory ${D}${palmtopdir}/apps/XQt2/.directory
+       install -m 0644 convert.desktop cleanup.desktop ${D}${palmtopdir}/apps/XQt2/
+       install -d ${D}${sysconfdir}/init.d/
+       install -m 0755 startxqt startxqt-wrapper xqtlauncher xqtlauncher-cleanup.sh xqtlauncher-convert.sh ${D}${sysconfdir}/init.d/
+       install -d ${D}${sysconfdir}/rc5.d/
+       ln -sf          ../init.d/xqtlauncher-convert.sh ${D}${sysconfdir}/rc5.d/S98xqtlauncher-convert
+       ln -sf          ../init.d/xqtlauncher-cleanup.sh ${D}${sysconfdir}/rc5.d/S98xqtlauncher-cleanup
 }
 
 FILES_${PN} += "${palmtopdir}/apps/XQt2 \
+       ${palmtopdir}/apps/XQt2/convert.desktop \
+       ${palmtopdir}/apps/XQt2/cleanup.desktop \ 
        ${palmtopdir}/apps/XQt2/.directory "
diff --git a/packages/xqtlauncher/xqtlauncher/cleanup.desktop b/packages/xqtlauncher/xqtlauncher/cleanup.desktop
new file mode 100644 (file)
index 0000000..d043617
--- /dev/null
@@ -0,0 +1,5 @@
+[Desktop Entry]
+Exec=/etc/init.d/xqtlauncher-cleanup.sh
+Icon=Xqt.png
+Type=Application
+Name=Cleanup Icons
diff --git a/packages/xqtlauncher/xqtlauncher/convert.desktop b/packages/xqtlauncher/xqtlauncher/convert.desktop
new file mode 100644 (file)
index 0000000..ca70c43
--- /dev/null
@@ -0,0 +1,5 @@
+[Desktop Entry]
+Exec=/etc/init.d/xqtlauncher-convert.sh
+Icon=Xqt.png
+Type=Application
+Name=Create Icons
diff --git a/packages/xqtlauncher/xqtlauncher/xqtlauncher-cleanup.sh b/packages/xqtlauncher/xqtlauncher/xqtlauncher-cleanup.sh
new file mode 100755 (executable)
index 0000000..3ccf333
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/ash
+#This program cleans up the mess which convert.sh leaves if you remove a package 
+for i in `find /usr/lib/opie/apps/XQt2 -name *.desktop`; do
+       export name=$(echo $i | awk 'BEGIN {FS="."} {gsub("/",".")} {print $(NF-1)}')
+       #don't delete convert and cleanup icons
+    if [ $i != "/usr/lib/opie/apps/XQt2/convert.desktop" ] && [ $i != "/usr/lib/opie/apps/XQt2/cleanup.desktop" ] ; then 
+        newfile=$(find /usr/share/applications/ -name $name.desktop)
+    else
+        newfile="donotdelete"
+    fi
+       if [ -z $newfile ] ; then
+               echo $name
+               echo $i
+               icon=$(cat $i | awk 'BEGIN {FS="="} {if ($1 == "Icon") {print $2} }')
+               rm -f /usr/lib/opie/bin/run$name
+               find /usr/lib/opie/pics/ -name $icon.* -exec rm -f {} \;
+               rm -f $i
+       fi
+done
+#update the icons
+/usr/bin/icon-reload.sh
diff --git a/packages/xqtlauncher/xqtlauncher/xqtlauncher-convert.sh b/packages/xqtlauncher/xqtlauncher/xqtlauncher-convert.sh
new file mode 100755 (executable)
index 0000000..0356d33
--- /dev/null
@@ -0,0 +1,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=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