From f92804c752f96b011582db37032ac3c3d2b1b644 Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Sun, 20 Oct 2013 16:39:57 +0200 Subject: [PATCH] 00-rootdev.sh: always use the blkid detected fstype unless rootfstype= is passed --- defaults/initrd.d/00-rootdev.sh | 16 +++++++++++++--- defaults/linuxrc | 1 - 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/defaults/initrd.d/00-rootdev.sh b/defaults/initrd.d/00-rootdev.sh index 3a3e3be..d73cb5a 100755 --- a/defaults/initrd.d/00-rootdev.sh +++ b/defaults/initrd.d/00-rootdev.sh @@ -69,11 +69,14 @@ _rootdev_mount() { local mount_opts=ro local mount_fstype="${ROOTFSTYPE}" local fstype=$(get_device_fstype "${REAL_ROOT}") + if is_zfs_fstype "${fstype}"; then - mount_fstype=zfs + [ -z "${mount_fstype}" ] && mount_fstype=zfs mount_opts=$(zfs_get_real_root_mount_flags) fi + [ -z "${mount_fstype}" ] && mount_fstype="${fstype}" + good_msg "Detected fstype: ${fstype}" good_msg "Using mount fstype: ${mount_fstype}" _fstype_init "${fstype}" @@ -84,8 +87,15 @@ _rootdev_mount() { good_msg "Using mount opts: -o ${mopts}" mount -t "${mount_fstype}" -o "${mopts}" \ - "${REAL_ROOT}" "${NEW_ROOT}" || return 1 - return 0 + "${REAL_ROOT}" "${NEW_ROOT}" && return 0 + + bad_msg "Cannot mount ${REAL_ROOT}, trying with -t auto" + mount -t "auto" -o "${mopts}" \ + "${REAL_ROOT}" "${NEW_ROOT}" && return 0 + + bad_msg "Cannot mount ${REAL_ROOT} with -t auto, giving up" + + return 1 } _get_mounts_list() { diff --git a/defaults/linuxrc b/defaults/linuxrc index d690114..41ab727 100755 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -34,7 +34,6 @@ FAKE_INIT="" REAL_INIT="/sbin/init" FAKE_ROOTFLAGS="" INIT_OPTS="" -ROOTFSTYPE="auto" CRYPT_SILENT=0 QUIET=""