From 19cd11089a5f199e17e0485c93a6676e7962c9b6 Mon Sep 17 00:00:00 2001 From: Evie Litherland-Smith Date: Tue, 31 Jan 2023 16:13:07 +0000 Subject: [PATCH] Use sshconfig Include option to symlink standard config --- Makefile | 30 +++++++----------------------- paths.zsh | 8 +++++++- templates/ssh-config => ssh-config | 4 +++- 3 files changed, 17 insertions(+), 25 deletions(-) rename templates/ssh-config => ssh-config (84%) diff --git a/Makefile b/Makefile index 38f31f04..7773afe1 100644 --- a/Makefile +++ b/Makefile @@ -8,8 +8,6 @@ CONFIG_ITEMS := $(wildcard config/*) CONFIG_TARGETS := $(CONFIG_ITEMS:config/%=$(CONFIG_DIR)/%) FONT_ITEMS := $(wildcard nerdfont_symbols/*) FONT_TARGETS := $(FONT_ITEMS:nerdfont_symbols/%=$(FONT_DIR)/%) -BIN_ITEMS := $(wildcard bin/*) -BIN_TARGETS := $(BIN_ITEMS:bin/%=$(LOCAL_BIN)/%) ZSH_ITEMS := $(wildcard *.zsh) ZSH_TARGETS := $(ZSH_ITEMS:%.zsh=$(ZSH_CUSTOM_DIR)/%.zsh) @@ -18,38 +16,27 @@ PACKER_DIR := $(HOME)/.local/share/nvim/site/pack/packer/start/packer.nvim POWERLEVEL_REPO := https://github.com/romkatv/powerlevel10k.git POWERLEVEL_DIR := $(ZSH_CUSTOM_DIR)/themes/powerlevel10k -.PHONY := config bin all clean zsh ssh +.PHONY := config clean zsh ssh config: $(CONFIG_TARGETS) zsh ssh -bin: $(BIN_TARGETS) - -all: config bin - clean: - # pipx uninstall-all for link in $(CONFIG_TARGETS); do rm "$$link"; done for link in $(FONT_TARGETS); do rm "$$link"; done - for link in $(BIN_TARGETS); do rm "$$link"; done for link in $(ZSH_TARGETS); do rm "$$link"; done + rm $(HOME)/.ssh/config -zsh: $(ZSH_DIR) $(ZSH_CUSTOM_DIR) $(POWERLEVEL_DIR) $(ZSH_TARGETS) +zsh: $(ZSH_DIR) $(ZSH_CUSTOM_DIR) $(POWERLEVEL_DIR) $(ZSH_TARGETS) $(HOME)/.zprofile -ssh: $(HOME)/.ssh/config $(HOME)/.ssh/sockets +ssh: $(HOME)/.ssh/config $(HOME)/.ssh/sockets $(HOME)/.ssh/config.d $(CONFIG_TARGETS): $(CONFIG_DIR)/%: config/% $(FONT_TARGETS): $(FONT_DIR)/%: nerdfont_symbols/% $(ZSH_TARGETS): $(ZSH_CUSTOM_DIR)/%.zsh: %.zsh -$(CONFIG_TARGETS) $(FONT_TARGETS) $(ZSH_TARGETS): +$(HOME)/.ssh/config: $(HOME)/.ssh/%: ssh-% +$(CONFIG_TARGETS) $(FONT_TARGETS) $(ZSH_TARGETS) $(HOME)/.ssh/config: ln -s $(PWD)/$? $@ -$(BIN_TARGETS): $(LOCAL_BIN)/%: bin/% - command -v $? 2> /dev/null || ln -s $(PWD)$? $@ - -$(HOME)/.ssh/config: $(HOME)/.ssh - cp -n templates/ssh-config $@ - touch $@ - $(PACKER_DIR): git clone --depth 1 $(PACKER_REPO) $@ @@ -61,8 +48,5 @@ $(ZSH_CUSTOM_DIR): $(ZSH_DIR) $(POWERLEVEL_DIR): git clone --depth 1 $(POWERLEVEL_REPO) $@ -$(HOME)/.gitconfig: - touch $@ - -$(LOCAL_BIN) $(CONFIG_DIR) $(FONT_DIR) $(HOME)/.ssh $(HOME)/.ssh/sockets: +$(LOCAL_BIN) $(CONFIG_DIR) $(FONT_DIR) $(HOME)/.ssh $(HOME)/.ssh/sockets $(HOME)/.ssh/config.d: mkdir -p $@ diff --git a/paths.zsh b/paths.zsh index b5898aa0..ea5d1913 100644 --- a/paths.zsh +++ b/paths.zsh @@ -1 +1,7 @@ -export PATH=$PATH:$HOME/.local/bin +# export PATH=$PATH:$HOME/.local/bin + +LOCAL_BIN="$HOME/.local/bin" +echo $PATH | grep -i "$LOCAL_BIN" - > /dev/null || export PATH=$PATH:$LOCAL_BIN + +DOTFILES_BIN="$(dirname $(readlink -f $0))/bin" +echo $PATH | grep -i "$DOTFILES_BIN" - > /dev/null || export PATH=$PATH:$DOTFILES_BIN diff --git a/templates/ssh-config b/ssh-config similarity index 84% rename from templates/ssh-config rename to ssh-config index 6e98b05b..bd98dbb3 100644 --- a/templates/ssh-config +++ b/ssh-config @@ -1,3 +1,5 @@ +Include config.d/* + Host * User elitherl AddKeysToAgent yes @@ -6,5 +8,5 @@ Host * ServerAliveCountMax 3 ControlMaster auto ControlPath ~/.ssh/sockets/%r@%h:%p - ControlPersist 3s + ControlPersist 5s ForwardX11Timeout 0