[PATCH] setup-commands/setup-testbed: handle options in sources.list
Antonio Terceiro
terceiro at debian.org
Tue Jan 5 18:06:43 UTC 2016
the lxc-debian template will generate sources.list lines like the
following:
deb [arch=amd64] http://http.debian.net/debian sid main contrib non-free
So before extracting $2 and $3 as mirror and release, we need first to
normalize the lines by removing any options between brackets.
---
setup-commands/setup-testbed | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/setup-commands/setup-testbed b/setup-commands/setup-testbed
index bf41442..d92267e 100755
--- a/setup-commands/setup-testbed
+++ b/setup-commands/setup-testbed
@@ -88,10 +88,10 @@ fi
# set up apt sources
if [ -z "${MIRROR:-}" ]; then
- MIRROR=`awk '/^deb .*(debian|ubuntu)/ { print $2; exit }' "$root/etc/apt/sources.list"`
+ MIRROR=`awk 'sub(/\[.*\]/, "", $0); /^deb .*(debian|ubuntu)/ { print $2; exit }' "$root/etc/apt/sources.list"`
fi
if [ -z "${RELEASE:-}" ]; then
- RELEASE=`awk '/^deb .*(debian|ubuntu)/ { print $3; exit }' "$root/etc/apt/sources.list"`
+ RELEASE=`awk 'sub(/\[.*\]/, "", $0); /^deb .*(debian|ubuntu)/ { print $3; exit }' "$root/etc/apt/sources.list"`
fi
if [ "${MIRROR%ubuntu*}" != "$MIRROR" ]; then
cat << EOF > "$root/etc/apt/sources.list"
--
2.7.0.rc3
More information about the autopkgtest-devel
mailing list