2019-04-27 22:21:33 +00:00
|
|
|
SRC_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
|
2019-12-11 05:53:01 +00:00
|
|
|
CONFIG_SRC := $(SRC_DIR)/config
|
|
|
|
CONFIG_TRGT := ~/.ssh/config
|
2019-06-15 01:49:18 +00:00
|
|
|
JPATRICK_KEY := ~/.ssh/git.jpatrick.io
|
2019-04-27 22:21:33 +00:00
|
|
|
|
|
|
|
include ../lib/shared.mk
|
|
|
|
|
|
|
|
install: | init update
|
|
|
|
|
|
|
|
init:
|
|
|
|
$(info => Setting up ssh)
|
2019-12-11 05:53:01 +00:00
|
|
|
$(mk_link) $(CONFIG_SRC) $(CONFIG_TRGT)
|
|
|
|
$(mk_link) $(SRC_DIR)/public_keys ~/.ssh/public_keys
|
2019-06-15 01:49:18 +00:00
|
|
|
$(MAKE) -C $(SRC_DIR) init_jpatrick_key
|
2019-04-27 22:21:33 +00:00
|
|
|
|
|
|
|
update:
|
2019-12-11 05:53:01 +00:00
|
|
|
cd ~/.ssh \
|
|
|
|
&& mkdir -p public_keys/`hostname` \
|
|
|
|
&& for i in *.pub ; do ; \
|
|
|
|
cp $$i public_keys/`hostname`/$$i ; \
|
|
|
|
done
|
2019-04-27 22:21:33 +00:00
|
|
|
|
|
|
|
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:
|
2019-12-13 02:45:59 +00:00
|
|
|
ifeq ($(shell [ ! -e $(JPATRICK_KEY) ] $(return_val_truthy) ), true)
|
2019-06-15 01:49:18 +00:00
|
|
|
$(report) info "Setting up key for jpatrick.io"
|
|
|
|
ssh-keygen -t ed25519 -C "`hostname`: `date`" -f $(JPATRICK_KEY) -N "" \
|
2019-12-13 02:45:59 +00:00
|
|
|
; $(report) info "jpatrick.io key created"
|
2019-06-15 01:49:18 +00:00
|
|
|
else
|
2019-06-16 22:58:36 +00:00
|
|
|
$(report) warn "Key for jpatrick.io already created"
|
2019-06-15 01:49:18 +00:00
|
|
|
endif
|