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