blob: 6bf443aa9d58909d3351fe535da8c225f419f6e3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
#!/bin/sh
set -ex
password_bin=$(command -v pass || command -v gopass)
password_name="${2:-infrastructure/ansible/root}"
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
|