-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
32 lines (27 loc) · 1.1 KB
/
Makefile
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
NPIPERELAY=$(shell which npiperelay.exe)
UID=$(shell id -u)
USERPROFILE_WIN=$(shell cd /mnt/c && cmd.exe /c echo %USERPROFILE%)
USERPROFILE=$(shell wslpath -au "$(USERPROFILE_WIN)")
all: activate
check-npipe:
@if [ -z "$(NPIPERELAY)" ]; then \
echo "ERROR: Could not find npiperelay.exe" ;\
exit 1 ;\
fi
install: check-npipe
mkdir -p $(HOME)/.config/systemd/user
sed -e "s/%UID%/$(UID)/" ssh-auth.socket > $(HOME)/.config/systemd/user/ssh-auth.socket
sed -e "s!%NPIPERELAY%!$(NPIPERELAY)!" [email protected] > $(HOME)/.config/systemd/user/[email protected]
mkdir -p $(HOME)/.local/sbin
sed -e "s!%NPIPERELAY%!$(NPIPERELAY)!" -e "s!%USERPROFILE%!$(USERPROFILE)!" ssh-auth-relay.sh > $(HOME)/.local/sbin/ssh-auth-relay
chmod +x $(HOME)/.local/sbin/ssh-auth-relay
if ! grep -q ssh-auth-socket $(HOME)/.bashrc; then \
sed -e "s/%UID%/$(UID)/" ssh-auth.bashrc >> $(HOME)/.bashrc; \
fi
activate: install
systemctl --user daemon-reload
systemctl --user enable ssh-auth.socket
systemctl --user start ssh-auth.socket
@echo
@echo "Start a new shell to set SSH_AUTH_SOCK to enable ssh-agent connection"
@echo