Files
scripts/tf_provider/install_provider_powerdns.sh

35 lines
1.3 KiB
Bash
Raw Normal View History

#!/bin/bash
POWERDNS_PROVIDER=$(curl --silent https://api.github.com/repos/MrKeiKun/terraform-provider-powerdns/releases | jq -r '.[0].name' | tr -d "v")
VERSION="$POWERDNS_PROVIDER"
KERNEL=$(uname -s)
ARH=$(uname -m)
if [ $KERNEL = "Linux" ]; then
KERNEL="linux"
elif [ $KERNEL = "Darwin" ]; then
KERNEL="darwin"
else
echo "There is no such version"
fi
if [ ${ARH} = "x86_64" ]; then
ARH_VERSION="amd64"
elif [ ${ARH} = "arm64" ]; then
ARH_VERSION="arm64"
else
echo "There is no such version"
fi
echo "$VERSION"
echo "terraform-provider-powerdns_${VERSION}_${KERNEL}_${ARH_VERSION}.zip"
if [ ! -d "$HOME/.terraform.d/plugins/registry.terraform.io/MrKeiKun" ]; then
mkdir -p $HOME/.terraform.d/plugins/registry.terraform.io/MrKeiKun
mkdir -p $HOME/.terraform.d/plugins/registry.terraform.io/MrKeiKun/powerdns/${VERSION}/${KERNEL}_${ARH_VERSION}/
else
echo "The plugin version $VERSION is already installed"
fi
wget https://github.com/MrKeiKun/terraform-provider-powerdns/releases/download/v${VERSION}/terraform-provider-powerdns_${VERSION}_${KERNEL}_${ARH_VERSION}.zip
unzip -j "terraform-provider-powerdns_${VERSION}_${KERNEL}_${ARH_VERSION}.zip" "terraform-provider-powerdns_v${VERSION}" -d "$HOME/.terraform.d/plugins/registry.terraform.io/MrKeiKun/powerdns/${VERSION}/${KERNEL}_${ARH_VERSION}/"