diff options
author | Toby Vincent <tobyv13@gmail.com> | 2022-07-25 17:42:45 -0500 |
---|---|---|
committer | Toby Vincent <tobyv13@gmail.com> | 2022-07-26 16:24:07 -0500 |
commit | d612ad9bfd8641142161d26a65300a658123dcb2 (patch) | |
tree | 2ca32d121f7ea7489c978460f3a967c3c9d6012c /wsl/.local/share/zsh-wsl | |
parent | e26e4fd020339d11ef74279f2df8cbc1d205258b (diff) |
refactor(wsl): move gpg-init to a standalone script
Diffstat (limited to 'wsl/.local/share/zsh-wsl')
-rw-r--r-- | wsl/.local/share/zsh-wsl/zsh-wsl.plugin.zsh | 35 |
1 files changed, 3 insertions, 32 deletions
diff --git a/wsl/.local/share/zsh-wsl/zsh-wsl.plugin.zsh b/wsl/.local/share/zsh-wsl/zsh-wsl.plugin.zsh index 874884f..c65e64b 100644 --- a/wsl/.local/share/zsh-wsl/zsh-wsl.plugin.zsh +++ b/wsl/.local/share/zsh-wsl/zsh-wsl.plugin.zsh @@ -58,34 +58,7 @@ wsl_cmd_proxy() { winget() { wsl_cmd_proxy "winget.exe" "$@"; } scoop() { wsl_cmd_proxy "scoop" "$@"; } alacritty() { wsl_cmd_proxy "alacritty.exe" "$@"; } -# pwsh() { alacritty --working-directory "c:\\Users\\${USER}" -e "pwsh.exe $@"; } - -gpg_init() ( - wsl2_ssh_pageant_bin="$HOME/.ssh/wsl2-ssh-pageant.exe" - config_path="C\:/Users/$USER/AppData/Local/gnupg" - - if ! test -x "$wsl2_ssh_pageant_bin"; then - echo >&2 "WARNING: $wsl2_ssh_pageant_bin is not executable." - else - gpg-connect-agent.exe /bye >/dev/null 2>&1 - - if ! ss -a | grep -q "$SSH_AUTH_SOCK"; then - rm -f "$SSH_AUTH_SOCK" - (setsid nohup socat UNIX-LISTEN:"$SSH_AUTH_SOCK,fork" EXEC:"$wsl2_ssh_pageant_bin --gpgConfigBasepath ${config_path}" >/dev/null 2>&1 &) - fi - - if ! ss -a | grep -q "$GPG_AGENT_SOCK"; then - rm -rf "$GPG_AGENT_SOCK" - (setsid nohup socat UNIX-LISTEN:"$GPG_AGENT_SOCK,fork" EXEC:"$wsl2_ssh_pageant_bin -gpgConfigBasepath ${config_path} -gpg S.gpg-agent" >/dev/null 2>&1 &) - fi - - if ! ss -a | grep -q "${GPG_AGENT_SOCK}.extra"; then - rm -rf "${GPG_AGENT_SOCK}.extra" - (setsid nohup socat UNIX-LISTEN:"${GPG_AGENT_SOCK}.extra,fork" EXEC:"$wsl2_ssh_pageant_bin -gpgConfigBasepath ${config_path} -gpg S.gpg-agent.extra" >/dev/null 2>&1 &) - fi - fi - unset wsl2_ssh_pageant_bin -) +pwsh() { alacritty --working-directory "c:\\Users\\${USER}" -e "pwsh.exe $@"; } # Reload gpg_reset() { @@ -95,7 +68,7 @@ gpg_reset() { rm -rfv "$GPG_AGENT_SOCK.extra" pkill -f 'socat.*wsl2-ssh-pageant.exe' gpg-connect-agent.exe /bye >/dev/null 2>&1 - gpg_init + gpg-init.sh } # Relearn card serial number @@ -103,6 +76,4 @@ gpg_learn() { gpg-connect-agent.exe "scd serialno" "learn --force" /bye } -gpg_init - -unset -f _start-pageant +gpg-init.sh |