diff options
Diffstat (limited to 'meta/classes/gtk-icon-cache.bbclass')
-rw-r--r-- | meta/classes/gtk-icon-cache.bbclass | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/meta/classes/gtk-icon-cache.bbclass b/meta/classes/gtk-icon-cache.bbclass new file mode 100644 index 0000000000..0f68e6812b --- /dev/null +++ b/meta/classes/gtk-icon-cache.bbclass | |||
@@ -0,0 +1,38 @@ | |||
1 | FILES_${PN} += "${datadir}/icons/hicolor" | ||
2 | |||
3 | gtk-icon-cache_postinst() { | ||
4 | if [ "x$D" != "x" ]; then | ||
5 | exit 1 | ||
6 | fi | ||
7 | gtk-update-icon-cache -q /usr/share/icons/hicolor | ||
8 | } | ||
9 | |||
10 | gtk-icon-cache_postrm() { | ||
11 | gtk-update-icon-cache -q /usr/share/icons/hicolor | ||
12 | } | ||
13 | |||
14 | python populate_packages_append () { | ||
15 | import os.path | ||
16 | packages = bb.data.getVar('PACKAGES', d, 1).split() | ||
17 | workdir = bb.data.getVar('WORKDIR', d, 1) | ||
18 | |||
19 | for pkg in packages: | ||
20 | icon_dir = '%s/install/%s/%s/icons/hicolor' % (workdir, pkg, bb.data.getVar('datadir', d, 1)) | ||
21 | if not os.path.exists(icon_dir): | ||
22 | continue | ||
23 | |||
24 | bb.note("adding gtk-icon-cache postinst and postrm scripts to %s" % pkg) | ||
25 | |||
26 | postinst = bb.data.getVar('pkg_postinst_%s' % pkg, d, 1) or bb.data.getVar('pkg_postinst', d, 1) | ||
27 | if not postinst: | ||
28 | postinst = '#!/bin/sh\n' | ||
29 | postinst += bb.data.getVar('gtk-icon-cache_postinst', d, 1) | ||
30 | bb.data.setVar('pkg_postinst_%s' % pkg, postinst, d) | ||
31 | |||
32 | postrm = bb.data.getVar('pkg_postrm_%s' % pkg, d, 1) or bb.data.getVar('pkg_postrm', d, 1) | ||
33 | if not postrm: | ||
34 | postrm = '#!/bin/sh\n' | ||
35 | postrm += bb.data.getVar('gtk-icon-cache_postrm', d, 1) | ||
36 | bb.data.setVar('pkg_postrm_%s' % pkg, postrm, d) | ||
37 | } | ||
38 | |||