From 02e263c5bcec23f9134140dcef5b6f5a4412ed2b Mon Sep 17 00:00:00 2001 From: Thomas Bächler Date: Mon, 31 Jan 2011 22:01:31 +0100 Subject: 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 --- hooks/sleep | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'hooks') 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 } -- cgit v1.2.3-24-g4f1b