-
Notifications
You must be signed in to change notification settings - Fork 15
/
deps.sh
executable file
·64 lines (55 loc) · 1.79 KB
/
deps.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
#!/bin/bash
function ensure_helm_repos() {
helm repo add jetstack https://charts.jetstack.io
helm repo add grafana https://grafana.github.io/helm-charts
helm repo update
}
function update_os() {
apt update
apt upgrade -y
apt install -y curl wget git sudo lsb-release vim
}
function ensure_distro_specific_deps() {
DISTRO=$(lsb_release -si)
echo "Detected Distribution: $DISTRO"
if [[ "$DISTRO" == "Ubuntu" ]]; then
echo "Disabling ufw"
ufw disable
systemctl disable ufw
elif [[ "$DISTRO" == "Debian" ]]; then
echo "Updating iptables"
apt remove -y iptables nftables
apt install -y arptables ebtables
update-alternatives --set iptables /usr/sbin/iptables-legacy
update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy
update-alternatives --set arptables /usr/sbin/arptables-legacy
update-alternatives --set ebtables /usr/sbin/ebtables-legacy
else
echo "Unsupported Distribution. Exiting..."
exit 1
fi
}
function ensure_deps() {
if command -v yq >/dev/null 2>&1 ; then
echo "yq is already installed. Skipping."
else
wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/local/bin/yq
chmod +x /usr/local/bin/yq
fi
if command -v helm >/dev/null 2>&1 ; then
echo "helm is already installed. Skipping."
else
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
fi
if command -v prettytable >/dev/null 2>&1 ; then
echo "prettytable is already installed. Skipping."
else
wget https://raw.githubusercontent.com/jakobwesthoff/prettytable.sh/master/prettytable -O /usr/local/bin/prettytable
chmod +x /usr/local/bin/prettytable
fi
}
update_os
ensure_deps
ensure_distro_specific_deps
ensure_helm_repos
export KUBECONFIG=/etc/rancher/k3s/k3s.yaml