From 7b2199c24af12713f55c6ec6045f9652cd4332ed Mon Sep 17 00:00:00 2001 From: Krzesimir Nowak Date: Fri, 15 Sep 2023 14:12:12 +0200 Subject: [PATCH] build_library/build_image_util: Fix locale generation The `localedef` tool expects `/usr/lib/locale` directory to exist. This directory used to be created by the `sys-libs/glibc` package (with the `keepdir` directive), but after the update of the package, the locale generation stuff (and the `keepdir` directive )was moved to the `sys-libs/locale-gen` package. This package is not installed in the production images, so the `/usr/lib/locale` directory was not created. In such a situation, calling localedef to generate C.UTF-8 locale resulted in an error like: cannot create temporary file: ${SOME_ROOTFS}/usr/lib/locale/locale-archive.ufpG15: No such file or directory Create the directory before calling localedef to fix the problem. --- build_library/build_image_util.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build_library/build_image_util.sh b/build_library/build_image_util.sh index 25ac63be6c..26348b0a79 100755 --- a/build_library/build_image_util.sh +++ b/build_library/build_image_util.sh @@ -158,7 +158,7 @@ run_localedef() { 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}";; + die "Unable to run localedef for ARCH ${ARCH}";; esac info "Generating C.UTF-8 locale..." local i18n="${root_fs_dir}/usr/share/i18n" @@ -166,6 +166,7 @@ run_localedef() { # check that the paths we want are available first. [[ -f "${i18n}/charmaps/UTF-8.gz" ]] || die [[ -f "${i18n}/locales/C" ]] || die + sudo mkdir -p "${root_fs_dir}/usr/lib/locale" sudo I18NPATH="${i18n}" "${loader[@]}" "${root_fs_dir}/usr/bin/localedef" \ --prefix="${root_fs_dir}" --charmap=UTF-8 --inputfile=C C.UTF-8 }