diff options
author | Erich Eckner <git@eckner.net> | 2020-01-03 14:03:35 +0100 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2020-01-03 14:03:35 +0100 |
commit | f9bd26d1592ccfbf57adb47d6a22cbafb343e3a3 (patch) | |
tree | 10c4ad36ac3f448278cfbf1dc1512a45f0fd56c0 | |
parent | 1ad8a39de9ba2999e465a408011370dcd811dbb8 (diff) | |
download | mount-crypts-f9bd26d1592ccfbf57adb47d6a22cbafb343e3a3.tar.xz |
mount-crypts: use sh more thoroughly
-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] |