diff options
Diffstat (limited to 'scripts/local')
| -rw-r--r-- | scripts/local | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/scripts/local b/scripts/local index 4e01472..459ba8d 100644 --- a/scripts/local +++ b/scripts/local @@ -1,5 +1,29 @@ # 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 + if [ -x /lib/udev/vol_id ]; then + FSTYPE=$(/lib/udev/vol_id -t "${FS}" 2> /dev/null) + else + eval $(fstype < "${FS}" 2> /dev/null) + fi + RET=$? + + if [ -z "${FSTYPE}" ]; then + FSTYPE="unknown" + fi + + echo "${FSTYPE}" + return ${RET} +} + # Parameter: Where to mount the filesystem mountroot () { @@ -9,7 +33,7 @@ mountroot () # If the root device hasn't shown up yet, give it a little while # to deal with removable devices - if [ ! -e "${ROOT}" ]; then + if [ ! -e "${ROOT}" ] || ! $(get_fstype "${ROOT}" >/dev/null); then log_begin_msg "Waiting for root file system..." # Default delay is 180s @@ -23,9 +47,11 @@ mountroot () fi slumber=$(( ${slumber} * 10 )) - while [ ${slumber} -gt 0 ] && [ ! -e "${ROOT}" ]; do + while [ ! -e "${ROOT}" ] \ + || ! $(get_fstype "${ROOT}" >/dev/null); do /bin/sleep 0.1 slumber=$(( ${slumber} - 1 )) + [ ${slumber} -gt 0 ] || break done if [ ${slumber} -gt 0 ]; then @@ -47,14 +73,10 @@ mountroot () # Get the root filesystem type if not set if [ -z "${ROOTFSTYPE}" ]; then - eval $(fstype < ${ROOT}) + FSTYPE=$(get_fstype "${ROOT}") else FSTYPE=${ROOTFSTYPE} fi - if [ "$FSTYPE" = "unknown" ] && [ -x /lib/udev/vol_id ]; then - FSTYPE=$(/lib/udev/vol_id -t ${ROOT}) - [ -z "$FSTYPE" ] && FSTYPE="unknown" - fi [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/local-premount" run_scripts /scripts/local-premount |
