Move ssh-config into subdirectory to enable automatic matching

This commit is contained in:
Evie Litherland-Smith 2023-02-09 08:59:12 +00:00
parent 8383f7d019
commit 6211685b77
4 changed files with 24 additions and 5 deletions

View file

@ -3,6 +3,7 @@ CONFIG_DIR := $(if $(XDG_CONFIG_HOME), $(XDG_CONFIG_HOME), $(HOME)/.config)
FONT_DIR := $(HOME)/.local/share/fonts FONT_DIR := $(HOME)/.local/share/fonts
ZSH_DIR := $(if $(ZSH), $(ZSH), $(HOME)/.oh-my-zsh) ZSH_DIR := $(if $(ZSH), $(ZSH), $(HOME)/.oh-my-zsh)
ZSH_CUSTOM_DIR := $(if $(ZSH_CUSTOM), $(ZSH_CUSTOM), $(ZSH_DIR)/custom) ZSH_CUSTOM_DIR := $(if $(ZSH_CUSTOM), $(ZSH_CUSTOM), $(ZSH_DIR)/custom)
SSH_DIR := $(HOME)/.ssh
HOME_ITEMS := $(wildcard home/*) HOME_ITEMS := $(wildcard home/*)
HOME_TARGETS := $(HOME_ITEMS:home/%=$(HOME)/.%) HOME_TARGETS := $(HOME_ITEMS:home/%=$(HOME)/.%)
@ -10,6 +11,8 @@ CONFIG_ITEMS := $(wildcard config/*)
CONFIG_TARGETS := $(CONFIG_ITEMS:config/%=$(CONFIG_DIR)/%) CONFIG_TARGETS := $(CONFIG_ITEMS:config/%=$(CONFIG_DIR)/%)
ZSH_ITEMS := $(wildcard ohmyzsh/*.zsh) ZSH_ITEMS := $(wildcard ohmyzsh/*.zsh)
ZSH_TARGETS := $(ZSH_ITEMS:ohmyzsh/%.zsh=$(ZSH_CUSTOM_DIR)/%.zsh) ZSH_TARGETS := $(ZSH_ITEMS:ohmyzsh/%.zsh=$(ZSH_CUSTOM_DIR)/%.zsh)
SSH_ITEMS := $(wildcard ssh/*)
SSH_TARGETS := $(SSH_ITEMS:ssh/%=$(SSH_DIR)/%)
PACKER_REPO := https://github.com/wbthomason/packer.nvim PACKER_REPO := https://github.com/wbthomason/packer.nvim
PACKER_DIR := $(HOME)/.local/share/nvim/site/pack/packer/start/packer.nvim PACKER_DIR := $(HOME)/.local/share/nvim/site/pack/packer/start/packer.nvim
@ -36,16 +39,16 @@ config: $(CONFIG_TARGETS)
zsh: $(ZSH_DIR) $(POWERLEVEL_DIR) $(ZSH_TARGETS) zsh: $(ZSH_DIR) $(POWERLEVEL_DIR) $(ZSH_TARGETS)
ssh: $(HOME)/.ssh/config $(HOME)/.ssh/sockets $(HOME)/.ssh/config.d ssh: $(SSH_TARGETS) $(HOME)/.ssh/sockets
nvim: $(PACKER_DIR) nvim: $(PACKER_DIR)
$(HOME_TARGETS): $(HOME)/.%: home/% $(HOME_TARGETS): $(HOME)/.%: home/%
$(CONFIG_TARGETS): $(CONFIG_DIR)/%: config/% $(CONFIG_TARGETS): $(CONFIG_DIR)/%: config/%
$(ZSH_TARGETS): $(ZSH_CUSTOM_DIR)/%.zsh: ohmyzsh/%.zsh $(ZSH_TARGETS): $(ZSH_CUSTOM_DIR)/%.zsh: ohmyzsh/%.zsh
$(HOME)/.ssh/config: $(HOME)/.ssh/%: ssh-% $(SSH_TARGETS): $(SSH_DIR)/%: ssh/%
$(HOME_TARGETS) $(CONFIG_TARGETS) $(ZSH_TARGETS) $(HOME)/.ssh/config: $(HOME_TARGETS) $(CONFIG_TARGETS) $(ZSH_TARGETS) $(SSH_TARGETS):
ln -s $(PWD)/$? $@ ln -s $(PWD)/$? $$(dirname $@)
$(PACKER_DIR): $(PACKER_DIR):
git clone --depth 1 $(PACKER_REPO) $@ git clone --depth 1 $(PACKER_REPO) $@
@ -56,5 +59,5 @@ $(ZSH_DIR):
$(POWERLEVEL_DIR): $(ZSH_DIR) $(POWERLEVEL_DIR): $(ZSH_DIR)
git clone --depth 1 $(POWERLEVEL_REPO) $@ git clone --depth 1 $(POWERLEVEL_REPO) $@
$(LOCAL_BIN) $(CONFIG_DIR) $(FONT_DIR) $(HOME)/.ssh/sockets $(HOME)/.ssh/config.d: $(LOCAL_BIN) $(CONFIG_DIR) $(FONT_DIR) $(SSH_DIR) $(HOME)/.ssh/sockets:
mkdir -p $@ mkdir -p $@

2
ssh/config.d/git.conf Normal file
View file

@ -0,0 +1,2 @@
Host git.ccfe.ac.uk
user git

14
ssh/config.d/jet.conf Normal file
View file

@ -0,0 +1,14 @@
Host heimdall
HostName heimdall044.jet.uk
Host jdc
HostName 10.40.4.103
Host freia
HostName freia022.hpc.l
Host heimdall jdc freia
User elitherl
ForwardX11 yes
ForwardX11Timeout 0
Compression yes