Refactor makefile for ssh.
This commit is contained in:
parent
de228e5011
commit
3fac31bddb
16
ssh/makefile
16
ssh/makefile
|
@ -1,6 +1,7 @@
|
||||||
SRC_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
|
SRC_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
|
||||||
SOURCE := $(SRC_DIR)/config
|
SOURCE := $(SRC_DIR)/config
|
||||||
TARGET := ~/.ssh/config
|
TARGET := ~/.ssh/config
|
||||||
|
JPATRICK_KEY := ~/.ssh/git.jpatrick.io
|
||||||
|
|
||||||
include ../lib/shared.mk
|
include ../lib/shared.mk
|
||||||
|
|
||||||
|
@ -9,11 +10,7 @@ install: | init update
|
||||||
init:
|
init:
|
||||||
$(info => Setting up ssh)
|
$(info => Setting up ssh)
|
||||||
$(mk_link) $(SOURCE) $(TARGET)
|
$(mk_link) $(SOURCE) $(TARGET)
|
||||||
[ ! -e ~/.ssh/git.jpatrick.io ] \
|
$(MAKE) -C $(SRC_DIR) init_jpatrick_key
|
||||||
&& 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:
|
update:
|
||||||
|
|
||||||
|
@ -21,3 +18,12 @@ remove:
|
||||||
$(info => Remvoing ssh)
|
$(info => Remvoing ssh)
|
||||||
$(rm_link) $(TARGET)
|
$(rm_link) $(TARGET)
|
||||||
$(report) warn "NOTE: All prior keys still remain."
|
$(report) warn "NOTE: All prior keys still remain."
|
||||||
|
|
||||||
|
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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user