From 206a255e17ab51f7fde49da0c286492398233167 Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Graber?= Date: Fri, 15 Aug 2014 19:59:45 -0400 Subject: [PATCH] ubuntu: Check that btrfs is actually available MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Before calling btrfs and playing with subvolumes, let's make sure the btrfs command is available. Signed-off-by: Stéphane Graber --- templates/lxc-ubuntu.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/lxc-ubuntu.in b/templates/lxc-ubuntu.in index 43d481755..776835772 100644 --- a/templates/lxc-ubuntu.in +++ b/templates/lxc-ubuntu.in @@ -63,7 +63,7 @@ try_mksubvolume() path=$1 [ -d $path ] && return 0 mkdir -p $(dirname $path) - if is_btrfs $(dirname $path); then + if which btrfs >/dev/null 2>&1 && is_btrfs $(dirname $path); then btrfs subvolume create $path else mkdir -p $path @@ -74,7 +74,7 @@ try_rmsubvolume() { path=$1 [ -d $path ] || return 0 - if is_btrfs_subvolume $path; then + if which btrfs >/dev/null 2>&1 && is_btrfs_subvolume $path; then btrfs subvolume delete $path else rm -rf $path @@ -406,7 +406,7 @@ copy_ubuntu() # make a local copy of the miniubuntu echo "Copying rootfs to $rootfs ..." try_mksubvolume $rootfs - if is_btrfs_subvolume $cache/rootfs-$arch && is_btrfs_subvolume $rootfs; then + if which btrfs >/dev/null 2>&1 && is_btrfs_subvolume $cache/rootfs-$arch && is_btrfs_subvolume $rootfs; then realrootfs=$(dirname $config)/rootfs [ "$rootfs" = "$realrootfs" ] || umount $rootfs || return 1 btrfs subvolume delete $realrootfs || return 1 -- 2.47.2