mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-07 04:56:58 +02:00
Merge pull request #591 from marineam/utf-8
build_image: generate C.UTF-8 locale
This commit is contained in:
commit
257121f734
@ -112,6 +112,27 @@ run_ldconfig() {
|
||||
esac
|
||||
}
|
||||
|
||||
run_localedef() {
|
||||
local root_fs_dir="$1" loader=()
|
||||
case ${ARCH} in
|
||||
arm64)
|
||||
loader=( qemu-aarch64 -L "${root_fs_dir}" );;
|
||||
amd64)
|
||||
loader=( "${root_fs_dir}/usr/lib64/ld-linux-x86-64.so.2" \
|
||||
--library-path "${root_fs_dir}/usr/lib64" );;
|
||||
*)
|
||||
die "Unable to run localedev for ARCH ${ARCH}";;
|
||||
esac
|
||||
info "Generating C.UTF-8 locale..."
|
||||
local i18n="${root_fs_dir}/usr/share/i18n"
|
||||
# localedef will silently fall back to /usr/share/i18n if missing so
|
||||
# check that the paths we want are available first.
|
||||
[[ -f "${i18n}/charmaps/UTF-8.gz" ]] || die
|
||||
[[ -f "${i18n}/locales/C" ]] || die
|
||||
sudo I18NPATH="${i18n}" "${loader[@]}" "${root_fs_dir}/usr/bin/localedef" \
|
||||
--prefix="${root_fs_dir}" --charmap=UTF-8 --inputfile=C C.UTF-8
|
||||
}
|
||||
|
||||
# Basic command to emerge binary packages into the target image.
|
||||
# Arguments to this command are passed as addition options/arguments
|
||||
# to the basic emerge command.
|
||||
|
@ -97,6 +97,7 @@ create_dev_image() {
|
||||
set_image_profile dev
|
||||
emerge_to_image "${root_fs_dir}" @system ${base_pkg}
|
||||
run_ldconfig "${root_fs_dir}"
|
||||
run_localedef "${root_fs_dir}"
|
||||
write_packages "${root_fs_dir}" "${BUILD_DIR}/${image_packages}"
|
||||
write_licenses "${root_fs_dir}" "${BUILD_DIR}/${image_licenses}"
|
||||
|
||||
|
@ -76,6 +76,7 @@ create_prod_image() {
|
||||
extract_prod_gcc "${root_fs_dir}"
|
||||
emerge_to_image "${root_fs_dir}" "${base_pkg}"
|
||||
run_ldconfig "${root_fs_dir}"
|
||||
run_localedef "${root_fs_dir}"
|
||||
write_packages "${root_fs_dir}" "${BUILD_DIR}/${image_packages}"
|
||||
write_licenses "${root_fs_dir}" "${BUILD_DIR}/${image_licenses}"
|
||||
extract_docs "${root_fs_dir}"
|
||||
@ -113,6 +114,9 @@ EOF
|
||||
sudo mv -n ${root_fs_dir}/etc/pam.d/* ${root_fs_dir}/usr/lib/pam.d/
|
||||
sudo rmdir ${root_fs_dir}/etc/pam.d
|
||||
|
||||
# Remove source locale data, only need to ship the compiled archive.
|
||||
sudo rm -rf ${root_fs_dir}/usr/share/i18n/
|
||||
|
||||
finish_image \
|
||||
"${image_name}" \
|
||||
"${disk_layout}" \
|
||||
|
Loading…
Reference in New Issue
Block a user