Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)

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.

authored by Charles Duffy and committed by Frederik Rietdijk cb657d4a 459bad4b

+5 -1
+5 -1
pkgs/tools/filesystems/bees/bees-service-wrapper
··· 140 140 141 141 [[ $bees_uuid ]] || { 142 142 # if bees_uuid is not in our .conf file, look it up with findmnt 143 - read -r bees_uuid fstype < <(findmnt -n -o uuid,fstype "$bees_fsSpec") && [[ $fstype ]] || exit 143 + for findmnt_mode in --kernel --mtab --fstab; do 144 + read -r bees_uuid fstype < <(findmnt "$findmnt_mode" -n -o uuid,fstype "$bees_fsSpec") ||: 145 + [[ $bees_uuid && $fstype ]] && break 146 + done 147 + [[ $bees_uuid ]] || die "Unable to identify a device matching $bees_fsSpec with findmnt" 144 148 [[ $fstype = btrfs ]] || die "Device type is $fstype, not btrfs" 145 149 } 146 150