Patchwork [04/11] gtk-icon-cache.bbclass: use postinst_intercept script

login
register
mail settings
Submitter Laurentiu Palcu
Date Feb. 12, 2013, 4:12 p.m.
Message ID <e86c3c2ca251e30ad8508bfdfef379a2f5e8c253.1360684306.git.laurentiu.palcu@intel.com>
Download mbox | patch
Permalink /patch/44519/
State Accepted
Commit ceabaf626538ccdbd06ec4e8d87024216a064f52
Headers show

Comments

Laurentiu Palcu - Feb. 12, 2013, 4:12 p.m.
Since the hook has been made a standalone script, use postinst_intercept
script in order to "link" the package to the hook.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
---
 meta/classes/gtk-icon-cache.bbclass |   39 ++++++++---------------------------
 1 file changed, 9 insertions(+), 30 deletions(-)

Patch

diff --git a/meta/classes/gtk-icon-cache.bbclass b/meta/classes/gtk-icon-cache.bbclass
index cf33efd..2ca99ac 100644
--- a/meta/classes/gtk-icon-cache.bbclass
+++ b/meta/classes/gtk-icon-cache.bbclass
@@ -2,23 +2,15 @@  FILES_${PN} += "${datadir}/icons/hicolor"
 
 DEPENDS += "${@['hicolor-icon-theme', '']['${BPN}' == 'hicolor-icon-theme']} gtk+-native"
 
+#
+# On host, the postinstall MUST return 1 because we do not know if the intercept
+# hook will succeed. If it does succeed, than the packages will be marked as
+# installed.
+#
 gtk_icon_cache_postinst() {
 if [ "x$D" != "x" ]; then
-    if [ ! -f $INTERCEPT_DIR/update_icon_cache ]; then
-        cat << "EOF" > $INTERCEPT_DIR/update_icon_cache
-#!/bin/sh
-
-# update native pixbuf loaders
-gdk-pixbuf-query-loaders --update-cache
-
-for icondir in $D/usr/share/icons/*/ ; do
-    if [ -d $icondir ] ; then
-        gtk-update-icon-cache -fqt  $icondir
-    fi
-done
-EOF
-    fi
-    exit 0
+    $INTERCEPT_DIR/postinst_intercept update_icon_cache ${PKG}
+    exit 1
 fi
 
 # Update the pixbuf loaders in case they haven't been registered yet
@@ -33,21 +25,8 @@  done
 
 gtk_icon_cache_postrm() {
 if [ "x$D" != "x" ]; then
-    if [ ! -f $INTERCEPT_DIR/update_icon_cache ]; then
-        cat << "EOF" > $INTERCEPT_DIR/update_icon_cache
-#!/bin/sh
-
-# update native pixbuf loaders
-gdk-pixbuf-query-loaders --update-cache
-
-for icondir in $D/usr/share/icons/*/ ; do
-    if [ -d $icondir ] ; then
-        gtk-update-icon-cache -fqt  $icondir
-    fi
-done
-EOF
-    fi
-    exit 0
+    $INTERCEPT_DIR/postinst_intercept update_icon_cache ${PKG}
+    exit 1
 fi
 
 for icondir in /usr/share/icons/* ; do