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