gen_metada.sh: Check commands exist

This commit is contained in:
Tanguy 2023-10-22 16:34:34 +02:00 committed by Pierre-Olivier Mercier
parent 1afbab32dd
commit f6bb741070
1 changed files with 2 additions and 0 deletions

View File

@ -14,6 +14,7 @@ SSH_PATH="${SSH_PATH:-/tmp/fic_ssh}"
DHPARAM_PATH="${DHPARAM_PATH:-/tmp/dhparam.pem}"
OUTPUT_PATH="${OUTPUT_PATH:-"$(mktemp -d)"}"
command -v vault &> /dev/null || (echo "vault could not be found" && exit)
vault login -method=oidc -no-print 2> /dev/null
export DM_CRYPT="$(tr -d -c "a-zA-Z0-9" < /dev/urandom | fold -w512 | head -n 1)"
@ -30,6 +31,7 @@ export SYNCRO_PRIVATE_KEY="$(cat "$SSH_PATH" | escape_newline)"
echo -e "\n\nGenerating DH params please wait"
command -v openssl &> /dev/null || (echo "openssl could not be found" && exit)
openssl dhparam -out "$DHPARAM_PATH" 4096 &>/dev/null
export DHPARAM="$(cat "$DHPARAM_PATH" | escape_newline)"