diff options
author | Toby Vincent <tobyv13@gmail.com> | 2021-05-11 13:49:01 -0500 |
---|---|---|
committer | Toby Vincent <tobyv13@gmail.com> | 2021-05-11 13:49:01 -0500 |
commit | 472a90047abbaeec80f4c332304017769ab31699 (patch) | |
tree | d42ff6141c47647bbc0c795bd321f6601502a2fc /zsh/wsl.zsh | |
parent | b9de0b04f56d7f54ced14231db0599d5adc2bef6 (diff) |
refactor: moved posix stuff to shell sourced from zsh
Diffstat (limited to 'zsh/wsl.zsh')
-rw-r--r-- | zsh/wsl.zsh | 79 |
1 files changed, 3 insertions, 76 deletions
diff --git a/zsh/wsl.zsh b/zsh/wsl.zsh index 4ef0400..37bb447 100644 --- a/zsh/wsl.zsh +++ b/zsh/wsl.zsh @@ -1,34 +1,7 @@ -path=( $path $HOME/.local/bin $HOME/.dotnet/tools ) -hash -d w=/mnt/c/Users/$USER - -alias cb=clip.exe -alias wsl=wsl.exe -alias ykman="/mnt/c/Program\ Files/Yubico/YubiKey\ Manager/ykman.exe" - -function wt() { powershell.exe -NoProfile -c "wt $@" } +source "${DOTFILES:-"${HOME}/dotfiles"}/shell/wsl.sh" +source "${DOTFILES:-"${HOME}/dotfiles"}/shell/gpg.sh" -function winget() { - cmd="winget.exe $1" - shift # past cmd - - while [[ $# -gt 0 ]] - do - key="$1" - case $key in - -*) # key value pair - cmd+=" $key '$2'" - shift # past argument - shift # past value - ;; - *) # positional argument - cmd+=" '$1'" # add it to the list - shift # past argument - ;; - esac - done - - powershell.exe -NoProfile -c "$cmd" -} +hash -d w=/mnt/c/Users/$USER function r-copy() { if ((REGION_ACTIVE)) then @@ -47,49 +20,3 @@ function r-cut() { fi (( ${+aliases[cb]} )) && printf "$CUTBUFFER" | cb } - -# https://github.com/benpye/wsl-ssh-pageant -# https://github.com/drduh/YubiKey-Guide#remote-host-configuration -# https://dev.to/dzerycz/series/11353 - -export GPG_TTY=$(tty) - -# SSH Socket -# Removing Linux SSH socket and replacing it by link to wsl2-ssh-pageant socket -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 nohup socat UNIX-LISTEN:$SSH_AUTH_SOCK,fork EXEC:"$ZSH_BASE/ssh/wsl2-ssh-pageant.exe" &>/dev/null &) -fi -# GPG Socket -# Removing Linux GPG Agent socket and replacing it by link to wsl2-ssh-pageant GPG socket -export GPG_AGENT_SOCK=$HOME/.gnupg/S.gpg-agent -ss -a | grep -q $GPG_AGENT_SOCK -if [ $? -ne 0 ]; then - rm -rf $GPG_AGENT_SOCK - (setsid nohup socat UNIX-LISTEN:$GPG_AGENT_SOCK,fork EXEC:"$ZSH_BASE/ssh/wsl2-ssh-pageant.exe --gpg S.gpg-agent" &>/dev/null &) -fi - -# GPG Socket -# Removing Linux GPG Agent extra socket and replacing it by link to wsl2-ssh-pageant GPG socket -export GPG_EXTRA_SOCK=$HOME/.gnupg/S.gpg-agent.extra -ss -a | grep -q $GPG_EXTRA_SOCK -if [ $? -ne 0 ]; then - rm -rf $GPG_EXTRA_SOCK - (setsid nohup socat UNIX-LISTEN:$GPG_EXTRA_SOCK,fork EXEC:"$ZSH_BASE/ssh/wsl2-ssh-pageant.exe --gpg S.gpg-agent.extra" &>/dev/null &) -fi - -alias gpgrst=gpg-reset -# Reload -function gpg-reset() { - gpg-connect-agent.exe KILLAGENT /bye &>/dev/null - [ -e $GPG_AGENT_SOCK ] && rm $GPG_AGENT_SOCK - [ -e $GPG_EXTRA_SOCK ] && rm $GPG_EXTRA_SOCK - [ -e $SSH_AUTH_SOCK ] && rm $SSH_AUTH_SOCK - pkill -f 'socat.*wsl2-ssh-pageant.exe' - gpg-connect-agent.exe /bye &>/dev/null - (setsid nohup socat UNIX-LISTEN:$SSH_AUTH_SOCK,fork EXEC:"$ZSH_BASE/ssh/wsl2-ssh-pageant.exe" &>/dev/null &) - (setsid nohup socat UNIX-LISTEN:$GPG_AGENT_SOCK,fork EXEC:"$ZSH_BASE/ssh/wsl2-ssh-pageant.exe --gpg S.gpg-agent" &>/dev/null &) - (setsid nohup socat UNIX-LISTEN:$GPG_EXTRA_SOCK,fork EXEC:"$ZSH_BASE/ssh/wsl2-ssh-pageant.exe --gpg S.gpg-agent.extra" &>/dev/null &) -}
\ No newline at end of file |