Add poky-trim-schemas post install script to remove unneeded schema locale translations from images (credit to Ross Burton for the initial script)
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
This commit is contained in:
parent
1937c08705
commit
d5341fb796
|
@ -95,3 +95,5 @@ inherit image
|
||||||
|
|
||||||
# Create /etc/timestamp during image construction to give a reasonably sane default time setting
|
# Create /etc/timestamp during image construction to give a reasonably sane default time setting
|
||||||
ROOTFS_POSTPROCESS_COMMAND += "rootfs_update_timestamp ; "
|
ROOTFS_POSTPROCESS_COMMAND += "rootfs_update_timestamp ; "
|
||||||
|
|
||||||
|
ROOTFS_POSTINSTALL_COMMAND += "rootfs_trim_schemas ; "
|
||||||
|
|
|
@ -225,6 +225,18 @@ rootfs_no_x_startup () {
|
||||||
fi
|
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 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
|
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
|
||||||
|
|
||||||
|
|
|
@ -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")
|
||||||
|
|
Loading…
Reference in New Issue