From c27d3ac25d5c4eb275aeb24ee9f7e48792117fab Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Sun, 18 Aug 2013 13:32:10 +0200 Subject: [PATCH] initrd.scripts: add get_device_fstype This fuction prints the device file system type to standard output and will be used in future for executing fstype specific tasks. --- defaults/initrd.scripts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index a21f52b..3007fbc 100644 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -501,6 +501,17 @@ find_real_device() { echo -n "${DEVICE}" } +get_device_fstype() { + local device=$(find_real_device "${1}") + if [ -n "${device}" ]; then + blkid -o value -s TYPE "${device}" + return ${?} # readability + else + echo "Cannot resolve device: ${1}" >&2 + return 1 + fi +} + check_loop() { if [ "${LOOP}" = '' -o ! -e "${CDROOT_PATH}/${LOOP}" ] then