blob: eae3dc7999f24971da5cbafffc7b4d47cf5a861f [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001# A bbclass to handle installed GSettings (glib) schemas, updated the compiled
2# form on package install and remove.
3#
4# The compiled schemas are platform-agnostic, so we can depend on
5# glib-2.0-native for the native tool and run the postinst script when the
6# rootfs builds to save a little time on first boot.
7
8# TODO use a trigger so that this runs once per package operation run
9
Patrick Williamsc124f4f2015-09-15 14:41:29 -050010
11RDEPENDS_${PN} += "glib-2.0-utils"
12
13FILES_${PN} += "${datadir}/glib-2.0/schemas"
14
Brad Bishop6e60e8b2018-02-01 10:27:11 -050015PACKAGE_WRITE_DEPS += "glib-2.0-native"
16
Patrick Williamsc124f4f2015-09-15 14:41:29 -050017gsettings_postinstrm () {
18 glib-compile-schemas $D${datadir}/glib-2.0/schemas
19}
20
21python populate_packages_append () {
Brad Bishop6e60e8b2018-02-01 10:27:11 -050022 pkg = d.getVar('PN')
Patrick Williamsc124f4f2015-09-15 14:41:29 -050023 bb.note("adding gsettings postinst scripts to %s" % pkg)
24
Brad Bishop6e60e8b2018-02-01 10:27:11 -050025 postinst = d.getVar('pkg_postinst_%s' % pkg) or d.getVar('pkg_postinst')
Patrick Williamsc124f4f2015-09-15 14:41:29 -050026 if not postinst:
27 postinst = '#!/bin/sh\n'
Brad Bishop6e60e8b2018-02-01 10:27:11 -050028 postinst += d.getVar('gsettings_postinstrm')
Patrick Williamsc124f4f2015-09-15 14:41:29 -050029 d.setVar('pkg_postinst_%s' % pkg, postinst)
30
31 bb.note("adding gsettings postrm scripts to %s" % pkg)
32
Brad Bishop6e60e8b2018-02-01 10:27:11 -050033 postrm = d.getVar('pkg_postrm_%s' % pkg) or d.getVar('pkg_postrm')
Patrick Williamsc124f4f2015-09-15 14:41:29 -050034 if not postrm:
35 postrm = '#!/bin/sh\n'
Brad Bishop6e60e8b2018-02-01 10:27:11 -050036 postrm += d.getVar('gsettings_postinstrm')
Patrick Williamsc124f4f2015-09-15 14:41:29 -050037 d.setVar('pkg_postrm_%s' % pkg, postrm)
38}