-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
197 lines (160 loc) · 5.9 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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
#!/usr/bin/zsh
# This script is intended to be run on a fresh install of the OS
# It will install all the necessary software and restore the configuration files
# Check if the user is root
if [ "$(id -u)" -eq 0 ]; then
echo "This script should not be run as root"
exit 1
fi
mkdir -p ~/tmp
# -----------------------------User Interaction-----------------------------
DO_INSTALL_ALACRITTY=false
DO_UPDATE_BREW=false
# Ask the user if they want to install Alacritty
if [ -f /etc/redhat-release ] || [ -f /etc/debian_version ]; then
read -p "Do you want to install Alacritty? (y/n) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
DO_INSTALL_ALACRITTY=true
fi
fi
# Ask the user if they want to upgrade all the installed software
if [ -f /etc/redhat-release ] || [ -f /etc/debian_version ] || [ -f /usr/bin/sw_vers ]; then
read -p "Do you want to update all brew packages? (recommended) (y/n) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
DO_UPDATE_BREW=true
fi
fi
# -----------------------------------ZSH-------------------------------------
# Install zsh and its dependencies
cd zsh
chmod +x ./install.sh # Prevent permission denied error
sh ./install.sh
cd ..
# ----------------------------------Brew------------------------------------
# Install Homebrew if not installed
cd brew
chmod +x ./install.sh # Prevent permission denied error
sh ./install.sh
cd ..
# ----------------------------------Git-------------------------------------
# Install git to make sure it is in latest version
# if the os is fedora or redhat
if [ -f /etc/redhat-release ]; then
sudo dnf install git
fi
# if the os is ubuntu or debian
if [ -f /etc/debian_version ]; then
sudo apt update
sudo apt install git
fi
# if the os is macOS,
if [ -f /usr/bin/sw_vers ]; then
brew install git
fi
# -----------------------------------Rust------------------------------------
# Install rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source $HOME/.cargo/env
# -----------------------------------Python----------------------------------
# Install pipx and poetry
cd python
chmod +x ./install.sh # Prevent permission denied error
sh ./install.sh
cd ..
# ---------------------------------Alacritty---------------------------------
# Install Alacritty if the user wants to
# if the os is fedora or redhat
if [ -f /etc/redhat-release ]; then
if [ $DO_INSTALL_ALACRITTY = true ]; then
sudo dnf install alacritty
# Update desktop entries
sudo update-desktop-database
# Set Alacritty as the default terminal
sudo update-alternatives --config x-terminal-emulator
fi
fi
# if the os is ubuntu or debian
if [ -f /etc/debian_version ]; then
if [ $DO_INSTALL_ALACRITTY = true ]; then
sudo apt update
sudo apt install alacritty -y
# Update desktop entries
sudo update-desktop-database
# Set Alacritty as the default terminal
sudo update-alternatives --config x-terminal-emulator
fi
fi
# if the os is macOS,
if [ -f /usr/bin/sw_vers ]; then
if [ $DO_INSTALL_ALACRITTY = true ]; then
brew install alacritty
fi
fi
# ------------------------------------Zellij---------------------------------
# if the os is fedora or redhat
if [ -f /etc/redhat-release ]; then
sudo dnf copr enable varlad/zellij -y
sudo dnf install zellij
fi
# if the os is ubuntu or debian
if [ -f /etc/debian_version ]; then
sudo apt install zellij -y
fi
# if the os is macOS,
if [ -f /usr/bin/sw_vers ]; then
brew install zellij
fi
# -----------------------------------Starship--------------------------------
brew install starship
# -----------------------------------ripgrep---------------------------------
# Ripgrep (grep command replacement)
brew install ripgrep
# -------------------------------------bat-----------------------------------
# Bat (cat command replacement)
brew install bat
brew install eth-p/software/bat-extras-prettybat # Prettybat (bat plugin): colorizes the output of bat
brew install eth-p/software/bat-extras-batman # Batman (bat plugin): read man pages with bat
brew install eth-p/software/bat-extras-batgrep # Batgrep (bat plugin): search for a pattern in files using bat. Requires ripgrep
# ----------------------------------Nerd Fonts-------------------------------
# Nerd Font (LiberationMono)
# Download the font to tmp dir
curl -Lo "/tmp/LiberationMono.zip" "https://github.com/ryanoasis/nerd-fonts/releases/download/v3.2.0/LiberationMono.zip"
# Unzip and move the font to the fonts dir. Updates the fonts if they already exist.
# Linux
if [ "$(uname -s)" = "Linux" ]; then
unzip -o "/tmp/LiberationMono.zip" -d "~/.local/share/fonts"
fc-cache -f -v # Update the font cache
fi
# macOS
if [ "$(uname -s)" = "Darwin" ]; then
unzip -o "/tmp/LiberationMono.zip" -d "/Library/Fonts/"
fi
rm "/tmp/LiberationMono.zip" # Clean up
# ------------------------------------Node-----------------------------------
# Install node version manager
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
source ~/.zshrc
# Install latest lts version of node
nvm install --lts
# ------------------------------------PNPM-----------------------------------
# Install pnpm package manager
curl -fsSL https://get.pnpm.io/install.sh | sh -
# ------------------------------------Neovim---------------------------------
# Install Neovim and its dependencies
cd nvim
chmod +x ./install.sh # Prevent permission denied error
sh ./install.sh
cd ..
# ------------------------------------Brew upgrade---------------------------
# Upgrade all the installed software if the user wants to
if [ $DO_UPDATE_BREW = true ]; then
brew upgrade
fi
# -----------------------Restore configuration files-------------------------
# Execute the quick restore script
chmod +x restore.sh # Prevent permission denied error
sh ./restore.sh
# -----------------------------Clean up--------------------------------------
rm -rf ~/tmp