Last active
March 20, 2022 00:29
-
-
Save lucyllewy/67ad8423472cc25bad89b7441d35cef3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function is_wsl() { | |
[ -n "$WSL_DISTRO_NAME" ] && return 0 || return 1 | |
} | |
if is_wsl; then | |
##### | |
## Autorun for the gpg-relay bridge | |
## | |
SOCAT_PID_FILE=$HOME/.gnupg/socat-gpg.pid | |
SOCAT_PID_FILE2=$HOME/.gnupg/socat-gpg.pid.2 | |
for sock in "$HOME/.gnupg/S.gpg-agent" "/run/user/$UID/gnupg/S.gpg-agent"; do | |
ss -a | grep -q $sock | |
if [ $? -ne 0 ]; then | |
rm -f "$sock" | |
mkdir -p "$(dirname "$sock")" | |
( setsid socat UNIX-LISTEN:"$sock,fork" EXEC:'/mnt/c/Users/yabea/bin/npiperelay.exe -ei -ep -s -a "C:/Users/yabea/AppData/Roaming/gnupg/S.gpg-agent"',nofork </dev/null) & | |
fi | |
done | |
export SSH_AUTH_SOCK=$HOME/.ssh/agent.sock | |
ss -a | grep -q $SSH_AUTH_SOCK | |
if [ $? -ne 0 ]; then | |
rm -f $SSH_AUTH_SOCK | |
( setsid socat UNIX-LISTEN:$SSH_AUTH_SOCK,fork EXEC:"/mnt/c/Users/yabea/bin/npiperelay.exe -ei -s //./pipe/openssh-ssh-agent",nofork >/dev/null 2>/dev/null &) | |
fi | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment