25 lines
995 B
Fish
25 lines
995 B
Fish
if test "$NEED_WSL_SOCAT" = "1"
|
|
# WSL Socket forwarding
|
|
if begin
|
|
status is-interactive; and string sub (uname -r) WSL >/dev/null
|
|
end
|
|
# Commands to run in interactive sessions can go here
|
|
|
|
# Channel Pageant to WSL2
|
|
set -x SSH_AUTH_SOCK "$HOME/.ssh/agent.sock"
|
|
if not ss -a | grep -q "$SSH_AUTH_SOCK"
|
|
rm -f "$SSH_AUTH_SOCK"
|
|
set wsl2_ssh_pageant_bin "$HOME/.ssh/wsl2-ssh-pageant.exe"
|
|
if test -x "$wsl2_ssh_pageant_bin"
|
|
setsid nohup socat UNIX-LISTEN:"$SSH_AUTH_SOCK,fork" EXEC:"$wsl2_ssh_pageant_bin" >/dev/null 2>&1 &
|
|
else
|
|
echo >&2 "WARNING: $wsl2_ssh_pageant_bin is not executable."
|
|
end
|
|
set --erase wsl2_ssh_pageant_bin
|
|
end
|
|
# machina
|
|
else if not set -q SSH_AUTH_SOCK or string match -q "$HOME/.cache/keyring-*/ssh" $SSH_AUTH_SOCK
|
|
set -gx SSH_AUTH_SOCK {$XDG_RUNTIME_DIR}gnupg/S.gpg-agent.ssh
|
|
end
|
|
end
|