SRC_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
SOURCE :=  $(SRC_DIR)/config
TARGET :=  ~/.ssh/config

include ../lib/shared.mk

install: | init update

init:
	$(info => Setting up ssh)
	$(mk_link) $(SOURCE) $(TARGET)
	[ ! -e ~/.ssh/git.jpatrick.io ] \
    && echo "No key for git.jpatrick.io. Generating" \
    && ( ssh-keygen -t ed25519 -C "`hostname`: `date`" -f ~/.ssh/git.jpatrick.io  -N "" \
      ; $(report) "Key generation" )  \
    ; true

update:

remove:
	$(info => Remvoing ssh)
	$(rm_link) $(TARGET)
	$(report) warn "NOTE: All prior keys still remain."