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

View file

@ -84,13 +84,8 @@ EOF
fi fi
# make sure we have the current locale defined in the container # 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 locale-gen en_US.UTF-8 chroot $rootfs update-locale LANG=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
return 0 return 0
} }