gconf.bbclass 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. DEPENDS += "gconf"
  2. gconf_postinst() {
  3. if [ "$1" = configure ]; then
  4. if [ "x$D" != "x" ]; then
  5. exit 1
  6. fi
  7. SCHEMA_LOCATION=/etc/gconf/schemas
  8. for SCHEMA in ${SCHEMA_FILES}; do
  9. if [ -e $SCHEMA_LOCATION/$SCHEMA ]; then
  10. HOME=/root GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` \
  11. gconftool-2 \
  12. --makefile-install-rule $SCHEMA_LOCATION/$SCHEMA > /dev/null
  13. fi
  14. done
  15. fi
  16. }
  17. gconf_prerm() {
  18. if [ "$1" = remove ] || [ "$1" = upgrade ]; then
  19. SCHEMA_LOCATION=/etc/gconf/schemas
  20. for SCHEMA in ${SCHEMA_FILES}; do
  21. if [ -e $SCHEMA_LOCATION/$SCHEMA ]; then
  22. HOME=/root GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` \
  23. gconftool-2 \
  24. --makefile-uninstall-rule $SCHEMA_LOCATION/$SCHEMA > /dev/null
  25. fi
  26. done
  27. fi
  28. }
  29. python populate_packages_append () {
  30. import os.path, re
  31. packages = bb.data.getVar('PACKAGES', d, 1).split()
  32. workdir = bb.data.getVar('WORKDIR', d, 1)
  33. for pkg in packages:
  34. schema_dir = '%s/install/%s/etc/gconf/schemas' % (workdir, pkg)
  35. schemas = []
  36. schema_re = re.compile(".*\.schemas$")
  37. if os.path.exists(schema_dir):
  38. for f in os.listdir(schema_dir):
  39. if schema_re.match(f):
  40. schemas.append(f)
  41. if schemas != []:
  42. bb.note("adding gconf postinst and prerm scripts to %s" % pkg)
  43. bb.data.setVar('SCHEMA_FILES', " ".join(schemas), d)
  44. postinst = bb.data.getVar('pkg_postinst_%s' % pkg, d, 1) or bb.data.getVar('pkg_postinst', d, 1)
  45. if not postinst:
  46. postinst = '#!/bin/sh\n'
  47. postinst += bb.data.getVar('gconf_postinst', d, 1)
  48. bb.data.setVar('pkg_postinst_%s' % pkg, postinst, d)
  49. prerm = bb.data.getVar('pkg_prerm_%s' % pkg, d, 1) or bb.data.getVar('pkg_prerm', d, 1)
  50. if not prerm:
  51. prerm = '#!/bin/sh\n'
  52. prerm += bb.data.getVar('gconf_prerm', d, 1)
  53. bb.data.setVar('pkg_prerm_%s' % pkg, prerm, d)
  54. }