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

[PATCH initramfs-tools 3/3] hooks/fsck: Fix type lookup for mount by UUID or label with type=auto



Oddly, blkid doesn't accept UUID= or LABEL= syntax for the device name.
Use the same resolve_device function we use to find the device node in
the initramfs.

Rename get_fstype to get_fstype_fstab, since scripts/function also
defines a get_fstype function.

Closes: #766448
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 hooks/fsck | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/hooks/fsck b/hooks/fsck
index cc860b5..c0b1ca5 100755
--- a/hooks/fsck
+++ b/hooks/fsck
@@ -49,7 +49,7 @@ _read_fstab_entry () {
 
 # Find a specific fstab entry and print its type (if found)
 # $1=mountpoint
-get_fstype () {
+get_fstype_fstab () {
 	eval "$(_read_fstab_entry "$1")"
 
 	# Not found by default.
@@ -57,6 +57,7 @@ get_fstype () {
 		case "$MNT_TYPE" in
 			auto)
 				if command -v blkid >/dev/null 2>&1 ; then
+					MNT_FSNAME=$(resolve_device "$MNT_FSNAME")
 					MNT_TYPE=$(blkid -o value -s TYPE "${MNT_FSNAME}")
 				fi
 				if [ -z "${MNT_TYPE}" ]; then
@@ -73,8 +74,8 @@ get_fstype () {
 }
 
 get_fstypes() {
-	get_fstype /
-	get_fstype /usr
+	get_fstype_fstab /
+	get_fstype_fstab /usr
 }
 
 case $1 in
@@ -88,6 +89,7 @@ if [ ! -x /sbin/fsck ]; then
 	exit 0
 fi
 
+. /usr/share/initramfs-tools/scripts/functions
 . /usr/share/initramfs-tools/hook-functions
 


-- 
Ben Hutchings
The first rule of tautology club is the first rule of tautology club.

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: