summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2019-03-29 10:50:06 +0100
committerErich Eckner <git@eckner.net>2019-03-29 10:50:06 +0100
commit90ddde59b7eba664afb0019f3c88101c23eb9a45 (patch)
treeeeec80f601f57392f7640ef2bd5cf2b81905a31a
parent8e96fef44711577c097bb212908baa65e89df4a9 (diff)
downloadcryptfs-daemon-90ddde59b7eba664afb0019f3c88101c23eb9a45.tar.xz
cryptfs.bin.in: translate ssh-host to pingable fqdn or whatever
-rw-r--r--cryptfs.bin.in17
1 files changed, 17 insertions, 0 deletions
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