bees: Try all findmnt modes in service wrapper

As reported by @Evils-Devils in Zygo/bees#123, the bees service wrapper
can fail on account of `findmnt` not being able to identify a mounted
filesystem using the default (kernel-introspection) mechanism.

Fall back to mtab and fstab-based inspection in turn should this fail.
This commit is contained in:
Charles Duffy 2019-08-24 15:31:01 -05:00 committed by Frederik Rietdijk
parent 459bad4be4
commit cb657d4ad1

@ -140,7 +140,11 @@ _setup() {
[[ $bees_uuid ]] || {
# if bees_uuid is not in our .conf file, look it up with findmnt
read -r bees_uuid fstype < <(findmnt -n -o uuid,fstype "$bees_fsSpec") && [[ $fstype ]] || exit
for findmnt_mode in --kernel --mtab --fstab; do
read -r bees_uuid fstype < <(findmnt "$findmnt_mode" -n -o uuid,fstype "$bees_fsSpec") ||:
[[ $bees_uuid && $fstype ]] && break
done
[[ $bees_uuid ]] || die "Unable to identify a device matching $bees_fsSpec with findmnt"
[[ $fstype = btrfs ]] || die "Device type is $fstype, not btrfs"
}