blob: 3fa5bd40b357ae8e51e2b9561c0128d15cb00d33 [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
Brad Bishop19323692019-04-05 15:28:33 -040010GSETTINGS_PACKAGE ?= "${PN}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050011
Brad Bishop19323692019-04-05 15:28:33 -040012python __anonymous() {
13 pkg = d.getVar("GSETTINGS_PACKAGE")
14 if pkg:
15 d.appendVar("PACKAGE_WRITE_DEPS", " glib-2.0-native")
Patrick Williams213cb262021-08-07 19:21:33 -050016 d.appendVar("RDEPENDS:" + pkg, " ${MLPREFIX}glib-2.0-utils")
17 d.appendVar("FILES:" + pkg, " ${datadir}/glib-2.0/schemas")
Brad Bishop19323692019-04-05 15:28:33 -040018}
Brad Bishop6e60e8b2018-02-01 10:27:11 -050019
Patrick Williamsc124f4f2015-09-15 14:41:29 -050020gsettings_postinstrm () {
21 glib-compile-schemas $D${datadir}/glib-2.0/schemas
22}
23
Patrick Williams213cb262021-08-07 19:21:33 -050024python populate_packages:append () {
Brad Bishop19323692019-04-05 15:28:33 -040025 pkg = d.getVar('GSETTINGS_PACKAGE')
26 if pkg:
27 bb.note("adding gsettings postinst scripts to %s" % pkg)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050028
Patrick Williams213cb262021-08-07 19:21:33 -050029 postinst = d.getVar('pkg_postinst:%s' % pkg) or d.getVar('pkg_postinst')
Brad Bishop19323692019-04-05 15:28:33 -040030 if not postinst:
31 postinst = '#!/bin/sh\n'
32 postinst += d.getVar('gsettings_postinstrm')
Patrick Williams213cb262021-08-07 19:21:33 -050033 d.setVar('pkg_postinst:%s' % pkg, postinst)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050034
Brad Bishop19323692019-04-05 15:28:33 -040035 bb.note("adding gsettings postrm scripts to %s" % pkg)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050036
Patrick Williams213cb262021-08-07 19:21:33 -050037 postrm = d.getVar('pkg_postrm:%s' % pkg) or d.getVar('pkg_postrm')
Brad Bishop19323692019-04-05 15:28:33 -040038 if not postrm:
39 postrm = '#!/bin/sh\n'
40 postrm += d.getVar('gsettings_postinstrm')
Patrick Williams213cb262021-08-07 19:21:33 -050041 d.setVar('pkg_postrm:%s' % pkg, postrm)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050042}