]> git.rmz.io Git - dotfiles.git/commitdiff
bin: archive ssh-gpg script
authorSamir Benmendil <me@rmz.io>
Sun, 24 Nov 2019 14:48:43 +0000 (14:48 +0000)
committerSamir Benmendil <me@rmz.io>
Sun, 24 Nov 2019 14:48:43 +0000 (14:48 +0000)
bin/old/ssh-gpg [new file with mode: 0755]

diff --git a/bin/old/ssh-gpg b/bin/old/ssh-gpg
new file mode 100755 (executable)
index 0000000..736dadc
--- /dev/null
@@ -0,0 +1,8 @@
+#!/usr/bin/env bash
+
+remote_socket="$(ssh "$@" gpgconf --list-dirs agent-socket)"
+local_socket="$(gpgconf --list-dirs agent-extra-socket)"
+[[ ! -S "$local_socket" ]] && local_socket="$(gpgconf --list-dirs agent-socket)"
+[[ ! -S "$local_socket" ]] && gpg-connect-agent /bye
+
+ssh -R"$remote_socket":"$local_socket" "$@"