diff options
author | Thomas Bächler <thomas@archlinux.org> | 2010-02-21 02:01:57 +0100 |
---|---|---|
committer | Thomas Bächler <thomas@archlinux.org> | 2010-02-21 02:01:57 +0100 |
commit | ae65c7cc9577747104d2e7e9563a49f9f850eef9 (patch) | |
tree | a603064707eebff2e92f5d8185985bc2a4cec056 | |
parent | c73baee87913e6e92f0cb82d1f999528b51c7bb7 (diff) | |
download | mkinitcpio-ae65c7cc9577747104d2e7e9563a49f9f850eef9.tar.gz mkinitcpio-ae65c7cc9577747104d2e7e9563a49f9f850eef9.tar.xz |
poll_device: do not wait for a device to appear if udevd is not running
Devices will never "magically" appear when udevd is not running. Thus,
poll_device now exits instantly when a device when udevd is not running.
The return value is unchanged, just the delay is removed.
Assuming that the drive is available just after loading the module is
unsafe. However, "fast" devices like most (all?) pata/sata seem to
work this way for many people. On "slow" devices like USB, we still
have to wait - those will not work without udev.
-rw-r--r-- | init | 3 | ||||
-rw-r--r-- | init_functions | 12 |
2 files changed, 10 insertions, 5 deletions
@@ -23,7 +23,10 @@ if [ -x /sbin/udevd ]; then msg ":: Starting udevd..." echo > /proc/sys/kernel/hotplug /sbin/udevd --daemon --resolve-names=never + export udevd_running=1 msg "done." +else + export udevd_running=0 fi for cmd in ${CMDLINE}; do diff --git a/init_functions b/init_functions index aad406d..c165ff0 100644 --- a/init_functions +++ b/init_functions @@ -14,11 +14,13 @@ poll_device() { else seconds=5 fi - echo "Waiting ${seconds} seconds for device ${device} ..." - while [ ! -b "${device}" -a ! -h "${device}" -a ${seconds} -gt 0 ]; do - sleep 1 - seconds=$((${seconds}-1)) - done + if [ "${udevd_running}" -eq 1 ]; then + echo "Waiting ${seconds} seconds for device ${device} ..." + while [ ! -b "${device}" -a ! -h "${device}" -a ${seconds} -gt 0 ]; do + sleep 1 + seconds=$((${seconds}-1)) + done + fi [ -b "${device}" -o -h "${device}" ] } |