Fix: mod_pass binary requirement and ssh key search improvment

This commit is contained in:
mrjk 2018-03-01 22:31:25 -05:00
parent ea34261619
commit ab46eae784
2 changed files with 23 additions and 3 deletions

View File

@ -6,6 +6,14 @@ IDM_MOD_DEPS="id gpg"
## Pass functions
##########################################
idm_pass_header ()
{
local id=$1
lib_require_bin pass || idm_exit 1
}
idm_pass ()
{
#set -x
@ -21,6 +29,7 @@ idm_pass ()
fi
# Interncal override case
idm_pass_header $id
# Fallback to command
lib_id_is_enabled $id
@ -32,6 +41,7 @@ idm_pass__ls ()
{
local id=${1}
lib_id_is_enabled $id || return 0
idm_pass_header $id
{
PASSWORD_STORE_DIR=~/.config/pass/${id} \

View File

@ -226,12 +226,22 @@ idm_ssh_add ()
lib_id_is_enabled $id
if [[ ! -z $key ]]; then
pub_keys=$(find ~/.ssh/id -maxdepth $maxdepth -name "${id}_*" -name '*pub' -name "*$1*" | sort)
if [[ ! -z "$key" ]]; then
pub_keys=$(
{
# Compat mode
find ~/.ssh/id -maxdepth $maxdepth -name "${id}_*" -name '*pub' -name "*$1*" | sort
# New mode (test)
find ~/.ssh/$id -maxdepth $maxdepth -name "${id}_*" -name '*pub' -name "*$1*" | sort
} | sort | uniq
)
else
pub_keys=$(find ~/.ssh/id -maxdepth $maxdepth -name "${id}_*" -name '*pub' | sort)
pub_keys=$(find ~/.ssh/$id -maxdepth $maxdepth -name "${id}_*" -name '*pub' | sort)
fi
echo "$pub_keys"
# Get list of key
local key_list=""
while read -r pub_key; do