-
Notifications
You must be signed in to change notification settings - Fork 148
/
check_dependencies.sh
executable file
·69 lines (60 loc) · 2.54 KB
/
check_dependencies.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/bash
set -e
echo -e "\n\e[34m╔══════════════════════════════════════╗"
echo -e "║ \e[33mAzure TRE Makefile\e[34m ║"
echo -e "╚══════════════════════════════════════╝"
echo -e "\n\e[34m»»» ✅ \e[96mChecking pre-reqs\e[0m..."
echo -e "\n\e[96mChecking for Azure CLI\e[0m..."
if [ $? -ne 0 ]; then
echo -e "\e[31m»»» ⚠️ Azure CLI is not installed! 😥 Please go to http://aka.ms/cli to set it up"
exit
fi
if [[ "$1" == *"azfirewall"* ]]; then
echo -e "\n\e[96mChecking for Azure CLI extension(s)\e[0m..."
az extension show -n azure-firewall > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo -e "\e[31m»»» ⚠️ Azure CLI azure-firewall extension is not installed! 😥 Please go to http://aka.ms/cli to set it up"
exit
fi
fi
if [[ "$1" != *"nodocker"* ]]; then
echo -e "\n\e[96mChecking for Docker\e[0m..."
sudo docker version > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo -e "\e[31m»»» ⚠️ Docker is not installed! 😥 Please go to https://docs.docker.com/engine/install/ to set it up"
exit
fi
fi
if [[ "$1" == *"certbot"* ]]; then
echo -e "\n\e[96mChecking for Certbot\e[0m..."
/opt/certbot/bin/certbot --version > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo -e "\e[31m»»» ⚠️ Certbot is not installed! 😥 Please go to https://certbot.eff.org/lets-encrypt/pip-other to set it up"
exit
fi
fi
if [[ "$1" == *"porter"* ]]; then
echo -e "\n\e[96mChecking for porter\e[0m..."
porter --version > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo -e "\e[31m»»» ⚠️ Porter is not installed! 😥 Please go to https://porter.sh/install/ to set it up"
exit
fi
fi
# This is called if we are in a CI system and we will login
# with a Service Principal.
if [ -n "${TF_IN_AUTOMATION}" ]
then
az login --service-principal -u "$ARM_CLIENT_ID" -p "$ARM_CLIENT_SECRET" --tenant "$ARM_TENANT_ID"
az account set -s "$ARM_SUBSCRIPTION_ID"
fi
export SUB_NAME=$(az account show --query name -o tsv)
export SUB_ID=$(az account show --query id -o tsv)
export TENANT_ID=$(az account show --query tenantId -o tsv)
if [ -z "$SUB_NAME" ]; then
echo -e "\n\e[31m»»» ⚠️ You are not logged in to Azure!"
exit
fi
echo -e "\e[34m»»» 🔨 \e[96mAzure details from logged on user \e[0m"
echo -e "\e[34m»»» • \e[96mSubscription: \e[33m$SUB_NAME\e[0m"
echo -e "\e[34m»»» • \e[96mTenant: \e[33m$TENANT_ID\e[0m\n"