From f8443fd23c308e64d813d35966169cd0cff82755 Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Fri, 5 Mar 2010 22:42:30 -0300 Subject: [PATCH 7/7] Add another device test if become ready Signed-off-by: Gerardo Exequiel Pozzi --- archiso/hooks/archiso | 26 ++++++++++++++++++++++++-- 1 files changed, 24 insertions(+), 2 deletions(-) diff --git a/archiso/hooks/archiso b/archiso/hooks/archiso index 73f4df9..bd13d7e 100644 --- a/archiso/hooks/archiso +++ b/archiso/hooks/archiso @@ -41,6 +41,28 @@ _mnt_squashfs() { fi } +_get_fstype() { + blkid -o value -s TYPE ${1} 2> /dev/null +} + +_poll_device_fs() { + device="$1" + if [ "$2" -ge 0 ]; then + seconds="$2" + else + seconds=5 + fi + + if [ "${udevd_running}" -eq 1 ]; then + echo "Waiting ${seconds} seconds for device filesystem ${device} ..." + while [ ! -n "$(_get_fstype ${device})" ] && [ "${seconds}" -gt 0 ]; do + sleep 1 + seconds=$((${seconds}-1)) + done + fi + [ -n "$(_get_fstype ${device})" ] +} + run_hook () { if [ "x${arch}" = "x" ]; then arch="$(uname -m)" @@ -82,8 +104,8 @@ archiso_mount_handler() { fi msg ":: Waiting for boot device..." - while ! poll_device ${archisodevice} 30; do - echo "ERROR: boot device didn't show up after 30 seconds..." + while ! poll_device ${archisodevice} 30 || ! _poll_device_fs ${archisodevice} 30; do + echo "ERROR: boot device didn't show up after 60 seconds..." echo " Falling back to interactive prompt" echo " You can try to fix the problem manually, log out when you are finished" launch_interactive_shell -- 1.7.0.1