-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdev-setup.sh
executable file
·81 lines (72 loc) · 2.15 KB
/
dev-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
#!/bin/bash
echo "updating apt"
sudo apt update
# Add a comment and command at end of .bashrc
# file if cmd doesn't exits
add_to_bash_rc() {
if ! $(cat ~/.bashrc | grep -q "$2"); then
echo -e "adding to ~/.bashrc:"
echo -e "\n# $1\n$2" | tee -a ~/.bashrc
else
echo -e "found '$2' in ~/.bashrc... skipping"
fi
}
echo "installing apt packages"
apt_packages=(
"python3-pip"
"python3-venv"
"make"
"jq"
"gcc"
)
sudo apt install -y ${apt_packages[@]}
echo "installing homebrew"
if [[ ! -x /home/linuxbrew/.linuxbrew/bin/brew ]]
then
echo "installing homebrew"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
else
echo "homebrew already installed"
fi
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
add_to_bash_rc "homebrew" 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"'
brew_packages=(
"tilt"
"tilt-dev/tap/ctlptl"
"go"
"protobuf"
"protoc-gen-go"
"helm"
"kubernetes-cli"
"minikube"
"kind"
"k3d"
"swagger-codegen"
"nvm"
"kubebuilder"
"starship"
"k9s"
"dive"
"yq"
)
brew install ${brew_packages[@]}
# .bashrc
add_to_bash_rc "tilt" "source <(tilt completion bash)"
add_to_bash_rc "ctlptl" "source <(ctlptl completion bash)"
add_to_bash_rc "golang" 'export PATH=$PATH:$HOME/go/bin'
add_to_bash_rc "helm" "source <(helm completion bash)"
add_to_bash_rc "kubectl" "source <(kubectl completion bash)"
add_to_bash_rc "minikube" "source <(minikube completion bash)"
add_to_bash_rc "kind" "source <(kind completion bash)"
add_to_bash_rc "k3d" "source <(k3d completion bash)"
add_to_bash_rc "starship" 'eval "$(starship init bash)"'
NVM_SOURCE=$(cat << EOF
export NVM_DIR="$HOME/.nvm"
[ -s "$(brew --prefix)/opt/nvm/nvm.sh" ] && \. "$(brew --prefix)/opt/nvm/nvm.sh" # This loads nvm
[ -s "$(brew --prefix)/opt/nvm/etc/bash_completion.d/nvm" ] && \. "$(brew --prefix)/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion
EOF
)
add_to_bash_rc "nvm" "$NVM_SOURCE"
# golang
go env -w CC=gcc CXX="g++" # setup CGO dependencies
go install github.com/norwoodj/helm-docs/cmd/[email protected]