Use sshconfig Include option to symlink standard config

This commit is contained in:
Evie Litherland-Smith 2023-01-31 16:13:07 +00:00
parent 07c3ab7986
commit 19cd11089a
3 changed files with 17 additions and 25 deletions

View file

@ -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 $@

View file

@ -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

View file

@ -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