diff options
Diffstat (limited to 'init_functions')
-rw-r--r-- | init_functions | 15 |
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}" ] +} |