From 413c9be5cedaec1e0f2d4ddf148567b07fc9e865 Mon Sep 17 00:00:00 2001 From: jay Date: Wed, 5 Apr 2023 23:29:58 +0800 Subject: [PATCH] [feat] add ssh agent autostart switch --- home/.chezmoi.toml.tmpl | 2 ++ home/{dot_zprofile => dot_zprofile.tmpl} | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) rename home/{dot_zprofile => dot_zprofile.tmpl} (98%) diff --git a/home/.chezmoi.toml.tmpl b/home/.chezmoi.toml.tmpl index e88a29d..9e105af 100644 --- a/home/.chezmoi.toml.tmpl +++ b/home/.chezmoi.toml.tmpl @@ -26,9 +26,11 @@ {{- $installNode := promptBoolOnce . "installNode" "install nodejs bin" true -}} {{- $installRust := promptBoolOnce . "installRust" "install rust bin" true -}} {{- $enableTmux := promptBoolOnce . "enableTmux" "install enable tmux autostart" true -}} +{{- $enableSSHAgent := promptBoolOnce . "enableSSHAgent" "install enable ssh agent autostart" true -}} [data.shell] tmux = {{ $enableTmux }} + ssh_agent = {{ $enableSSHAgent }} [data.gitconfig] email = {{ $email | quote }} diff --git a/home/dot_zprofile b/home/dot_zprofile.tmpl similarity index 98% rename from home/dot_zprofile rename to home/dot_zprofile.tmpl index d60396f..699716b 100644 --- a/home/dot_zprofile +++ b/home/dot_zprofile.tmpl @@ -10,8 +10,8 @@ function start_agent { /usr/bin/ssh-add; } +{{ if .shell.ssh_agent }} # Source SSH settings, if applicable - if [ -f "${SSH_ENV}" ]; then . "${SSH_ENV}" > /dev/null #ps ${SSH_AGENT_PID} doesn't work under cywgin @@ -21,6 +21,7 @@ if [ -f "${SSH_ENV}" ]; then else start_agent; fi +{{ end }} function envf { if [ ! -f "$1" ]; then