Commit b6e07af7 by José Martínez Committed by Stéphane Graber

lxc-ubuntu: fix btrfs when rootfs == realrootfs

Fix btrfs support when lxc-create does not bind-mount the rootfs. Signed-off-by: 's avatarJosé Martínez <xosemp@gmail.com> Acked-by: 's avatarStéphane Graber <stgraber@ubuntu.com>
parent 211d9f53
...@@ -404,10 +404,10 @@ copy_ubuntu() ...@@ -404,10 +404,10 @@ copy_ubuntu()
try_mksubvolume $rootfs try_mksubvolume $rootfs
if is_btrfs_subvolume $cache/rootfs-$arch && is_btrfs_subvolume $rootfs; then if is_btrfs_subvolume $cache/rootfs-$arch && is_btrfs_subvolume $rootfs; then
realrootfs=$(dirname $config)/rootfs realrootfs=$(dirname $config)/rootfs
umount $rootfs || return 1 [ "$rootfs" = "$realrootfs" ] || umount $rootfs || return 1
btrfs subvolume delete $realrootfs || return 1 btrfs subvolume delete $realrootfs || return 1
btrfs subvolume snapshot $cache/rootfs-$arch $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 else
rsync -Ha $cache/rootfs-$arch/ $rootfs/ || return 1 rsync -Ha $cache/rootfs-$arch/ $rootfs/ || return 1
fi fi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment