diff options
author | maximilian attems <maks@debian.org> | 2010-04-04 05:30:31 +0200 |
---|---|---|
committer | maximilian attems <maks@debian.org> | 2010-04-04 05:31:49 +0200 |
commit | 9d6567169ea95ffad8a3c9a95218851821d147b8 (patch) | |
tree | 71f0bafdfb225060c5440c9b313d1a22389382b5 | |
parent | 7ea605d62c6fca441a40820a573a2e0ef704f183 (diff) | |
download | initramfs-tools-9d6567169ea95ffad8a3c9a95218851821d147b8.tar.gz initramfs-tools-9d6567169ea95ffad8a3c9a95218851821d147b8.zip |
scripts/functions: add get_fstype() from scripts/local
allows wider usage.
(closes: #487409)
Reported-by: Christoph Anton Mitterer <calestyo@scientia.net>
Signed-off-by: maximilian attems <maks@debian.org>
-rw-r--r-- | scripts/functions | 26 | ||||
-rw-r--r-- | scripts/local | 26 |
2 files changed, 26 insertions, 26 deletions
diff --git a/scripts/functions b/scripts/functions index 0ecb1d6..9b864ae 100644 --- a/scripts/functions +++ b/scripts/functions @@ -256,6 +256,32 @@ parse_numeric() { ROOT=/dev/root } +# Parameter: device node to check +# Echos fstype to stdout +# Return value: indicates if an fs could be recognized +get_fstype () +{ + local FS FSTYPE FSSIZE RET + FS="${1}" + + # vol_id has a more complete list of file systems, + # but fstype is more robust + eval $(fstype "${FS}" 2> /dev/null) + if [ "$FSTYPE" = "unknown" ] && command -v blkid >/dev/null 2>&1 ; then + FSTYPE=$(blkid -o value -s TYPE "${FS}") + elif [ "$FSTYPE" = "unknown" ] && [ -x /lib/udev/vol_id ]; then + FSTYPE=$(/lib/udev/vol_id -t "${FS}" 2> /dev/null) + fi + RET=$? + + if [ -z "${FSTYPE}" ]; then + FSTYPE="unknown" + fi + + echo "${FSTYPE}" + return ${RET} +} + configure_networking() { if [ -n "${BOOTIF}" ]; then diff --git a/scripts/local b/scripts/local index 1474073..cca5e8d 100644 --- a/scripts/local +++ b/scripts/local @@ -1,31 +1,5 @@ # Local filesystem mounting -*- shell-script -*- -# Parameter: device node to check -# Echos fstype to stdout -# Return value: indicates if an fs could be recognized -get_fstype () -{ - local FS FSTYPE FSSIZE RET - FS="${1}" - - # vol_id has a more complete list of file systems, - # but fstype is more robust - eval $(fstype "${FS}" 2> /dev/null) - if [ "$FSTYPE" = "unknown" ] && command -v blkid >/dev/null 2>&1 ; then - FSTYPE=$(blkid -o value -s TYPE "${FS}") - elif [ "$FSTYPE" = "unknown" ] && [ -x /lib/udev/vol_id ]; then - FSTYPE=$(/lib/udev/vol_id -t "${FS}" 2> /dev/null) - fi - RET=$? - - if [ -z "${FSTYPE}" ]; then - FSTYPE="unknown" - fi - - echo "${FSTYPE}" - return ${RET} -} - pre_mountroot() { [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/local-top" |