]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
lxc-ubuntu: use relative path as target for bind mount
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)
An absolute path will be interpreted as absolute with respect to the
parent's namespace.

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

index b1139b4d6a933b6d93c9f824fecc1f59fef28e66..e71c5fe1c18eaec2f85f5d9e5d1ba9f6a106007e 100644 (file)
@@ -543,7 +543,12 @@ do_bindhome()
     # bind-mount the user's path into the container's /home
     h=`getent passwd $user | cut -d: -f 6`
     mkdir -p $rootfs/$h
-    echo "$h $h none bind 0 0" >> $path/fstab
+       # use relative path in container
+       h2=${h#/}
+       while [ ${h2:0:1} = "/" ]; do
+               h2=${h2#/}
+       done
+    echo "$h $h2 none bind 0 0" >> $path/fstab
 
     # Make sure the group exists in container
     grp=`echo $pwd | cut -d: -f 4`  # group number for $user