summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2019-03-29 11:52:37 +0100
committerErich Eckner <git@eckner.net>2019-03-29 11:52:37 +0100
commitb687946d96ce942fb2cc2745ee6d4a089af4eb98 (patch)
treef0559345f652ea1754ddde53765659339920bfb4
parent058bd5bd5ad282d23817ecf8b340c45a8230029e (diff)
downloadhardlinkedBackups-b687946d96ce942fb2cc2745ee6d4a089af4eb98.tar.xz
backup.in: honor ipv4/6 preference set in .ssh/config
-rwxr-xr-xbackup.in17
1 files changed, 16 insertions, 1 deletions
diff --git a/backup.in b/backup.in
index eeafcdd..e8caa03 100755
--- a/backup.in
+++ b/backup.in
@@ -52,7 +52,22 @@ extract_ssh_ip_protocols() {
t
d
' \
- | sort -u
+ | sort -u \
+ | if [ -f ~/.ssh/config ]; then
+ grep -vxF "$(
+ sed '
+ /^Host\s\+'"$1"'$/,/^Host\s/ {
+ s/^\s*AddressFamily\s\+inet\s*$/6/
+ t
+ s/^\s*AddressFamily\s\+inet6\s*$/4/
+ t
+ }
+ d
+ ' ~/.ssh/config
+ )"
+ else
+ cat
+ fi
}
if [ $# -eq 1 ]; then