dotfiles/ssh/makefile

39 lines
1019 B
Makefile
Raw Permalink Normal View History

# -*- mode: makefile-gmake; -*-
SRC_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
CONFIG_SRC := $(SRC_DIR)/config
CONFIG_TRGT := ~/.ssh/config
GIT_KEY := ~/.ssh/git.jpatrick.io
include ../lib/shared.mk
2021-11-28 21:33:24 +00:00
up: init
mkdir -p public_keys/`hostname`
cd ~/.ssh
$(report) header "Copying public keys"
for i in *.pub ; do
cp $$i public_keys/`hostname`/$$i
$(report) pass "Copied $$i"
done
2021-11-28 21:33:24 +00:00
down:
$(report) header "Removing ssh sym-links"
$(rm_link) $(CONFIG_TRGT)
$(report) warn "NOTE: All keys still remain."
2019-06-15 01:49:18 +00:00
2021-11-28 21:33:24 +00:00
init:
$(report) header "Setting up ssh"
$(mk_link) $(CONFIG_SRC) $(CONFIG_TRGT)
$(mk_link) $(SRC_DIR)/public_keys ~/.ssh/public_keys
2024-08-09 02:43:05 +00:00
mkdir -p ~/.ssh/config.d
2021-11-28 21:33:24 +00:00
$(MAKE) -C $(SRC_DIR) init_git_key
init_git_key:
if [[ -e $(GIT_KEY) ]] ; then
$(report) debug "$(GIT_KEY) already installed."
else
$(report) info "Setting up key for git.jpatrick.io"
ssh-keygen -t ed25519 -C "`hostname`: `date`" -f $(GIT_KEY) -N "" \
; $(report) info "git.jpatrick.io key created"
fi