diff --git a/meta-moblin/classes/moblin-image.bbclass b/meta-moblin/classes/moblin-image.bbclass index f742777ace..f9bab011b0 100644 --- a/meta-moblin/classes/moblin-image.bbclass +++ b/meta-moblin/classes/moblin-image.bbclass @@ -95,3 +95,5 @@ inherit image # Create /etc/timestamp during image construction to give a reasonably sane default time setting ROOTFS_POSTPROCESS_COMMAND += "rootfs_update_timestamp ; " + +ROOTFS_POSTINSTALL_COMMAND += "rootfs_trim_schemas ; " diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass index 8225980f73..6b0a14d9ac 100644 --- a/meta/classes/image.bbclass +++ b/meta/classes/image.bbclass @@ -225,6 +225,18 @@ rootfs_no_x_startup () { fi } +rootfs_trim_schemas () { + for schema in ${IMAGE_ROOTFS}/etc/gconf/schemas/*.schemas + do + # Need this in case no files exist + if [ -e $schema ]; then + poky-trim-schemas $schema > $schema.new + mv $schema.new $schema + fi + done +} + + # export the zap_root_password, create_etc_timestamp and remote_init_link EXPORT_FUNCTIONS zap_root_password create_etc_timestamp remove_init_link do_rootfs make_zimage_symlink_relative set_image_autologin rootfs_update_timestamp rootfs_no_x_startup diff --git a/scripts/poky-trim-schemas b/scripts/poky-trim-schemas new file mode 100755 index 0000000000..29fb3a1b67 --- /dev/null +++ b/scripts/poky-trim-schemas @@ -0,0 +1,49 @@ +#! /usr/bin/env python + +import sys +try: + import xml.etree.cElementTree as etree +except: + import xml.etree.ElementTree as etree + +def child (elem, name): + for e in elem.getchildren(): + if e.tag == name: + return e + return None + +def children (elem, name=None): + l = elem.getchildren() + if name: + l = [e for e in l if e.tag == name] + return l + +xml = etree.parse(sys.argv[1]) + +for schema in child(xml.getroot(), "schemalist").getchildren(): + e = child(schema, "short") + if e is not None: + schema.remove(e) + + e = child(schema, "long") + if e is not None: + schema.remove(e) + + for locale in children(schema, "locale"): + # One locale must exist so leave C locale... + a = locale.attrib.get("name") + if a == 'C': + continue + e = child(locale, "default") + if e is None: + schema.remove(locale) + else: + e = child(locale, "short") + if e is not None: + locale.remove(e) + e = child(locale, "long") + if e is not None: + locale.remove(e) + +xml.write(sys.stdout, "UTF-8") +