fix: check if gpg keyrings exist

This commit is contained in:
2025-04-09 22:46:01 +01:00
parent 48f557cd13
commit ed89ec3af4
2 changed files with 8 additions and 6 deletions

View File

@@ -7,11 +7,10 @@
if ! command -v "terraform" &>/dev/null; then
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
# https://developer.hashicorp.com/terraform/tutorials/aws-get-started/install-cli#install-terraform
wget -O- https://apt.releases.hashicorp.com/gpg |
gpg --dearmor |
sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg >/dev/null
terraform_keyring_path="/usr/share/keyrings/hashicorp-archive-keyring.gpg"
if [[ ! -f "$terraform_keyring_path" ]]; then
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o "$terraform_keyring_path"
fi
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] \
https://apt.releases.hashicorp.com $(lsb_release -cs) main" |
sudo tee /etc/apt/sources.list.d/hashicorp.list