Force container locales to be "en_US.UTF-8" regardless of host's $LANG

This commit is contained in:
Fabio Rehm 2013-05-08 15:30:49 -03:00
parent 8a8fd73351
commit a230a48411
2 changed files with 9 additions and 17 deletions

View file

@ -66,17 +66,14 @@ EOF
$hostname
EOF
# reconfigure some services
if [ ! -z "${LANG}" ]; then
# set default locale
cat <<EOF > $rootfs/etc/locale.gen
${LANG} UTF-8
# set default locale
cat <<EOF > $rootfs/etc/locale.gen
en_US.UTF-8 UTF-8
EOF
echo "default locale set to ${LANG} UTF-8"
chroot $rootfs locale-gen ${LANG} > /dev/null 2>&1
chroot $rootfs update-locale LANG=${LANG}
echo 'update-locale done'
fi
echo "default locale set to en_US.UTF-8 UTF-8"
chroot $rootfs locale-gen 'en_US.UTF-8' > /dev/null 2>&1
chroot $rootfs update-locale LANG='en_US.UTF-8'
echo 'update-locale done'
# remove pointless services in a container
chroot $rootfs /usr/sbin/update-rc.d -f checkroot.sh remove

View file

@ -84,13 +84,8 @@ EOF
fi
# make sure we have the current locale defined in the container
if [ -z "$LANG" ]; then
chroot $rootfs locale-gen en_US.UTF-8
chroot $rootfs update-locale LANG=en_US.UTF-8
else
chroot $rootfs locale-gen $LANG
chroot $rootfs update-locale LANG=$LANG
fi
chroot $rootfs locale-gen en_US.UTF-8
chroot $rootfs update-locale LANG=en_US.UTF-8
return 0
}