[lxc-devel] [PATCH] ubuntu: Don't break when the locale is C.*

Stéphane Graber stgraber at ubuntu.com
Wed Apr 24 19:38:32 UTC 2013


Update the code to also match C.* so that C.UTF-8 doesn't make the
container creation fail.

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 templates/lxc-ubuntu.in | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/templates/lxc-ubuntu.in b/templates/lxc-ubuntu.in
index 83311fd..7100acc 100644
--- a/templates/lxc-ubuntu.in
+++ b/templates/lxc-ubuntu.in
@@ -81,14 +81,12 @@ EOF
     fi
 
     # make sure we have the current locale defined in the container
-    if [ -z "$LANG" ]; then
+    if [ -z "$LANG" ] || echo $LANG | grep -E -q "^C(\..+)*$"; then
         chroot $rootfs locale-gen en_US.UTF-8
         chroot $rootfs update-locale LANG=en_US.UTF-8
     else
-        if [ "$LANG" != "C" ]; then
-            chroot $rootfs locale-gen $LANG
-            chroot $rootfs update-locale LANG=$LANG
-        fi
+        chroot $rootfs locale-gen $LANG
+        chroot $rootfs update-locale LANG=$LANG
     fi
 
     # generate new SSH keys
-- 
1.8.1.2





More information about the lxc-devel mailing list