You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible/test/integration/targets/ansible-vault/script/vault-secret.sh

25 lines
564 B
Bash

#!/usr/bin/env bash
set -eu
# shellcheck disable=SC2086
basename="$(basename $0)"
# shellcheck disable=SC2046
# shellcheck disable=SC2086
dirname="$(basename $(dirname $0))"
basename_prefix="get-password"
default_password="foo-bar"
case "${basename}" in
"${basename_prefix}"-*)
password="${default_password}-${basename#${basename_prefix}-}"
;;
*)
password="${default_password}"
;;
esac
# the password is different depending on the path used (direct or symlink)
# it would be the same if symlink is 'resolved'.
echo "${password}_${dirname}"