~serge-hallyn/ubuntu/quantal/lxc/lxc-fixapi

« back to all changes in this revision

Viewing changes to debian/patches/0065-fix-bindhome-relpath

  • Committer: Package Import Robot
  • Author(s): Serge Hallyn
  • Date: 2012-03-29 22:04:30 UTC
  • Revision ID: package-import@ubuntu.com-20120329220430-2zmmk5063jvq3gtg
Tags: 0.7.5-3ubuntu47
0065-fix-bindhome-relpath: use relative path as target for bind mount
in lxc-ubuntu template (LP: #968371)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Description: lxc-ubuntu: use relative path as target for bind mount
 
2
 An absolute path will be interpreted as absolute with respect to the
 
3
 parent's namespace.
 
4
 This patch will be forwarded.
 
5
Author: Serge Hallyn <serge.hallyn@ubuntu.com>
 
6
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/968371
 
7
Forwarded: no
 
8
 
 
9
Index: lxc-0.7.5/templates/lxc-ubuntu.in
 
10
===================================================================
 
11
--- lxc-0.7.5.orig/templates/lxc-ubuntu.in      2012-03-29 22:05:46.000000000 +0000
 
12
+++ lxc-0.7.5/templates/lxc-ubuntu.in   2012-03-30 02:59:02.738912355 +0000
 
13
@@ -515,7 +515,12 @@
 
14
     # bind-mount the user's path into the container's /home
 
15
     h=`getent passwd $user | cut -d: -f 6`
 
16
     mkdir -p $rootfs/$h
 
17
-    echo "$h $h none bind 0 0" >> $path/fstab
 
18
+       # use relative path in container
 
19
+       h2=${h#/}
 
20
+       while [ ${h2:0:1} = "/" ]; do
 
21
+               h2=${h2#/}
 
22
+       done
 
23
+    echo "$h $h2 none bind 0 0" >> $path/fstab
 
24
 
 
25
     # Make sure the group exists in container
 
26
     grp=`echo $pwd | cut -d: -f 4`  # group number for $user