lxc-ubuntu: Always create the needed locales

Move some old code from the trim() function into the main configure_ubuntu
function so that we always create a locale in the container.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
This commit is contained in:
Stéphane Graber 2012-11-28 18:29:55 -05:00
parent e62fa3f9ce
commit 18f823c1ca

View File

@ -80,6 +80,15 @@ EOF
echo "ubuntu:ubuntu" | chroot $rootfs chpasswd echo "ubuntu:ubuntu" | chroot $rootfs chpasswd
fi 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
return 0 return 0
} }
@ -431,15 +440,6 @@ EOF
# /lib/init/fstab: cleared out for bare-bones lxc # /lib/init/fstab: cleared out for bare-bones lxc
EOF EOF
# reconfigure some services
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
# remove pointless services in a container # remove pointless services in a container
chroot $rootfs /usr/sbin/update-rc.d -f ondemand remove chroot $rootfs /usr/sbin/update-rc.d -f ondemand remove