mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-22 06:01:41 +02:00
enter_chroot: restore auto locale generation
First let's add a chroot upgrade hook that'll declare a small list of locales to speed up glibc upgrades. The other blocker was that `cros_sdk --enter` took an inordinate amount of time to execute (`locale-gen -u` specifically) when the number of existing locales is huge. This seems to be a bug in the bash/glibc stack which is resolved in newer versions, but we can workaround the issue by forcing locale-gen to run in a C locale. The tool itself does not care about its locale and we silence its output. BUG=chromium-os:20378 TEST=`cros_sdk --enter`; see no locales in /etc/locale.gen; run `./build_packages` and see upgrade hook work TEST=generate all 400 locales; `cros_sdk --enter`; see that it was quick Change-Id: I8fcc5e26bd8e1bcfd52b6a6c7ef3cacf0a252081 Reviewed-on: http://gerrit.chromium.org/gerrit/7806 Reviewed-by: David James <davidjames@chromium.org> Reviewed-by: Zdenek Behan <zbehan@chromium.org> Commit-Ready: Mike Frysinger <vapier@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org>
This commit is contained in:
parent
acc4c9b3fc
commit
4d258cdf9d
16
chroot_version_hooks.d/10_default_locales
Normal file
16
chroot_version_hooks.d/10_default_locales
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
|
||||||
|
# Use of this source code is governed by a BSD-style license that can be
|
||||||
|
# found in the LICENSE file.
|
||||||
|
|
||||||
|
# Make sure existing chroot's have default locales enabled
|
||||||
|
# to match the new make_chroot behavior
|
||||||
|
# http://crosbug.com/20378
|
||||||
|
if ! grep -q -v -e '^#' -e '^$' /etc/locale.gen ; then
|
||||||
|
sudo_append /etc/locale.gen <<EOF
|
||||||
|
en_US ISO-8859-1
|
||||||
|
en_US.UTF-8 UTF-8
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
|
||||||
|
info "Chroot upgraded to version 10: Set default locale sets"
|
||||||
|
exit 0
|
@ -336,13 +336,14 @@ function setup_env {
|
|||||||
esac
|
esac
|
||||||
gen_locales=("${gen_locales[@]}" "${l} ${enc}")
|
gen_locales=("${gen_locales[@]}" "${l} ${enc}")
|
||||||
done
|
done
|
||||||
# TODO(raymes): Something broke this with the new
|
if [[ ${#gen_locales[@]} -gt 0 ]] ; then
|
||||||
# glibc. Need to uncomment this as soon as it's fixed.
|
# Force LC_ALL=C to workaround slow string parsing in bash
|
||||||
# http://code.google.com/p/chromium-os/issues/detail?id=20378
|
# with long multibyte strings. Newer setups have this fixed,
|
||||||
#if [[ ${#gen_locales[@]} -gt 0 ]] ; then
|
# but locale-gen doesn't need to be run in any locale in the
|
||||||
# sudo -- chroot "$FLAGS_chroot" locale-gen -q -u \
|
# first place, so just go with C to keep it fast.
|
||||||
# -G "$(printf '%s\n' "${gen_locales[@]}")"
|
sudo -- chroot "$FLAGS_chroot" env LC_ALL=C locale-gen -q -u \
|
||||||
#fi
|
-G "$(printf '%s\n' "${gen_locales[@]}")"
|
||||||
|
fi
|
||||||
|
|
||||||
# Fix permissions on shared memory to allow non-root users access to POSIX
|
# Fix permissions on shared memory to allow non-root users access to POSIX
|
||||||
# semaphores.
|
# semaphores.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user