# We can't always tell the filesystem type up front, but if we have the
# information then we should use it. Note that we can't use block-attr here
# as it's only available in udebs.
+# If not detected after different attempts then "NOT-DETECTED" will be printed
+# because function is not supposed to exit error codes.
fs_type () {
+ local fstype=""
if (export PATH="/lib/udev:$PATH"; type vol_id) >/dev/null 2>&1; then
- PATH="/lib/udev:$PATH" vol_id --type "$1" 2>/dev/null
- elif type blkid >/dev/null 2>&1; then
- blkid -o value -s TYPE "$1" 2>/dev/null
- else
- return 0
+ PATH="/lib/udev:$PATH" \
+ fstype=$(vol_id --type "$1" 2>/dev/null || true)
+ [ -z "$fstype" ] || { echo "$fstype"; return; }
+ fi
+ if type lsblk >/dev/null 2>&1 ; then
+ fstype=$(lsblk --nodeps --noheading --output FSTYPE -- "$1" || true)
+ [ -z "$fstype" ] || { echo "$fstype"; return; }
+ fi
+ if type blkid >/dev/null 2>&1; then
+ fstype=$(blkid -o value -s TYPE "$1" 2>/dev/null || true)
+ [ -z "$fstype" ] || { echo "$fstype"; return; }
fi
+ echo "NOT-DETECTED"
}
is_dos_extended_partition() {
* Add os-release support (based loosely on a patch by Török Edwin; closes:
#794409).
* Add Devuan detection (thanks, David Hare; closes: #801631).
+ * Work harder to avoid trying to mount extended partitions (thanks,
+ Philippe Coval; closes: #784709).
-- Colin Watson <cjwatson@debian.org> Sat, 31 Dec 2016 17:11:49 +0000
rmdir "$tmpmnt" || true
}
-types="$(fs_type "$partition")" || types=NOT-DETECTED
+types="$(fs_type "$partition")"
if [ "$types" = NOT-DETECTED ]; then
debug "$1 type not recognised; skipping"
exit 0