From cb657d4ad16331b1eef675dcefc348ff0abce502 Mon Sep 17 00:00:00 2001 From: Charles Duffy Date: Sat, 24 Aug 2019 15:31:01 -0500 Subject: [PATCH] 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. --- pkgs/tools/filesystems/bees/bees-service-wrapper | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkgs/tools/filesystems/bees/bees-service-wrapper b/pkgs/tools/filesystems/bees/bees-service-wrapper index 8ef46afc18f5..67c95e8f8031 100755 --- a/pkgs/tools/filesystems/bees/bees-service-wrapper +++ b/pkgs/tools/filesystems/bees/bees-service-wrapper @@ -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" }