[lxc-devel] [lxc/master] lxc-debian improvements

terceiro on Github lxc-bot at linuxcontainers.org
Sat Oct 28 12:39:31 UTC 2017


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 301 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20171028/b18f2652/attachment.bin>
-------------- next part --------------
From c99055ea6d64e003b489e01a0379275699c794d0 Mon Sep 17 00:00:00 2001
From: Antonio Terceiro <terceiro at debian.org>
Date: Fri, 27 Oct 2017 17:13:54 -0200
Subject: [PATCH 1/2] lxc-debian: don't write C.* locales to /etc/locale.gen

Doing that confuses locale generation. lxc-ubuntu does the same check

Signed-off-by: Antonio Terceiro <terceiro at debian.org>
---
 templates/lxc-debian.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/templates/lxc-debian.in b/templates/lxc-debian.in
index 8ee0f95b0..4b92328f2 100644
--- a/templates/lxc-debian.in
+++ b/templates/lxc-debian.in
@@ -122,7 +122,7 @@ EOF
     # reconfigure some services
 
     # but first reconfigure locales - so we get no noisy perl-warnings
-    if [ -z "$LANG" ]; then
+    if [ -z "$LANG" ] || echo $LANG | grep -E -q "^C(\..+)*$"; then
         cat >> "$rootfs/etc/locale.gen" << EOF
 en_US.UTF-8 UTF-8
 EOF

From dba285d5dfa7e9f3452dc180e64158d9bedfb410 Mon Sep 17 00:00:00 2001
From: Antonio Terceiro <terceiro at debian.org>
Date: Sat, 28 Oct 2017 09:20:35 -0200
Subject: [PATCH 2/2] lxc-debian: don't hardcode valid releases

This avoids the dance of updating the list of valid releases every time
Debian makes a new release.

It also fixes the following bug: even though lxc-debian will default to
creating containers of the latest stable by querying the archive, it
won't allow you to explicitly request `stable` because the current list
of valid releases don't include it.

Last, but not least, avoid hitting the mirror in the case the desired
release is one of the ones we know will always be there, i.e. stable,
testing, sid, and unstable.

Signed-off-by: Antonio Terceiro <terceiro at debian.org>
---
 templates/lxc-debian.in | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/templates/lxc-debian.in b/templates/lxc-debian.in
index 4b92328f2..fa87cb95d 100644
--- a/templates/lxc-debian.in
+++ b/templates/lxc-debian.in
@@ -768,12 +768,13 @@ if [ -n "$authkey" ]; then
     fi
 fi
 
-current_release=$(wget "${MIRROR}/dists/stable/Release" -O - 2> /dev/null | head |awk '/^Codename: (.*)$/ { print $2; }')
-release=${release:-${current_release}}
-valid_releases=('wheezy' 'jessie' 'stretch' 'buster' 'testing' 'sid' 'unstable')
-if [[ ! "${valid_releases[*]}" =~ (^|[^[:alpha:]])$release([^[:alpha:]]|$) ]]; then
-    echo "Invalid release ${release}, valid ones are: ${valid_releases[*]}"
-    exit 1
+release=${release:-stable}
+permanent_releases=('stable' 'testing' 'sid' 'unstable')
+if [[ ! "${permanent_releases[*]}" =~ (^|[^[:alpha:]])$release([^[:alpha:]]|$) ]]; then
+    if ! wget "${MIRROR}/dists/${release}/Release" -O /dev/null 2> /dev/null; then
+	echo "Invalid release ${release} (not found in mirror)"
+	exit 1
+    fi
 fi
 
 # detect rootfs


More information about the lxc-devel mailing list