]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
templates: avoid noisy perl warnings caused by missing locales
authorAndreas Freudenberg <andreas.freudenberg@licomonch.net>
Tue, 12 Jul 2016 15:51:06 +0000 (17:51 +0200)
committerAndreas Freudenberg <andreas.freudenberg@licomonch.net>
Wed, 20 Jul 2016 22:58:19 +0000 (00:58 +0200)
Signed-off-by: Andreas Freudenberg <andreas.freudenberg@licomonch.net>
templates/lxc-debian.in

index 62a0c8506b61145938114320d9ab255d35a9d46c..f4a46a5ce3a25717795274a26bca6065ef0ae56b 100644 (file)
@@ -121,6 +121,24 @@ EOF
 
     # reconfigure some services
 
+    # but first reconfigure locales - so we get no noisy perl-warnings
+    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
     chroot $rootfs /usr/sbin/update-rc.d -f umountfs disable
@@ -549,23 +567,6 @@ 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
 }