Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | # 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 Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame^] | 10 | GSETTINGS_PACKAGE ?= "${PN}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 11 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame^] | 12 | python __anonymous() { |
| 13 | pkg = d.getVar("GSETTINGS_PACKAGE") |
| 14 | if pkg: |
| 15 | d.appendVar("PACKAGE_WRITE_DEPS", " glib-2.0-native") |
| 16 | d.appendVar("RDEPENDS_" + pkg, " ${MLPREFIX}glib-2.0-utils") |
| 17 | d.appendVar("FILES_" + pkg, " ${datadir}/glib-2.0/schemas") |
| 18 | } |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 19 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 20 | gsettings_postinstrm () { |
| 21 | glib-compile-schemas $D${datadir}/glib-2.0/schemas |
| 22 | } |
| 23 | |
| 24 | python populate_packages_append () { |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame^] | 25 | pkg = d.getVar('GSETTINGS_PACKAGE') |
| 26 | if pkg: |
| 27 | bb.note("adding gsettings postinst scripts to %s" % pkg) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 28 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame^] | 29 | postinst = d.getVar('pkg_postinst_%s' % pkg) or d.getVar('pkg_postinst') |
| 30 | if not postinst: |
| 31 | postinst = '#!/bin/sh\n' |
| 32 | postinst += d.getVar('gsettings_postinstrm') |
| 33 | d.setVar('pkg_postinst_%s' % pkg, postinst) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 34 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame^] | 35 | bb.note("adding gsettings postrm scripts to %s" % pkg) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 36 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame^] | 37 | postrm = d.getVar('pkg_postrm_%s' % pkg) or d.getVar('pkg_postrm') |
| 38 | if not postrm: |
| 39 | postrm = '#!/bin/sh\n' |
| 40 | postrm += d.getVar('gsettings_postinstrm') |
| 41 | d.setVar('pkg_postrm_%s' % pkg, postrm) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 42 | } |