1
Description: Use release-updates and release-security
2
Particularly for LTS releases, which many people will want to use in
3
their containers, it is not wise to not use -security and -updates.
4
Furthermore the fix allowing ssh to allow the container to shut down
5
is in lucid-updates only.
6
With this patch, after debootstrapping a container, we add -updates
7
and -security to sources.list and do an apt-get upgrade under chroot.
8
Unfortunately we need to do this because debootstrap doesn't know how
10
Author: Serge Hallyn <serge.hallyn@canonical.com>
11
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/820715
14
Index: lxc-0.7.5/templates/lxc-ubuntu.in
15
===================================================================
16
--- lxc-0.7.5.orig/templates/lxc-ubuntu.in 2012-01-10 13:11:46.000000000 +0000
17
+++ lxc-0.7.5/templates/lxc-ubuntu.in 2012-01-10 13:30:26.614797334 +0000
22
- mv "$1/partial-$arch" "$1/rootfs-$arch"
23
- echo "Download complete."
24
+ # Serge isn't sure whether we should avoid doing this when
25
+ # $release == `distro-info -d`
26
+ echo "Installing updates"
29
+ MIRROR=${MIRROR:-http://archive.ubuntu.com/ubuntu}
30
+ SECURITY_MIRROR=${SECURITY_MIRROR:-http://security.ubuntu.com/ubuntu}
35
+ MIRROR=${MIRROR:-http://archive.ubuntu.com/ubuntu}
36
+ SECURITY_MIRROR=${SECURITY_MIRRORMIRROR:-http://security.ubuntu.com/ubuntu}
39
+ MIRROR=${MIRROR:-http://ports.ubuntu.com/ubuntu-ports}
40
+ SECURITY_MIRROR=${SECURITY_MIRROR:-http://ports.ubuntu.com/ubuntu-ports}
45
+ MIRROR=${MIRROR:-http://ports.ubuntu.com/ubuntu-ports}
46
+ SECURITY_MIRROR=${SECURITY_MIRROR:-http://ports.ubuntu.com/ubuntu-ports}
49
+ cat >> "$1/partial-${arch}/etc/apt/sources.list" << EOF
50
+deb $MIRROR ${release}-updates main universe
51
+deb $SECURITY_MIRROR ${release}-security main universe
53
+ chroot "$1/partial-${arch}" apt-get update
54
+ if [ $? -ne 0 ]; then
55
+ echo "Failed to update the apt cache"
58
+ cat > "$1/partial-${arch}"/usr/sbin/policy-rc.d << EOF
62
+ chmod +x "$1/partial-${arch}"/usr/sbin/policy-rc.d
64
+ lxc-unshare -s MOUNT -- chroot "$1/partial-${arch}" apt-get dist-upgrade -y
66
+ rm -f "$1/partial-${arch}"/usr/sbin/policy-rc.d
68
+ if [ $ret -ne 0 ]; then
69
+ echo "Failed to upgrade the cache"
73
+ mv "$1/partial-$arch" "$1/rootfs-$arch"
74
+ echo "Download complete"
79
if [ $release = "lucid" -o $release = "maverick" ]; then
80
chroot $rootfs apt-get install --force-yes -y python-software-properties
81
chroot $rootfs add-apt-repository ppa:ubuntu-virt/ppa
82
- chroot $rootfs apt-get update
84
+ cp /etc/resolv.conf "${rootfs}/etc"
85
+ chroot $rootfs apt-get update
86
chroot $rootfs apt-get install --force-yes -y lxcguest