set PCKS11_MODULE from P11M, when delivered by ssh

This commit is contained in:
Jakobus Schürz 2023-02-23 13:06:40 +01:00
parent 6726c262bb
commit cf3d960a10

View file

@ -24,15 +24,14 @@ promptcommandmunge () {
function _pkcs11module() { function _pkcs11module() {
[ -z "${P11M:+x}" ] && \ [ -z "${P11M:+x}" ] && \
[ -n "$(whereis ${pkcs11_module_default:-p11-kit-proxy.so}|awk '{print $2}')" ] && \ [ -n "$(whereis ${pkcs11_module_default:-p11-kit-proxy.so}|awk '{print $2}')" ] && \
export P11M=$(whereis ${pkcs11_module_default:-p11-kit-proxy.so}|awk '{print $2}' || \ export PKCS11_MODULE=$(whereis ${pkcs11_module_default:-p11-kit-proxy.so}|awk '{print $2}' || \
{ echo "${pkcs11_module_default:-p11-kit-proxy.so} not forwarded by ssh or installed, unset P11M"; unset P11M; }) { echo "${pkcs11_module_default:-p11-kit-proxy.so} not forwarded by ssh or installed, unset P11M"; unset P11M; })
[ -z "${PKCS11_MODULE:+x}" ] && PKCS11_MODULE=${P11M} [ -n "${P11M:+x}" ] && PKCS11_MODULE=${P11M}
[ -n "${P11M:+x}" ] && tmux set-environment P11M ${P11M}
tmux set-environment PKCS11_MODULE ${PKCS11_MODULE}
# [ -z "${PKCS11_MODULE:+x}" ] && \
# [ -n "$(whereis p11-kit-proxy.so|awk '{print $2}')" ] && \
# export PKCS11_MODULE=$(whereis p11-kit-proxy.so|awk '{print $2}' || \
# { echo "p11-kit-proxy not installed, unset PKCS11_MODULE"; unset PKCS11_MODULE; })
} }
## this function updates in combination with PROMPT_COMMAND the shell-environment-variables in tmux-sessions, ## this function updates in combination with PROMPT_COMMAND the shell-environment-variables in tmux-sessions,
# every time prompt is called. It does it only, when called from tmux (Environment TMUX is set) # every time prompt is called. It does it only, when called from tmux (Environment TMUX is set)