From: Serge Hallyn Date: Tue, 31 Jul 2012 14:04:33 +0000 (+0200) Subject: lxc-ubuntu: use relative path as target for bind mount X-Git-Tag: lxc-0.8.0~32 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e4208a1995538460cd2a5f75fdafb70cf30599b3;p=thirdparty%2Flxc.git lxc-ubuntu: use relative path as target for bind mount An absolute path will be interpreted as absolute with respect to the parent's namespace. Signed-off-by: Serge Hallyn Signed-off-by: Daniel Lezcano --- diff --git a/templates/lxc-ubuntu.in b/templates/lxc-ubuntu.in index b1139b4d6..e71c5fe1c 100644 --- a/templates/lxc-ubuntu.in +++ b/templates/lxc-ubuntu.in @@ -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