Only try to use btrfs snapshots if chroots are on a btrfs partition

This commit is contained in:
Pierre Schmitz 2013-04-06 19:50:17 +02:00
parent 092fe2ffde
commit 6caad191c1
2 changed files with 7 additions and 3 deletions

View File

@ -58,7 +58,9 @@ if ${clean_first} || [[ ! -d "${chroots}/${repo}-${arch}" ]]; then
stat_done
fi
{ type -P btrfs && btrfs subvolume delete "${copy}"; } &>/dev/null
if [[ "$(stat -f -c %T "${copy}")" == btrfs ]]; then
{ type -P btrfs && btrfs subvolume delete "${copy}"; } &>/dev/null
fi
rm -rf --one-file-system "${copy}"
done
exec 9>&-

View File

@ -160,8 +160,10 @@ else
mkdir -p "${working_dir}"
fi
if { type -P btrfs && btrfs subvolume create "${working_dir}"; } &>/dev/null; then
chmod 0755 "${working_dir}"
if [[ "$(stat -f -c %T "${working_dir}")" == btrfs ]]; then
if { type -P btrfs && btrfs subvolume create "${working_dir}"; } &>/dev/null; then
chmod 0755 "${working_dir}"
fi
fi
chroot_lock