diff options
Diffstat (limited to 'meta/classes/gconf.bbclass')
| -rw-r--r-- | meta/classes/gconf.bbclass | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/meta/classes/gconf.bbclass b/meta/classes/gconf.bbclass new file mode 100644 index 0000000000..686f8e6596 --- /dev/null +++ b/meta/classes/gconf.bbclass | |||
| @@ -0,0 +1,59 @@ | |||
| 1 | DEPENDS += "gconf" | ||
| 2 | |||
| 3 | gconf_postinst() { | ||
| 4 | if [ "$1" = configure ]; then | ||
| 5 | if [ "x$D" != "x" ]; then | ||
| 6 | exit 1 | ||
| 7 | fi | ||
| 8 | SCHEMA_LOCATION=/etc/gconf/schemas | ||
| 9 | for SCHEMA in ${SCHEMA_FILES}; do | ||
| 10 | if [ -e $SCHEMA_LOCATION/$SCHEMA ]; then | ||
| 11 | HOME=/root GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` \ | ||
| 12 | gconftool-2 \ | ||
| 13 | --makefile-install-rule $SCHEMA_LOCATION/$SCHEMA > /dev/null | ||
| 14 | fi | ||
| 15 | done | ||
| 16 | fi | ||
| 17 | } | ||
| 18 | |||
| 19 | gconf_prerm() { | ||
| 20 | if [ "$1" = remove ] || [ "$1" = upgrade ]; then | ||
| 21 | SCHEMA_LOCATION=/etc/gconf/schemas | ||
| 22 | for SCHEMA in ${SCHEMA_FILES}; do | ||
| 23 | if [ -e $SCHEMA_LOCATION/$SCHEMA ]; then | ||
| 24 | HOME=/root GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` \ | ||
| 25 | gconftool-2 \ | ||
| 26 | --makefile-uninstall-rule $SCHEMA_LOCATION/$SCHEMA > /dev/null | ||
| 27 | fi | ||
| 28 | done | ||
| 29 | fi | ||
| 30 | } | ||
| 31 | |||
| 32 | python populate_packages_append () { | ||
| 33 | import os.path, re | ||
| 34 | packages = bb.data.getVar('PACKAGES', d, 1).split() | ||
| 35 | workdir = bb.data.getVar('WORKDIR', d, 1) | ||
| 36 | |||
| 37 | for pkg in packages: | ||
| 38 | schema_dir = '%s/install/%s/etc/gconf/schemas' % (workdir, pkg) | ||
| 39 | schemas = [] | ||
| 40 | schema_re = re.compile(".*\.schemas$") | ||
| 41 | if os.path.exists(schema_dir): | ||
| 42 | for f in os.listdir(schema_dir): | ||
| 43 | if schema_re.match(f): | ||
| 44 | schemas.append(f) | ||
| 45 | if schemas != []: | ||
| 46 | bb.note("adding gconf postinst and prerm scripts to %s" % pkg) | ||
| 47 | bb.data.setVar('SCHEMA_FILES', " ".join(schemas), d) | ||
| 48 | postinst = bb.data.getVar('pkg_postinst_%s' % pkg, d, 1) or bb.data.getVar('pkg_postinst', d, 1) | ||
| 49 | if not postinst: | ||
| 50 | postinst = '#!/bin/sh\n' | ||
| 51 | postinst += bb.data.getVar('gconf_postinst', d, 1) | ||
| 52 | bb.data.setVar('pkg_postinst_%s' % pkg, postinst, d) | ||
| 53 | prerm = bb.data.getVar('pkg_prerm_%s' % pkg, d, 1) or bb.data.getVar('pkg_prerm', d, 1) | ||
| 54 | if not prerm: | ||
| 55 | prerm = '#!/bin/sh\n' | ||
| 56 | prerm += bb.data.getVar('gconf_prerm', d, 1) | ||
| 57 | bb.data.setVar('pkg_prerm_%s' % pkg, prerm, d) | ||
| 58 | |||
| 59 | } | ||
