recovery init: pass filesystem type to mount command

For block devices we can get the filesystem in the partition using the
'blkid' command.

This cleans up some warnings on mounting:

EXT4-fs (sda2): couldn't mount as ext3 due to feature incompatibilities
EXT4-fs (sda2): couldn't mount as ext2 due to feature incompatibilities
EXT4-fs (mmcblk0p4): couldn't mount as ext3 due to feature incompatibilities
EXT4-fs (mmcblk0p4): couldn't mount as ext2 due to feature incompatibilities

Signed-off-by: Javier Viguera <javier.viguera@digi.com>
This commit is contained in:
Javier Viguera 2017-01-20 17:33:37 +01:00
parent a7a8916018
commit 75f2c00025
1 changed files with 4 additions and 2 deletions

View File

@ -161,7 +161,8 @@ mount_external_disks() {
local dev_name=$(basename "${i}")
local mount_dir="${USB_MOUNT_DIR}/${dev_name}"
mkdir -p "${mount_dir}"
mount "/dev/${dev_name}" "${mount_dir}" 2>/dev/null
FSTYPE="$(blkid /dev/${dev_name} | sed -e 's,.*TYPE="\([^"]\+\)".*,\1,g')"
mount -r ${FSTYPE:+-t ${FSTYPE}} "/dev/${dev_name}" "${mount_dir}"
done
done
}
@ -226,7 +227,8 @@ mount_emmc_block() {
local partition_block="/dev/mmcblk0p$(parted -s /dev/mmcblk0 print | sed -ne "s,^[^0-9]*\([0-9]\+\).*\<${1}\>.*,\1,g;T;p")"
# Mount the volume.
mkdir -p "${2}"
mount -t auto "${partition_block}" "${2}" >/dev/null 2>&1
FSTYPE="$(blkid ${partition_block} | sed -e 's,.*TYPE="\([^"]\+\)".*,\1,g')"
mount -r ${FSTYPE:+-t ${FSTYPE}} "${partition_block}" "${2}"
if [ "$?" != "0" ]; then
log_warning "Could not mount '${1}' partition (${partition_block})"
fi