[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#767471: [PATCH initramfs-tools 3/4] hooks/fsck: Always use get_fstype to probe type of root filesystem



We can't trust the type in /etc/fstab because it is not used when
mounting the root filesystem.

Closes: #767471
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 hooks/fsck | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/hooks/fsck b/hooks/fsck
index 486a04f..86d0dde 100755
--- a/hooks/fsck
+++ b/hooks/fsck
@@ -55,18 +55,16 @@ get_fsck_type_fstab () {
 
 	# Not found by default.
 	if [ "$1" = "$MNT_DIR" ] && [ "$MNT_PASS" != 0 ]; then
-		case "$MNT_TYPE" in
-			auto)
-				MNT_FSNAME=$(resolve_device "$MNT_FSNAME")
-				alias fstype="/usr/lib/klibc/bin/fstype"
-				get_fstype "${MNT_FSNAME}"
-				unalias fstype
-				;;
-			*)
-				echo "$MNT_TYPE"
-				;;
-		esac
-
+		# Ignore filesystem type for /, as it is not available and
+		# therefore never used at boot time
+		if [ "${MNT_DIR}" = "/" ] || [ "${MNT_TYPE}" = "auto" ]; then
+			MNT_FSNAME="$(resolve_device "${MNT_FSNAME}")"
+			alias fstype="/usr/lib/klibc/bin/fstype"
+			get_fstype "${MNT_FSNAME}"
+			unalias fstype
+		else
+			echo "${MNT_TYPE}"
+		fi
 	fi
 }
 

Attachment: signature.asc
Description: Digital signature


Reply to: