-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·182 lines (159 loc) · 6.45 KB
/
install.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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
#!/usr/bin/env bash
set -e
# vars
PYTHON_VERSION="3.10.11"
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
source "$SCRIPT_DIR/zsh/.util.sh"
if is_linux && is_ubuntu; then
# install system deps and tools
sudo sed -i 's/#$nrconf{restart} = '"'"'i'"'"';/$nrconf{restart} = '"'"'a'"'"';/g' /etc/needrestart/needrestart.conf || true
sudo apt update
sudo NEEDRESTART_MODE=a DEBIAN_FRONTEND=noninteractive apt -y install build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev ca-certificates curl gnupg python3-venv python3-pip \
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev \
git zsh tmux stow htop tree net-tools fzf neofetch direnv
# install act (tool to test github actions locally)
curl -s https://raw.githubusercontent.com/nektos/act/master/install.sh | sudo bash
elif is_linux && is_fedora; then
sudo dnf update -y
sudo dnf install -y git zsh tmux stow htop tree net-tools fzf neofetch direnv
elif is_mac; then
if ! command -v brew &>/dev/null; then
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
brew install xz stats tmux stow fzf neofetch direnv act
brew install htop || true
else
echo "Unknown OS: $(uname -s)"
exit 1
fi
if ! command -v docker &>/dev/null; then
if is_linux && is_ubuntu; then
echo ">>> Installing docker..."
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --batch --yes --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
echo \
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" |
sudo tee /etc/apt/sources.list.d/docker.list >/dev/null
sudo apt update
sudo NEEDRESTART_MODE=a DEBIAN_FRONTEND=noninteractive apt -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo usermod -aG docker $USER
elif is_linux && is_fedora; then
sudo dnf -y install dnf-plugins-core
sudo dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo
sudo dnf install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo usermod -aG docker $USER
sudo systemctl start docker
elif is_mac; then
brew install --cask docker
fi
echo "Docker installation complete"
fi
if ! command -v helm &>/dev/null; then
echo ">>> Installing helm..."
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
echo "Helm installation complete"
fi
if ! command -v k9s &>/dev/null; then
echo ">>> Installing k9s..."
if is_linux_arm; then
curl -LO https://github.com/derailed/k9s/releases/latest/download/k9s_Linux_arm64.tar.gz
tar xzvf k9s_Linux_arm64.tar.gz
fi
if is_linux_64; then
curl -LO https://github.com/derailed/k9s/releases/latest/download/k9s_Linux_amd64.tar.gz
tar xzvf k9s_Linux_amd64.tar.gz
fi
if is_mac_64; then
curl -LO https://github.com/derailed/k9s/releases/latest/download/k9s_Darwin_amd64.tar.gz
tar xzvf k9s_Darwin_amd64.tar.gz
fi
if is_mac_arm; then
curl -LO https://github.com/derailed/k9s/releases/latest/download/k9s_Darwin_arm64.tar.gz
tar xzvf k9s_Darwin_arm64.tar.gz
fi
sudo mv k9s /usr/local/bin
echo "K9s installation complete"
fi
if ! command -v minikube &>/dev/null; then
echo ">>> Installing minikube..."
if is_linux_arm; then
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-arm64
sudo install minikube-linux-arm64 /usr/local/bin/minikube
fi
if is_linux_64; then
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube
fi
if is_mac_64; then
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-darwin-amd64
sudo install minikube-darwin-amd64 /usr/local/bin/minikube
fi
echo "Minikube installation complete"
fi
if ! command -v kubectl &>/dev/null; then
echo ">>> Installing kubectl..."
if is_linux_arm; then
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/arm64/kubectl"
fi
if is_linux_64; then
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
fi
if is_mac_64; then
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/amd64/kubectl"
fi
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
echo "Kubectl installation complete"
fi
if [ ! -d "$HOME/.oh-my-zsh" ]; then
echo ">>> Installing zsh..."
echo $(zsh --version)
sudo sh -c "echo $(which zsh) >> /etc/shells"
sudo chsh -s $(which zsh) $(whoami)
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
force_stow zsh
echo "Zsh installation complete"
fi
if [ ! -d "$HOME/.pyenv" ]; then
echo ">>> Installing pyenv..."
curl https://pyenv.run | bash
source ~/.toolsrc.sh
echo $(pyenv --version)
echo "Pyenv installation complete"
fi
# install and set default python using pyenv
if [ ! -d "$HOME/.pyenv/versions/$PYTHON_VERSION" ]; then
pyenv install $PYTHON_VERSION
pyenv install 3.7
pyenv install 3.8
pyenv global $PYTHON_VERSION
fi
if [ ! -d "$HOME/.local/pipx" ]; then
echo ">>> Installing pipx..."
if is_linux; then
pip install pipx
else
brew install pipx
pipx ensurepath
fi
echo "Pipx installation complete"
fi
# install python global tools
PIPX_PACKAGES="pipenv glances ipython python-dotenv tldr argcomplete poetry pgcli httpie"
for pkg in $PIPX_PACKAGES; do
pipx install "$pkg"
done
sudo $(which activate-global-python-argcomplete) || true
# setup tpm
if [ ! -d "$HOME/.tmux/plugins/tpm" ]; then
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
fi
force_stow tmux
~/.tmux/plugins/tpm/scripts/install_plugins.sh
force_stow git
force_stow zsh
echo "Setup completed! To take all the effects log out and log in back."