From 0e952295841bce6cf7de4424a28382f5875a8178 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E6=9C=89=E5=BC=A0=E7=BA=B8?= Date: Wed, 1 Jul 2015 23:39:08 +0800 Subject: [PATCH] debian template: reconfigure locales Signed-off-by: feng xiahou --- templates/lxc-debian.in | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/templates/lxc-debian.in b/templates/lxc-debian.in index 914f2e19a..a60e9e7df 100644 --- a/templates/lxc-debian.in +++ b/templates/lxc-debian.in @@ -97,22 +97,6 @@ $hostname EOF # reconfigure some services - if [ -z "$LANG" ]; then - cat >> $rootfs/etc/locale.gen << EOF -en_US.UTF-8 UTF-8 -EOF - chroot $rootfs locale-gen en_US.UTF-8 UTF-8 - chroot $rootfs update-locale LANG=en_US.UTF-8 - else - encoding=$(echo $LANG | cut -d. -f2) - chroot $rootfs sed -e "s/^# \(${LANG} ${encoding}\)/\1/" \ - -i /etc/locale.gen 2> /dev/null - cat >> $rootfs/etc/locale.gen << EOF -$LANG $encoding -EOF - chroot $rootfs locale-gen $LANG $encoding - chroot $rootfs update-locale LANG=$LANG - fi # remove pointless services in a container chroot $rootfs /usr/sbin/update-rc.d -f checkroot.sh disable @@ -402,6 +386,25 @@ EOF # Re-enable service startup rm ${rootfs}/usr/sbin/policy-rc.d + + # reconfigure locales + if [ -z "$LANG" ]; then + cat >> $rootfs/etc/locale.gen << EOF +en_US.UTF-8 UTF-8 +EOF + chroot $rootfs locale-gen en_US.UTF-8 UTF-8 + chroot $rootfs update-locale LANG=en_US.UTF-8 + else + encoding=$(echo $LANG | cut -d. -f2) + chroot $rootfs sed -e "s/^# \(${LANG} ${encoding}\)/\1/" \ + -i /etc/locale.gen 2> /dev/null + cat >> $rootfs/etc/locale.gen << EOF +$LANG $encoding +EOF + chroot $rootfs locale-gen $LANG $encoding + chroot $rootfs update-locale LANG=$LANG + fi + # end } clean() -- 2.47.2