diff options
Diffstat (limited to 'vault.sh')
-rwxr-xr-x | vault.sh | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -5,4 +5,12 @@ set -ex password_bin=$(command -v pass || command -v gopass) password_name="${2:-infrastructure/ansible/root}" -"${password_bin}" show "${password_name}" | head -n 1 +set +x + +if [ "$(logname)" != "$(whoami)" ]; then + password_string="$(su "$(logname)" -c "${password_bin} show ${password_name}")" +else + password_string="$("${password_bin}" show "${password_name}")" +fi + +echo "${password_string}" | head -n 1 |