From b3e8bfdc50f4622e010692e6d3d2d9b0a5ae8f67 Mon Sep 17 00:00:00 2001 From: pika Date: Sat, 17 May 2025 12:11:42 +0200 Subject: [PATCH] addet keychain setup --- .zshrc | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/.zshrc b/.zshrc index 0248dab..ae852dd 100644 --- a/.zshrc +++ b/.zshrc @@ -551,10 +551,10 @@ __alias__() { # ─< t stands for trash(-cli) >─────────────────────────────────────────────────────────────── if command_exists trash; then - alias rm="trash" + alias rm="trash $@" alias t="trash" elif command_exists trash-cli; then - alias rm="trash-cli" + alias rm="trash-cli $@" alias t="trash-cli" else echo_error "-- You do not have trash or trash-cli installed! Your 'rm' will be permanent! --" @@ -786,6 +786,30 @@ __defaults__() { zstyle ':fzf-tab:complete:__zoxide_z:*' fzf-preview 'ls --color $realpath' setopt autocd notify # End of lines configured by zsh-newuser-install + # +} + +__keychain_setup__() { + setupKeys() { + local keys=( + "homelab-id_rsa" + "hetzner_id_rsa" + ) + + for i in "${keys[@]}"; do + if [ -n $i ]; then + if [ -e "$i" ]; then + eval "$(keychain --eval --agents ssh ~/.ssh/$i)" + fi + else + return 69 + fi + done + } + + if ! setupKeys; then + eval "$(keychain --eval --agents ssh)" + fi } __end__() { @@ -813,6 +837,7 @@ main() { __alias__ __sources__ __end__ + __keychain_setup__ } if check_root; then