[Lxc-users] [PATCH 1/1] ubuntu template: use -updates and -security
Serge E. Hallyn
serge.hallyn at canonical.com
Thu Nov 10 21:42:37 UTC 2011
Particularly for LTS releases, which many people will want to use in
their containers, it is not wise to not use release-security and
release-updates. Furthermore the fix allowing ssh to allow the container
to shut down is in lucid-updates only.
With this patch, after debootstrapping a container, we add -updates and
-security to sources.list and do an upgrade under chroot. Unfortunately
we need to do this because debootstrap doesn't know how to.
Signed-off-by: Serge Hallyn <serge.hallyn at canonical.com>
---
templates/lxc-ubuntu.in | 24 ++++++++++++++++++++++--
1 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/templates/lxc-ubuntu.in b/templates/lxc-ubuntu.in
index d116f4c..a153433 100644
--- a/templates/lxc-ubuntu.in
+++ b/templates/lxc-ubuntu.in
@@ -105,9 +105,29 @@ download_ubuntu()
return 1
fi
- mv "$1/partial-$arch" "$1/rootfs-$arch"
- echo "Download complete."
+ # Serge isn't sure whether we should avoid doing this when
+ # $release == `distro-info -d`
+ echo "Installing updates"
+ if [ -z "$MIRROR" ]; then
+ MIRROR="http://archive.ubuntu.com/ubuntu"
+ fi
+ cat >> "$1/partial-${arch}/etc/apt/sources.list" << EOF
+deb $MIRROR ${release}-updates main universe
+deb $MIRROR ${release}-security main universe
+EOF
+ chroot "$1/partial-${arch}" apt-get update
+ if [ $? -ne 0 ]; then
+ echo "Failed to update the apt cache"
+ return 1
+ fi
+ chroot "$1/partial-${arch}" apt-get dist-upgrade -y
+ if [ $? -ne 0 ]; then
+ echo "Failed to upgrade the cache"
+ return 1
+ fi
+ mv "$1/partial-$arch" "$1/rootfs-$arch"
+ echo "Download complete"
return 0
}
--
1.7.5.4
More information about the lxc-users
mailing list