]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
lxc-ubuntu: fix btrfs when rootfs == realrootfs
authorJosé Martínez <xosemp@gmail.com>
Sun, 6 Jul 2014 19:55:41 +0000 (21:55 +0200)
committerStéphane Graber <stgraber@ubuntu.com>
Mon, 7 Jul 2014 14:49:09 +0000 (10:49 -0400)
Fix btrfs support when lxc-create does not bind-mount the rootfs.

Signed-off-by: José Martínez <xosemp@gmail.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
templates/lxc-ubuntu.in

index 8550ce920739d8609ad7569a0a3a62de485bd65d..b151375a10a93b5efed35842afeaf24fbab44a3d 100644 (file)
@@ -404,10 +404,10 @@ copy_ubuntu()
     try_mksubvolume $rootfs
     if is_btrfs_subvolume $cache/rootfs-$arch && is_btrfs_subvolume $rootfs; then
       realrootfs=$(dirname $config)/rootfs
-      umount $rootfs || return 1
+      [ "$rootfs" = "$realrootfs" ] || umount $rootfs || return 1
       btrfs subvolume delete $realrootfs || return 1
       btrfs subvolume snapshot $cache/rootfs-$arch $realrootfs || return 1
-      mount --bind $realrootfs $rootfs || return 1
+      [ "$rootfs" = "$realrootfs" ] || mount --bind $realrootfs $rootfs || return 1
     else
       rsync -Ha $cache/rootfs-$arch/ $rootfs/ || return 1
     fi