diff options
author | rleigh@debian.org <rleigh@debian.org> | 2013-05-08 20:01:51 +0100 |
---|---|---|
committer | Michael Prokop <mika@debian.org> | 2014-09-25 08:40:00 +0200 |
commit | 7c5e242787f472b412ee51dfb9b2fe7020cc5e34 (patch) | |
tree | 386e5dd79a3a6bbd9d8a37b8e24bb13428edb6c8 /scripts/local | |
parent | 903325424eb9895cf98af637b1a3164c7a88df30 (diff) |
local: Generalise local device setup
Diffstat (limited to 'scripts/local')
-rw-r--r-- | scripts/local | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/scripts/local b/scripts/local index 0c61ca3..da80d06 100644 --- a/scripts/local +++ b/scripts/local @@ -31,7 +31,9 @@ local_bottom() local_top_used=no } -pre_mountroot() +# $1=device to mount +# $2=optionname (for root and etc) +local_device_setup() { wait_for_udev 10 @@ -44,21 +46,21 @@ pre_mountroot() # Don't wait for a root device that doesn't have a corresponding # device in /dev (ie, mtd0) - if [ "${ROOT#/dev}" = "${ROOT}" ]; then + if [ "${1#/dev}" = "$1" ]; then return fi # If the root device hasn't shown up yet, give it a little while # to deal with removable devices - if [ ! -e "${ROOT}" ] || ! $(get_fstype "${ROOT}" >/dev/null); then - log_begin_msg "Waiting for root file system" + if [ ! -e "$1" ] || ! $(get_fstype "$1" >/dev/null); then + log_begin_msg "Waiting for $2 file system" # Default delay is 30s slumber=${ROOTDELAY:-30} slumber=$(( ${slumber} * 10 )) - while [ ! -e "${ROOT}" ] \ - || ! $(get_fstype "${ROOT}" >/dev/null); do + while [ ! -e "$1" ] \ + || ! $(get_fstype "$1" >/dev/null); do /bin/sleep 0.1 slumber=$(( ${slumber} - 1 )) [ ${slumber} -gt 0 ] || break @@ -72,40 +74,42 @@ pre_mountroot() fi # We've given up, but we'll let the user fix matters if they can - while [ ! -e "${ROOT}" ]; do + while [ ! -e "$1" ]; do # give hint about renamed root - case "${ROOT}" in + case "$1" in /dev/hd*) - suffix="${ROOT#/dev/hd}" + suffix="${1#/dev/hd}" major="${suffix%[[:digit:]]}" major="${major%[[:digit:]]}" if [ -d "/sys/block/sd${major}" ]; then - echo "WARNING bootdevice may be renamed. Try root=/dev/sd${suffix}" + echo "WARNING bootdevice may be renamed. Try $2=/dev/sd${suffix}" fi ;; /dev/sd*) - suffix="${ROOT#/dev/sd}" + suffix="${1#/dev/sd}" major="${suffix%[[:digit:]]}" major="${major%[[:digit:]]}" if [ -d "/sys/block/hd${major}" ]; then - echo "WARNING bootdevice may be renamed. Try root=/dev/hd${suffix}" + echo "WARNING bootdevice may be renamed. Try $2=/dev/hd${suffix}" fi ;; esac - echo "Gave up waiting for root device. Common problems:" + echo "Gave up waiting for $2 device. Common problems:" echo " - Boot args (cat /proc/cmdline)" echo " - Check rootdelay= (did the system wait long enough?)" - echo " - Check root= (did the system wait for the right device?)" + # Only applies to root= and etc=: + if [ "${2#/}" = "$2" ]; then + echo " - Check $2= (did the system wait for the right device?)" + fi echo " - Missing modules (cat /proc/modules; ls /dev)" - panic "ALERT! ${ROOT} does not exist. Dropping to a shell!" + panic "ALERT! $1 does not exist. Dropping to a shell!" done } local_mount_root() { local_top - - pre_mountroot + local_device_setup "${ROOT}" root # Get the root filesystem type if not set if [ -z "${ROOTFSTYPE}" ]; then @@ -114,7 +118,7 @@ local_mount_root() FSTYPE=${ROOTFSTYPE} fi - local_premount + local_premount if [ "${readonly}" = "y" ]; then roflag=-r @@ -132,10 +136,6 @@ local_mount_root() else mount ${roflag} ${ROOTFLAGS} ${ROOT} ${rootmnt} fi - - [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/local-bottom" - run_scripts /scripts/local-bottom - [ "$quiet" != "y" ] && log_end_msg } local_mount_fs() |