blob: c65e64b2575460360a218c21c4b4d64c558c3ffc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
#!/bin/sh
# shellcheck disable=2155
# [ -n "${WSL_DISTRO_NAME+1}" ] || return 0
WINHOME="/mnt/c/Users/$USER"
# shellcheck disable=2164
[ "$PWD" = "$WINHOME" ] && cd
mkdir -p /tmp/xdg
export DISPLAY="$(grep -m 1 nameserver /etc/resolv.conf | awk '{print $2}')":0
export BROWSER=wslview
export XDG_RUNTIME_DIR=/tmp/xdg
export GPG_AGENT_SOCK="$HOME/.gnupg/S.gpg-agent"
export SSH_AUTH_SOCK="$HOME/.ssh/agent.sock"
export GPG_TTY="$(tty)"
alias wsl=wsl.exe
alias ykman='/mnt/c/Program\ Files/Yubico/YubiKey\ Manager/ykman.exe'
alias pip2="DISPLAY= pip2"
alias pip3="DISPLAY= pip3"
alias pip3.7="DISPLAY= pip3.7"
alias pip3.10="DISPLAY= pip3.10"
alias pip="DISPLAY= pip3"
wt() {
powershell.exe -NoProfile -c "wt $*"
}
wsl_cmd_proxy() {
exe="$1"
shift # past exe
cmd=" ${1}"
shift # past cmd
args=""
while [ $# -gt 0 ]; do
case "$1" in
-*)
args="$args${1} '${2}' "
shift
shift
;;
*)
args="$args'${1}'"
shift
;;
esac
args="$args "
done
# shellcheck disable=2016
powershell.exe -NoProfile -c 'cd $HOME;' "$exe" "$cmd" "$args"
}
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 $@"; }
# Reload
gpg_reset() {
gpg-connect-agent.exe KILLAGENT /bye >/dev/null 2>&1
rm -rfv "$GPG_AGENT_SOCK"
rm -rfv "$GPG_AGENT_SOCK.extra"
pkill -f 'socat.*wsl2-ssh-pageant.exe'
gpg-connect-agent.exe /bye >/dev/null 2>&1
gpg-init.sh
}
# Relearn card serial number
gpg_learn() {
gpg-connect-agent.exe "scd serialno" "learn --force" /bye
}
gpg-init.sh
|