~ubuntu-branches/ubuntu/quantal/lxc/quantal-201205292108

« back to all changes in this revision

Viewing changes to debian/patches/0015-ubuntu-templ-use-updates.patch

  • Committer: Package Import Robot
  • Author(s): Serge Hallyn
  • Date: 2012-04-26 15:18:35 UTC
  • mfrom: (3.1.41 sid)
  • Revision ID: package-import@ubuntu.com-20120426151835-3vz6kb4m90gb26js
Tags: 0.8.0~rc1-4ubuntu1
* Merge from unstable.  Remaining changes:
  - control:
    - update maintainer
    - Build-Depends: add dh-apparmor and libapparmor-dev
    - lxc Depends: add bridge-utils, dnsmasq-base, iptables, rsync
    - lxc Recommends: add cgroup-lite | cgroup-bin, openssl
    - lxc Suggests: add btrfs-tools, lvm2, qemu-user-static
    - lxc Conflicts: remove (cgroup-bin)
  - Add lxc-start-ephemeral and lxc-wait to debian/local
  - apparmor:
    - add lxc.apparmor, lxc-containers.apparmor,
      lxc-default.apparmor, and new lxc.apparmor.in
  - add debian/lxc.conf (default container creation config file)
  - debian/lxc.install.in:
    * add lxc-start-ephemeral
    * add debian/lxc.conf
    * skip lxc-debconf*
    * skip lxc-ls (Use upstream's)
  - debian/lxc*.install.in: use '*', not @DEB_HOST_MULTIARCH@
  - Use our own completely different lxc.postinst and lxc.postrm
  - remove lxc.templates
  - debian/rules:
    * add DEB_DH_INSTALLINIT_ARGS = --upstart-only
    * don't do debconf stuff
    * add debian/*.apparmor.in to files processed under
      override_dh_auto_clean
    * don't comment out ubuntu or busybox templates
    * do apparmor stuff and install our own lxc-wait under override_dh_install
    * install our upstart scripts in override_dh_installinit
  - add lxc.default, lxc.lxc-net.upstart, lxc.upstart under
    debian/

* patches kept:
  - 0013-lxc-create-use-default-config.patch (needed manual rebase)
  - 0030-ubuntu-template-fail.patch
  - 0031-ubuntu-template-resolvconf.patch
  - 0044-lxc-destroy-rm-autos
  - debian/patches/0045-fix-other-templates
  - debian/patches/0046-lxc-clone-change-hwaddr
  - debian/patches/0047-bindhome-check-shell
  - debian/patches/0049-ubuntu-template-sudo-and-cleanup
  - debian/patches/0050-clone-lvm-sizes
  - debian/patches/0052-ubuntu-bind-user-conflict
  - debian/patches/0053-lxc-start-pin-rootfs
  - debian/patches/0054-ubuntu-debug
  - debian/patches/0055-ubuntu-handle-badgrp
  - debian/patches/0056-dont-watch-utmp
  - debian/patches/0057-update-manpages
  - debian/patches/0058-fixup-ubuntu-cloud
  - debian/patches/0059-reenable-daily-cloudimg
  - debian/patches/0060-lxc-shutdown
  - debian/patches/0061-lxc-start-apparmor
  - debian/patches/0062-templates-relative-paths
  - debian/patches/0063-check-apparmor-enabled
  - debian/patches/0064-apparmor-mount-proc
  - debian/patches/0065-fix-bindhome-relpath
  - debian/patches/0066-confile-typo
  - debian/patches/0067-templates-lxc-profile
  - debian/patches/0068-fix-lxc-config-layout 
  - debian/patches/0069-ubuntu-cloud-fix
  - debian/patches/0070-templates-rmdir-dev-shm
  - debian/patches/0071-ubuntu-cloud-fix-image-extraction
  - debian/patches/0072-lxc-shutdown-help
  - debian/patches/0073-lxc-destroy-waits-before-destroy
  - mark all patches which have been forwarded as such, refresh all
* 0074-lxc-execute-find-init: lxc-init had moved.  Introduce a function in
  lxc-execute to go find it.  Otherwise lxc-execute for any older releases
  will fail.
* 0075-lxc-ls-bash: lxc-ls needs bash, not sh
* add debian/lxc.apparmor.in so DEB_HOST_MULTIARCH can be expanded
* 0076-fix-sprintfs:  - check return values for all sprintfs and snprintfs
  which could overflow (LP: #988918)
* 0077-execute-without-rootfs: let lxc-execute succeed with no rootfs
  (LP: #981955)

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
9
 
 to.
10
 
Author: Serge Hallyn <serge.hallyn@canonical.com>
11
 
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/820715
12
 
Forwarded: yes
13
 
 
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
18
 
@@ -105,9 +105,57 @@
19
 
             return 1
20
 
     fi
21
 
 
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"
27
 
+    case $arch in
28
 
+      amd64|i386)
29
 
+            MIRROR=${MIRROR:-http://archive.ubuntu.com/ubuntu}
30
 
+            SECURITY_MIRROR=${SECURITY_MIRROR:-http://security.ubuntu.com/ubuntu}
31
 
+            ;;
32
 
+      sparc)
33
 
+            case $SUITE in
34
 
+              gutsy)
35
 
+            MIRROR=${MIRROR:-http://archive.ubuntu.com/ubuntu}
36
 
+            SECURITY_MIRROR=${SECURITY_MIRRORMIRROR:-http://security.ubuntu.com/ubuntu}
37
 
+            ;;
38
 
+              *)
39
 
+            MIRROR=${MIRROR:-http://ports.ubuntu.com/ubuntu-ports}
40
 
+            SECURITY_MIRROR=${SECURITY_MIRROR:-http://ports.ubuntu.com/ubuntu-ports}
41
 
+            ;;
42
 
+            esac
43
 
+            ;;
44
 
+      *)
45
 
+            MIRROR=${MIRROR:-http://ports.ubuntu.com/ubuntu-ports}
46
 
+            SECURITY_MIRROR=${SECURITY_MIRROR:-http://ports.ubuntu.com/ubuntu-ports}
47
 
+            ;;
48
 
+    esac
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
52
 
+EOF
53
 
+    chroot "$1/partial-${arch}" apt-get update
54
 
+    if [ $? -ne 0 ]; then
55
 
+        echo "Failed to update the apt cache"
56
 
+        return 1
57
 
+    fi
58
 
+    cat > "$1/partial-${arch}"/usr/sbin/policy-rc.d << EOF
59
 
+#!/bin/sh
60
 
+exit 101
61
 
+EOF
62
 
+    chmod +x "$1/partial-${arch}"/usr/sbin/policy-rc.d
63
 
+
64
 
+    lxc-unshare -s MOUNT -- chroot "$1/partial-${arch}" apt-get dist-upgrade -y
65
 
+    ret=$?
66
 
+    rm -f "$1/partial-${arch}"/usr/sbin/policy-rc.d
67
 
+
68
 
+    if [ $ret -ne 0 ]; then
69
 
+        echo "Failed to upgrade the cache"
70
 
+        return 1
71
 
+    fi
72
 
 
73
 
+    mv "$1/partial-$arch" "$1/rootfs-$arch"
74
 
+    echo "Download complete"
75
 
     return 0
76
 
 }
77
 
 
78
 
@@ -326,8 +374,9 @@
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
83
 
         fi
84
 
+        cp /etc/resolv.conf "${rootfs}/etc"
85
 
+        chroot $rootfs apt-get update
86
 
         chroot $rootfs apt-get install --force-yes -y lxcguest
87
 
     fi
88
 
 }