1*4882a593Smuzhiyun# A bbclass to handle installed GSettings (glib) schemas, updated the compiled 2*4882a593Smuzhiyun# form on package install and remove. 3*4882a593Smuzhiyun# 4*4882a593Smuzhiyun# The compiled schemas are platform-agnostic, so we can depend on 5*4882a593Smuzhiyun# glib-2.0-native for the native tool and run the postinst script when the 6*4882a593Smuzhiyun# rootfs builds to save a little time on first boot. 7*4882a593Smuzhiyun 8*4882a593Smuzhiyun# TODO use a trigger so that this runs once per package operation run 9*4882a593Smuzhiyun 10*4882a593SmuzhiyunGSETTINGS_PACKAGE ?= "${PN}" 11*4882a593Smuzhiyun 12*4882a593Smuzhiyunpython __anonymous() { 13*4882a593Smuzhiyun pkg = d.getVar("GSETTINGS_PACKAGE") 14*4882a593Smuzhiyun if pkg: 15*4882a593Smuzhiyun d.appendVar("PACKAGE_WRITE_DEPS", " glib-2.0-native") 16*4882a593Smuzhiyun d.appendVar("RDEPENDS:" + pkg, " ${MLPREFIX}glib-2.0-utils") 17*4882a593Smuzhiyun d.appendVar("FILES:" + pkg, " ${datadir}/glib-2.0/schemas") 18*4882a593Smuzhiyun} 19*4882a593Smuzhiyun 20*4882a593Smuzhiyungsettings_postinstrm () { 21*4882a593Smuzhiyun glib-compile-schemas $D${datadir}/glib-2.0/schemas 22*4882a593Smuzhiyun} 23*4882a593Smuzhiyun 24*4882a593Smuzhiyunpython populate_packages:append () { 25*4882a593Smuzhiyun pkg = d.getVar('GSETTINGS_PACKAGE') 26*4882a593Smuzhiyun if pkg: 27*4882a593Smuzhiyun bb.note("adding gsettings postinst scripts to %s" % pkg) 28*4882a593Smuzhiyun 29*4882a593Smuzhiyun postinst = d.getVar('pkg_postinst:%s' % pkg) or d.getVar('pkg_postinst') 30*4882a593Smuzhiyun if not postinst: 31*4882a593Smuzhiyun postinst = '#!/bin/sh\n' 32*4882a593Smuzhiyun postinst += d.getVar('gsettings_postinstrm') 33*4882a593Smuzhiyun d.setVar('pkg_postinst:%s' % pkg, postinst) 34*4882a593Smuzhiyun 35*4882a593Smuzhiyun bb.note("adding gsettings postrm scripts to %s" % pkg) 36*4882a593Smuzhiyun 37*4882a593Smuzhiyun postrm = d.getVar('pkg_postrm:%s' % pkg) or d.getVar('pkg_postrm') 38*4882a593Smuzhiyun if not postrm: 39*4882a593Smuzhiyun postrm = '#!/bin/sh\n' 40*4882a593Smuzhiyun postrm += d.getVar('gsettings_postinstrm') 41*4882a593Smuzhiyun d.setVar('pkg_postrm:%s' % pkg, postrm) 42*4882a593Smuzhiyun} 43