-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwsl-setup.sh
executable file
·128 lines (102 loc) · 3.71 KB
/
wsl-setup.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#!/usr/bin/bash
#
# Installs terraform, go, az cli, dotnet for WSL environment
cd ~
sudo apt-get update -y
sudo apt-get install -y mc
mkdir -p "$(pwd)/go/bin"
cat <<EOT > .dev-settings.sh
export GOBIN=$(pwd)/go/bin
EOT
if ! grep -q ".dev-settings.sh" .bashrc ;
then
echo "add dev-settings to .bashrc"
echo ". ~/.dev-settings.sh" >> .bashrc
fi
if ! command -v go ;
then
echo "Installing GO"
GO_VERSION="1.19.2"
if ! test -f go$GO_VERSION.tar.gz ; then
wget -r --tries=10 https://storage.googleapis.com/golang/go$GO_VERSION.linux-amd64.tar.gz -O go$GO_VERSION.tar.gz
else
echo "Go distr downloaded..."
fi
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf go$GO_VERSION.tar.gz
echo "export GOROOT=/usr/local/go" >> ~/.bashrc
echo "export PATH=\$PATH:/usr/local/go/bin" >> ~/.bashrc
else
echo "Go already installed"
fi
if ! command -v terraform ;
then
echo "Install Terraform"
sudo apt-get install -y gnupg software-properties-common
wget -O- https://apt.releases.hashicorp.com/gpg | \
gpg --dearmor | \
sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg
gpg --no-default-keyring \
--keyring /usr/share/keyrings/hashicorp-archive-keyring.gpg \
--fingerprint
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
sudo apt update
sudo apt-get install terraform -y
else
echo "Terraform already installed"
fi
if ! (command -v az | grep '/usr/bin/az') ;
then
echo "Install AZ CLI"
sudo apt-get install ca-certificates curl apt-transport-https lsb-release gnupg -y
curl -sL https://packages.microsoft.com/keys/microsoft.asc | \
gpg --dearmor | \
sudo tee /etc/apt/trusted.gpg.d/microsoft.gpg > /dev/null
AZ_REPO=$(lsb_release -cs)
echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $AZ_REPO main" | sudo tee /etc/apt/sources.list.d/azure-cli.list
sudo apt-get update
sudo apt-get install azure-cli -y
else
echo "AZ already installed"
fi
if ! (command -v kubectl) ;
then
echo "Install kubectl"
sudo apt-get install -y ca-certificates curl apt-transport-https
curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
sudo apt-get update
sudo apt-get install -y kubectl
else
echo "kubectl already installed"
fi
if ! (command -v dotnet) ;
then
echo "Install Dotnet SDK"
wget https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb
sudo apt-get update
sudo apt-get install -y dotnet-sdk-6.0 dotnet-sdk-7.0
else
echo "Dotnet already installed"
fi
# Check if Homebrew is already installed
if test ! $(which brew); then
echo "Installing Homebrew..."
# Install the prerequisites
sudo apt-get update
sudo apt-get install -y curl git build-essential
# Install Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Add Homebrew to the PATH
echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >>~/.bashrc
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
echo 'export PATH="/home/linuxbrew/.linuxbrew/bin:$PATH"' >> ~/.bashrc
source ~/.profile
else
echo "Brew already installed"
fi
#configure git
git config --global credential.helper store