From 28e8bdf7f8286bd431b7f3b709e79f3827b31469 Mon Sep 17 00:00:00 2001 From: TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> Date: Wed, 24 Dec 2025 13:54:03 +0900 Subject: updates --- debian/.local/bin/sshadd | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 debian/.local/bin/sshadd (limited to 'debian/.local/bin/sshadd') diff --git a/debian/.local/bin/sshadd b/debian/.local/bin/sshadd new file mode 100755 index 0000000..ea389b9 --- /dev/null +++ b/debian/.local/bin/sshadd @@ -0,0 +1,31 @@ +#!/bin/sh + +ssh_key_dir="${PASSWORD_STORE_DIR:-${HOME}/.local/share/.password-store}" + +temp_private_keys_list=$(mktemp) + +# Ensure that filenames with spaces or other special characters are handled correctly. +find "$ssh_key_dir" -name "*.pub" | while IFS= read -r pub_file_path; do + private_key_path="${pub_file_path%.pub}" + if [ -f "$private_key_path" ]; then + echo "$(basename "$private_key_path")" >>"$temp_private_keys_list" + echo "$private_key_path" >>"$temp_private_keys_list" + fi +done + +# Use of dmenu is system-specific and not covered by POSIX standards +selected_key_name=$(awk 'NR % 2 == 1' "$temp_private_keys_list" | dmenu -i -p "Select SSH key:") + +if [ -n "$selected_key_name" ]; then + selected_key_path=$(awk -v name="$selected_key_name" '$0 == name { getline; print }' "$temp_private_keys_list") + + if [ -n "$selected_key_path" ]; then + export SSH_ASKPASS="$HOME/.local/bin/demupass" + setsid ssh-add "$selected_key_path"