dotfiles/ssh/makefile

30 lines
756 B
Makefile
Raw Normal View History

SRC_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
SOURCE := $(SRC_DIR)/config
TARGET := ~/.ssh/config
2019-06-15 01:49:18 +00:00
JPATRICK_KEY := ~/.ssh/git.jpatrick.io
include ../lib/shared.mk
install: | init update
init:
$(info => Setting up ssh)
$(mk_link) $(SOURCE) $(TARGET)
2019-06-15 01:49:18 +00:00
$(MAKE) -C $(SRC_DIR) init_jpatrick_key
update:
remove:
$(info => Remvoing ssh)
$(rm_link) $(TARGET)
$(report) warn "NOTE: All prior keys still remain."
2019-06-15 01:49:18 +00:00
init_jpatrick_key:
ifeq ($(shell [ ! -e $(JPATRIC_KEY) ] $(return_val_truthy) ), true)
$(report) info "Setting up key for jpatrick.io"
ssh-keygen -t ed25519 -C "`hostname`: `date`" -f $(JPATRICK_KEY) -N "" \
; report info "jpatrick.io key created"
else
$(report) info "Key for jpatrick.io already created"
endif