summaryrefslogtreecommitdiffstats
path: root/hooks/sleep
diff options
context:
space:
mode:
authorThomas Bächler <thomas@archlinux.org>2011-01-31 22:01:31 +0100
committerThomas Bächler <thomas@archlinux.org>2011-01-31 22:01:53 +0100
commit02e263c5bcec23f9134140dcef5b6f5a4412ed2b (patch)
treef5e89d22ac233383fbc6638ca18b37f004ece5a0 /hooks/sleep
parent827f4bf67eafc5a15aaa69cdb465497f4e0f954f (diff)
downloadmkinitcpio-02e263c5bcec23f9134140dcef5b6f5a4412ed2b.tar.gz
mkinitcpio-02e263c5bcec23f9134140dcef5b6f5a4412ed2b.tar.xz
Enhance sleep hook to watch for device availability
Add a sleepdevice= parameter that will watch for the specified device to appear and then move on. This is more flexible than a defined sleep period and prevents needless waiting if the device appears sooner. Original patch by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'hooks/sleep')
-rw-r--r--hooks/sleep8
1 files changed, 6 insertions, 2 deletions
diff --git a/hooks/sleep b/hooks/sleep
index bade71a..50f3db3 100644
--- a/hooks/sleep
+++ b/hooks/sleep
@@ -4,6 +4,10 @@ run_hook ()
if [ -z "${sleeptime}" ] || ! [ "${sleeptime}" -gt 0 ]; then
sleeptime=5
fi
- msg "Sleeping for ${sleeptime} seconds."
- sleep ${sleeptime}
+ if [ -n "${sleepdevice}" ]; then
+ poll_device "${sleepdevice}" ${sleeptime}
+ else
+ msg "Sleeping for ${sleeptime} seconds."
+ sleep ${sleeptime}
+ fi
}