diff options
Diffstat (limited to 'mount-crypts')
-rwxr-xr-x | mount-crypts | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/mount-crypts b/mount-crypts index 08b1975..b7ba106 100755 --- a/mount-crypts +++ b/mount-crypts @@ -1,14 +1,16 @@ #!/bin/bash -i=1 maxWait=60 -while [ $i -le $(sed "s/#.*$//" /etc/crypttab | grep -vc '^ *$') ]; do - s="$(sed "s/#.*$//" /etc/crypttab | grep -v '^ *$' | tail -n$i | head -n1 | sed "s/ */ /g")" - i=$((i+1)) - name=$(echo $s | awk '{print $1}') - device=$(echo $s | awk '{print $2}') - key=$(echo $s | awk '{print $3}') +sed 's/#.*$//' /etc/crypttab \ +| grep -v '^ *$' \ +| if [ "x$1" = 'x-u' ]; then + tac +else + cat +fi \ +| while read -r name device key; do + while [ ${maxWait} -gt 0 ] && [ ! -b "${device}" ]; do sleep 1 maxWait=$[${maxWait}-1] |