diff options
| author | David Härdeman <david@hardeman.nu> | 2007-05-27 00:29:27 +0200 |
|---|---|---|
| committer | maximilian attems <maks@debian.org> | 2007-05-27 00:29:27 +0200 |
| commit | 525008f4da3ddc32c83329dbb6322ae1660b8fc8 (patch) | |
| tree | 0b0c15898e39855fc6c7c31cb4a8a4b7ec2d90f9 | |
| parent | f123993d1c73c906c50bcb8484e8abb5f9dd44f1 (diff) | |
| download | initramfs-tools-525008f4da3ddc32c83329dbb6322ae1660b8fc8.tar.gz initramfs-tools-525008f4da3ddc32c83329dbb6322ae1660b8fc8.zip | |
scripts/local: check for fs on rootnode
some device node will exist before they can be safely used
| -rw-r--r-- | debian/changelog | 10 | ||||
| -rw-r--r-- | scripts/local | 36 |
2 files changed, 37 insertions, 9 deletions
diff --git a/debian/changelog b/debian/changelog index 032fa85..042cf8d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -16,8 +16,14 @@ initramfs-tools (0.88) UNRELEASED; urgency=low * hook-functions: Document how copy_exec determines the target path. * hook-functions: Add firmware loading support to manual_add_modules(). (closes: #355881) - - -- maximilian attems <maks@debian.org> Thu, 03 May 2007 18:43:14 +0200 + * scripts/local: Ubuntu merge + - As well as waiting for the existance of the root device node, also check + to see whether we have a filesystem of some kind on it. Some devices + nodes (devmapper/LVM/EVMS, mdadm) will exist before they can be safely + used. Patch by Scott James Remnant <scott@ubuntu.com>. Changed to + support both fstype and vol_id. + + -- maximilian attems <maks@debian.org> Sun, 27 May 2007 00:26:17 +0200 initramfs-tools (0.87b) unstable; urgency=low 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 |
