Skip to content
This repository was archived by the owner on Aug 5, 2022. It is now read-only.

Commit 63f5fe5

Browse files
authored
Merge pull request #317 from pohly/locale
enhance locale support
2 parents 74adaf3 + 893a0a8 commit 63f5fe5

1 file changed

Lines changed: 22 additions & 2 deletions

File tree

meta-refkit-core/classes/refkit-image.bbclass

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,6 @@ FEATURE_PACKAGES_tools-debug_append = " valgrind"
198198
FEATURE_PACKAGES_computervision = "packagegroup-computervision"
199199
FEATURE_PACKAGES_computervision-test = "packagegroup-computervision-test"
200200

201-
IMAGE_LINGUAS = " "
202-
203201
LICENSE = "MIT"
204202

205203
# See local.conf.sample for explanations.
@@ -211,6 +209,28 @@ refkit_root_authorized_keys () {
211209
chmod -R go-rwx ${IMAGE_ROOTFS}${ROOT_HOME}/.ssh
212210
}
213211

212+
# Some commands (for example, bsdtar when dealing with archives that contain
213+
# UTF-8 encoded file names) report errors when invoked in a locale which
214+
# doesn't support UTF-8. It would be nice to use C.UTF-8, but that is not
215+
# currently available. Therefore we take the first language specified in
216+
# IMAGE_LINGUAS (typically en-us, from meta/conf/distro/include/default-distrovars.inc),
217+
# and turn that into a value accepted for LANG (like en_US).
218+
def refkit_lingua_to_lang(d):
219+
linguas = d.getVar('IMAGE_LINGUAS').split()
220+
if not linguas:
221+
return ''
222+
lang = linguas[0].split('-')
223+
if len(lang) != 2:
224+
return ''
225+
return lang[0] + '_' + lang[1].upper()
226+
REFKIT_IMAGE_LANG ?= "${@ refkit_lingua_to_lang(d) }"
227+
ROOTFS_POSTPROCESS_COMMAND += "refkit_configure_locale_conf; "
228+
refkit_configure_locale_conf () {
229+
if [ "${REFKIT_IMAGE_LANG}" ]; then
230+
echo 'LANG=${REFKIT_IMAGE_LANG}' >${IMAGE_ROOTFS}${sysconfdir}/locale.conf
231+
fi
232+
}
233+
214234
# Do not create ISO images by default, only HDDIMG will be created (if it gets created at all).
215235
NOISO = "1"
216236

0 commit comments

Comments
 (0)