diff options
author | Thomas Bächler <thomas@archlinux.org> | 2011-01-31 22:01:31 +0100 |
---|---|---|
committer | Thomas Bächler <thomas@archlinux.org> | 2011-01-31 22:01:53 +0100 |
commit | 02e263c5bcec23f9134140dcef5b6f5a4412ed2b (patch) | |
tree | f5e89d22ac233383fbc6638ca18b37f004ece5a0 | |
parent | 827f4bf67eafc5a15aaa69cdb465497f4e0f954f (diff) | |
download | mkinitcpio-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>
-rw-r--r-- | hooks/sleep | 8 | ||||
-rw-r--r-- | install/sleep | 3 |
2 files changed, 9 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 } diff --git a/install/sleep b/install/sleep index f7f82bd..a59d0c3 100644 --- a/install/sleep +++ b/install/sleep @@ -15,5 +15,8 @@ cat <<HELPEOF for a fixed time interval. The time in seconds can be specified in the sleeptime= command line parameter. The default is 5 seconds. + If a sleepdevice= parameter is specified, sleep + until the given device node is available, polling + at one second intervals until sleeptime is reached. HELPEOF } |