From: Stéphane Graber Date: Fri, 15 Aug 2014 23:59:45 +0000 (-0400) Subject: ubuntu: Check that btrfs is actually available X-Git-Tag: lxc-1.1.0.alpha2~85 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=206a255e17ab51f7fde49da0c286492398233167;p=thirdparty%2Flxc.git ubuntu: Check that btrfs is actually available Before calling btrfs and playing with subvolumes, let's make sure the btrfs command is available. Signed-off-by: Stéphane Graber --- 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