From 90ddde59b7eba664afb0019f3c88101c23eb9a45 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Fri, 29 Mar 2019 10:50:06 +0100 Subject: cryptfs.bin.in: translate ssh-host to pingable fqdn or whatever --- cryptfs.bin.in | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/cryptfs.bin.in b/cryptfs.bin.in index fd172cd..a7a6ee1 100644 --- a/cryptfs.bin.in +++ b/cryptfs.bin.in @@ -14,6 +14,22 @@ else exit 1 fi +extract_ssh_host() { + { + printf '%s\n' "$1" + if [ -f ~/.ssh/config ]; then + sed ' + /^Host\s\+'"$1"'$/,/^Host\s/ { + s/^\s*Hostname\s\+// + t + } + d + ' ~/.ssh/config + fi + } \ + | tail -n1 +} + give_all_parent_dirs() { local odir local dir @@ -185,6 +201,7 @@ do_mount() { mount_details dev "$1" | \ sed 's>^\([^:@]*@\)\?\([^:@]\+\):\S*$>\2>' ) + host=$(extract_ssh_host "${host}") while [ $(date +%s) -lt ${max_wait} ] && \ ! #PING6# -c1 "${host}" >/dev/null 2>&1 && \ ! ping -c1 "${host}" >/dev/null 2>&1; do -- cgit v1.2.3