blob: 9d3668edd3f3ec122a362032e46d95e41502ada4 [file] [log] [blame]
Brad Bishop6e60e8b2018-02-01 10:27:11 -05001DEPENDS += "gconf"
2PACKAGE_WRITE_DEPS += "gconf-native"
Patrick Williamsc124f4f2015-09-15 14:41:29 -05003
4# These are for when gconftool is used natively and the prefix isn't necessarily
5# the sysroot. TODO: replicate the postinst logic for -native packages going
6# into sysroot as they won't be running their own install-time schema
7# registration (disabled below) nor the postinst script (as they don't happen).
8export GCONF_SCHEMA_INSTALL_SOURCE = "xml:merged:${STAGING_DIR_NATIVE}${sysconfdir}/gconf/gconf.xml.defaults"
9export GCONF_BACKEND_DIR = "${STAGING_LIBDIR_NATIVE}/GConf/2"
10
11# Disable install-time schema registration as we're a packaging system so this
12# happens in the postinst script, not at install time. Set both the configure
13# script option and the traditional envionment variable just to make sure.
14EXTRA_OECONF += "--disable-schemas-install"
15export GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL = "1"
16
17gconf_postinst() {
18if [ "x$D" != "x" ]; then
19 export GCONF_CONFIG_SOURCE="xml::$D${sysconfdir}/gconf/gconf.xml.defaults"
20else
21 export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`
22fi
23
24SCHEMA_LOCATION=$D/etc/gconf/schemas
25for SCHEMA in ${SCHEMA_FILES}; do
26 if [ -e $SCHEMA_LOCATION/$SCHEMA ]; then
27 HOME=$D/root gconftool-2 \
28 --makefile-install-rule $SCHEMA_LOCATION/$SCHEMA > /dev/null
29 fi
30done
31}
32
33gconf_prerm() {
34SCHEMA_LOCATION=/etc/gconf/schemas
35for SCHEMA in ${SCHEMA_FILES}; do
36 if [ -e $SCHEMA_LOCATION/$SCHEMA ]; then
37 HOME=/root GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` \
38 gconftool-2 \
39 --makefile-uninstall-rule $SCHEMA_LOCATION/$SCHEMA > /dev/null
40 fi
41done
42}
43
Patrick Williams213cb262021-08-07 19:21:33 -050044python populate_packages:append () {
Patrick Williamsc124f4f2015-09-15 14:41:29 -050045 import re
Brad Bishop6e60e8b2018-02-01 10:27:11 -050046 packages = d.getVar('PACKAGES').split()
47 pkgdest = d.getVar('PKGDEST')
Patrick Williamsc124f4f2015-09-15 14:41:29 -050048
49 for pkg in packages:
50 schema_dir = '%s/%s/etc/gconf/schemas' % (pkgdest, pkg)
51 schemas = []
Brad Bishop19323692019-04-05 15:28:33 -040052 schema_re = re.compile(r".*\.schemas$")
Patrick Williamsc124f4f2015-09-15 14:41:29 -050053 if os.path.exists(schema_dir):
54 for f in os.listdir(schema_dir):
55 if schema_re.match(f):
56 schemas.append(f)
57 if schemas != []:
58 bb.note("adding gconf postinst and prerm scripts to %s" % pkg)
59 d.setVar('SCHEMA_FILES', " ".join(schemas))
Patrick Williams213cb262021-08-07 19:21:33 -050060 postinst = d.getVar('pkg_postinst:%s' % pkg)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050061 if not postinst:
62 postinst = '#!/bin/sh\n'
Brad Bishop6e60e8b2018-02-01 10:27:11 -050063 postinst += d.getVar('gconf_postinst')
Patrick Williams213cb262021-08-07 19:21:33 -050064 d.setVar('pkg_postinst:%s' % pkg, postinst)
65 prerm = d.getVar('pkg_prerm:%s' % pkg)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050066 if not prerm:
67 prerm = '#!/bin/sh\n'
Brad Bishop6e60e8b2018-02-01 10:27:11 -050068 prerm += d.getVar('gconf_prerm')
Patrick Williams213cb262021-08-07 19:21:33 -050069 d.setVar('pkg_prerm:%s' % pkg, prerm)
70 d.appendVar("RDEPENDS:%s" % pkg, ' ' + d.getVar('MLPREFIX', False) + 'gconf')
Patrick Williamsc124f4f2015-09-15 14:41:29 -050071}