]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
lxc-ubuntu*: in precise, make /dev/shm a symbolic link to /run/shm
authorSerge Hallyn <serge.hallyn@ubuntu.com>
Tue, 31 Jul 2012 14:04:33 +0000 (16:04 +0200)
committerDaniel Lezcano <daniel.lezcano@free.fr>
Tue, 31 Jul 2012 14:04:33 +0000 (16:04 +0200)
This would be done (though done wrongly) by mounted-dev.conf, but
that doesn't run because we don't mount /dev.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
templates/lxc-ubuntu-cloud.in
templates/lxc-ubuntu.in

index 79d10c8d12a84d5fe7466a513744dbb161f88337..29d1bea5f3154238bbe9a3d72dfefb99e6c01088 100644 (file)
@@ -31,6 +31,7 @@ copy_configuration()
     rootfs=$2
     name=$3
     arch=$4
+    release=$5
 
     if [ $arch = "i386" ]; then
         arch="i686"
@@ -91,6 +92,16 @@ proc            proc         proc    nodev,noexec,nosuid 0 0
 sysfs           sys          sysfs defaults  0 0
 EOF
 
+    # rmdir /dev/shm in precise containers.
+    # I'm afraid of doing rm -rf $rootfs/dev/shm, in case it did
+    # get bind mounted to the host's /run/shm.  So try to rmdir
+    # it, and in case that fails move it out of the way.
+    if [ $release = "precise" ]; then
+        [ -d "$rootfs/dev/shm" ] && rmdir $rootfs/dev/shm
+        [ -e "$rootfs/dev/shm" ] && mv $rootfs/dev/shm $rootfs/dev/shm.bak
+        ln -s /run/shm $rootfs/dev/shm
+    fi
+
     return 0
 }
 
@@ -358,7 +369,7 @@ EOF
 
 ) 200>/var/lock/subsys/lxc-ubucloud
 
-copy_configuration $path $rootfs $name $arch
+copy_configuration $path $rootfs $name $arch $release
 
 echo "Container $name created."
 exit 0
index c232ab898171af0a7376a294690778cc51fc550c..89afb617e23f9f83b191f38d548dbdb422d8f831 100644 (file)
@@ -517,6 +517,16 @@ post_process()
         chroot $rootfs apt-get update
         chroot $rootfs apt-get install --force-yes -y --no-install-recommends upstart:${hostarch} mountall:amd64 iproute:amd64 isc-dhcp-client:amd64
     fi
+
+    # rmdir /dev/shm in precise containers.
+    # I'm afraid of doing rm -rf $rootfs/dev/shm, in case it did
+    # get bind mounted to the host's /run/shm.  So try to rmdir
+    # it, and in case that fails move it out of the way.
+    if [ $release = "precise" ]; then
+        [ -d "$rootfs/dev/shm" ] && rmdir $rootfs/dev/shm
+        [ -e "$rootfs/dev/shm" ] && mv $rootfs/dev/shm $rootfs/dev/shm.bak
+        ln -s /run/shm $rootfs/dev/shm
+    fi
 }
 
 do_bindhome()