summaryrefslogtreecommitdiffstats
path: root/init_functions
diff options
context:
space:
mode:
authorThomas Bächler <thomas@archlinux.org>2009-06-06 22:50:53 +0200
committerThomas Bächler <thomas@archlinux.org>2009-06-06 22:50:53 +0200
commit13825315ff94fd35c8cd604eeecf125ebd76e8b0 (patch)
tree002abfa13581b7f95deefebc1bc3326d9d5c447f /init_functions
parent7a4bc6aaf49eb55df3e19fb09260ac97023bc901 (diff)
downloadmkinitcpio-13825315ff94fd35c8cd604eeecf125ebd76e8b0.tar.gz
mkinitcpio-13825315ff94fd35c8cd604eeecf125ebd76e8b0.tar.xz
Add common poll_device function
Diffstat (limited to 'init_functions')
-rw-r--r--init_functions15
1 files changed, 15 insertions, 0 deletions
diff --git a/init_functions b/init_functions
index 50accc9..cdc7a9f 100644
--- a/init_functions
+++ b/init_functions
@@ -6,3 +6,18 @@ msg () {
err () {
echo "ERROR: $@"
}
+
+poll_device() {
+ device="$1"
+ if [ "$2" -gt 0 ]; then
+ seconds="$2"
+ else
+ seconds=5
+ fi
+ echo "Waiting ${seconds} seconds for device ${device} ..."
+ while [ ! -b "${device}" -a ${seconds} -gt 0 ]; do
+ sleep 1
+ seconds=$((${seconds}-1))
+ done
+ [ -b "${device}" ]
+}