Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame^] | 1 | DEPENDS += "gconf gconf-native" |
| 2 | |
| 3 | # These are for when gconftool is used natively and the prefix isn't necessarily |
| 4 | # the sysroot. TODO: replicate the postinst logic for -native packages going |
| 5 | # into sysroot as they won't be running their own install-time schema |
| 6 | # registration (disabled below) nor the postinst script (as they don't happen). |
| 7 | export GCONF_SCHEMA_INSTALL_SOURCE = "xml:merged:${STAGING_DIR_NATIVE}${sysconfdir}/gconf/gconf.xml.defaults" |
| 8 | export GCONF_BACKEND_DIR = "${STAGING_LIBDIR_NATIVE}/GConf/2" |
| 9 | |
| 10 | # Disable install-time schema registration as we're a packaging system so this |
| 11 | # happens in the postinst script, not at install time. Set both the configure |
| 12 | # script option and the traditional envionment variable just to make sure. |
| 13 | EXTRA_OECONF += "--disable-schemas-install" |
| 14 | export GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL = "1" |
| 15 | |
| 16 | gconf_postinst() { |
| 17 | if [ "x$D" != "x" ]; then |
| 18 | export GCONF_CONFIG_SOURCE="xml::$D${sysconfdir}/gconf/gconf.xml.defaults" |
| 19 | else |
| 20 | export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` |
| 21 | fi |
| 22 | |
| 23 | SCHEMA_LOCATION=$D/etc/gconf/schemas |
| 24 | for SCHEMA in ${SCHEMA_FILES}; do |
| 25 | if [ -e $SCHEMA_LOCATION/$SCHEMA ]; then |
| 26 | HOME=$D/root gconftool-2 \ |
| 27 | --makefile-install-rule $SCHEMA_LOCATION/$SCHEMA > /dev/null |
| 28 | fi |
| 29 | done |
| 30 | } |
| 31 | |
| 32 | gconf_prerm() { |
| 33 | SCHEMA_LOCATION=/etc/gconf/schemas |
| 34 | for SCHEMA in ${SCHEMA_FILES}; do |
| 35 | if [ -e $SCHEMA_LOCATION/$SCHEMA ]; then |
| 36 | HOME=/root GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` \ |
| 37 | gconftool-2 \ |
| 38 | --makefile-uninstall-rule $SCHEMA_LOCATION/$SCHEMA > /dev/null |
| 39 | fi |
| 40 | done |
| 41 | } |
| 42 | |
| 43 | python populate_packages_append () { |
| 44 | import re |
| 45 | packages = d.getVar('PACKAGES', True).split() |
| 46 | pkgdest = d.getVar('PKGDEST', True) |
| 47 | |
| 48 | for pkg in packages: |
| 49 | schema_dir = '%s/%s/etc/gconf/schemas' % (pkgdest, pkg) |
| 50 | schemas = [] |
| 51 | schema_re = re.compile(".*\.schemas$") |
| 52 | if os.path.exists(schema_dir): |
| 53 | for f in os.listdir(schema_dir): |
| 54 | if schema_re.match(f): |
| 55 | schemas.append(f) |
| 56 | if schemas != []: |
| 57 | bb.note("adding gconf postinst and prerm scripts to %s" % pkg) |
| 58 | d.setVar('SCHEMA_FILES', " ".join(schemas)) |
| 59 | postinst = d.getVar('pkg_postinst_%s' % pkg, True) |
| 60 | if not postinst: |
| 61 | postinst = '#!/bin/sh\n' |
| 62 | postinst += d.getVar('gconf_postinst', True) |
| 63 | d.setVar('pkg_postinst_%s' % pkg, postinst) |
| 64 | prerm = d.getVar('pkg_prerm_%s' % pkg, True) |
| 65 | if not prerm: |
| 66 | prerm = '#!/bin/sh\n' |
| 67 | prerm += d.getVar('gconf_prerm', True) |
| 68 | d.setVar('pkg_prerm_%s' % pkg, prerm) |
| 69 | d.appendVar("RDEPENDS_%s" % pkg, ' ' + d.getVar('MLPREFIX', False) + 'gconf') |
| 70 | } |