~ubuntu-branches/ubuntu/precise/lxc/precise

« back to all changes in this revision

Viewing changes to debian/patches/0070-templates-rmdir-dev-shm

  • Committer: Package Import Robot
  • Author(s): Serge Hallyn
  • Date: 2012-04-12 09:54:22 UTC
  • Revision ID: package-import@ubuntu.com-20120412095422-lzg0tj2ktp5669zs
Tags: 0.7.5-3ubuntu51
0070-templates-rmdir-dev-shm: in precise containers, rmdir $rootfs/dev/shm
and and create it as a symbolic link to /run/shm.  (LP: #974584)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Description: in precise, make /dev/shm a symbolic link to /run/shm
 
2
 This would be done (though done wrongly) by mounted-dev.conf, but
 
3
 that doesn't run because we don't mount /dev.
 
4
Author: Serge Hallyn <serge.hallyn@ubuntu.com>
 
5
Forwarded: no
 
6
Bug-Ubuntu: https://bugs.launchpad.net/launchpad/+bug/974584
 
7
 
 
8
Index: lxc-0.7.5/templates/lxc-ubuntu-cloud.in
 
9
===================================================================
 
10
--- lxc-0.7.5.orig/templates/lxc-ubuntu-cloud.in        2012-04-12 10:33:38.000000000 -0500
 
11
+++ lxc-0.7.5/templates/lxc-ubuntu-cloud.in     2012-04-12 11:11:57.066675104 -0500
 
12
@@ -31,6 +31,7 @@
 
13
     rootfs=$2
 
14
     name=$3
 
15
     arch=$4
 
16
+    release=$5
 
17
 
 
18
     if [ $arch = "i386" ]; then
 
19
         arch="i686"
 
20
@@ -93,6 +94,16 @@
 
21
 sysfs           sys          sysfs defaults  0 0
 
22
 EOF
 
23
 
 
24
+    # rmdir /dev/shm in precise containers.
 
25
+    # I'm afraid of doing rm -rf $rootfs/dev/shm, in case it did
 
26
+    # get bind mounted to the host's /run/shm.  So try to rmdir
 
27
+    # it, and in case that fails move it out of the way.
 
28
+    if [ $release = "precise" ]; then
 
29
+        [ -d "$rootfs/dev/shm" ] && rmdir $rootfs/dev/shm
 
30
+        [ -e "$rootfs/dev/shm" ] && mv $rootfs/dev/shm $rootfs/dev/shm.bak
 
31
+        ln -s /run/shm $rootfs/dev/shm
 
32
+    fi
 
33
+
 
34
     return 0
 
35
 }
 
36
 
 
37
@@ -360,7 +371,7 @@
 
38
 
 
39
 ) 200>/var/lock/subsys/lxc-ubucloud
 
40
 
 
41
-copy_configuration $path $rootfs $name $arch
 
42
+copy_configuration $path $rootfs $name $arch $release
 
43
 
 
44
 echo "Container $name created."
 
45
 exit 0
 
46
Index: lxc-0.7.5/templates/lxc-ubuntu.in
 
47
===================================================================
 
48
--- lxc-0.7.5.orig/templates/lxc-ubuntu.in      2012-04-12 10:33:38.000000000 -0500
 
49
+++ lxc-0.7.5/templates/lxc-ubuntu.in   2012-04-12 11:11:36.498674838 -0500
 
50
@@ -491,6 +491,16 @@
 
51
         chroot $rootfs apt-get update
 
52
         chroot $rootfs apt-get install --force-yes -y --no-install-recommends upstart:${hostarch} mountall:amd64 iproute:amd64 isc-dhcp-client:amd64
 
53
     fi
 
54
+
 
55
+    # rmdir /dev/shm in precise containers.
 
56
+    # I'm afraid of doing rm -rf $rootfs/dev/shm, in case it did
 
57
+    # get bind mounted to the host's /run/shm.  So try to rmdir
 
58
+    # it, and in case that fails move it out of the way.
 
59
+    if [ $release = "precise" ]; then
 
60
+        [ -d "$rootfs/dev/shm" ] && rmdir $rootfs/dev/shm
 
61
+        [ -e "$rootfs/dev/shm" ] && mv $rootfs/dev/shm $rootfs/dev/shm.bak
 
62
+        ln -s /run/shm $rootfs/dev/shm
 
63
+    fi
 
64
 }
 
65
 
 
66
 do_bindhome()