-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·211 lines (173 loc) · 5.01 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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
#!/bin/bash
DOTFILES_DIR="$HOME/.dotfiles"
FEATURES_FILE="$DOTFILES_DIR/features.sh"
get_debian_version() {
local version
version=$(cat /etc/debian_version)
if [[ $version == 11* ]]; then
echo "11"
elif [[ $version == 12* ]]; then
echo "12"
else
echo "unknown"
fi
}
print_info() {
echo -e "\033[0;036m$1\033[0m"
}
print_error() {
echo -e "\033[0;31m$1\033[0m"
}
print_success() {
echo -e "\033[0;032m$1\033[0m"
}
install_dependencies() {
sudo apt update
sudo apt install man curl ripgrep jq gcc gpg -y
}
install_oh_my_zsh() {
# Install Oh-My-Zsh
if [ ! -d "$HOME/.oh-my-zsh/" ]
then
print_info "Installing Oh-My-Zsh"
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
else
print_success "Oh-My-Zsh is already installed."
fi
}
install_nala() {
if ! command -v nala &> /dev/null
then
print_info "Nala is not installed. Installing now..."
debian_version=$(get_debian_version)
if [ "$debian_version" == "11" ]; then
print_info "Installing Nala for Debian 11"
curl -O https://gitlab.com/volian/volian-archive/uploads/b20bd8237a9b20f5a82f461ed0704ad4/volian-archive-keyring_0.1.0_all.deb
curl -O https://gitlab.com/volian/volian-archive/uploads/4ba4a75e391aa36f0cbe7fb59685eda9/volian-archive-scar_0.1.0_all.deb
sudo apt install -y ./volian-archive-*.deb
sudo apt install nala -y
rm -r ./volian-archive-*.deb
elif [ "$debian_version" == "12" ]; then
print_info "Installing Nala for Debian 12+..."
sudo apt install nala -y
else
print_error "Your Debian version is not supported for Nala installation."
fi
else
print_success "Nala is already installed."
fi
}
install_tmux() {
if ! command -v tmux &> /dev/null
then
print_info "Tmux is not installed. Installing now..."
sudo apt install tmux -y
else
print_success "Tmux is already installed"
fi
if ! command -v tmuxinator &> /dev/null
then
print_info "Tmuxinator is not installed. Installing now..."
brew install tmuxinator
else
print_success "Tmuxinator is already installed."
fi
}
install_zoxide() {
if ! command -v zoxide &> /dev/null
then
print_info "Zoxide is not installed. Installing now..."
curl -sS https://raw.githubusercontent.com/ajeetdsouza/zoxide/main/install.sh | bash
fi
if ! command -v fzf &> /dev/null
then
print_info "Fzf is not installed. Installing now..."
brew install fzf
fi
}
install_thefuck() {
if ! command -v fuck &> /dev/null
then
print_info "TheFuck is not installed. Installing now..."
brew install thefuck
fi
}
install_homebrew() {
if ! command -v brew &> /dev/null
then
print_info "Homebrew is not installed. Installing now..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
export PATH=/home/linuxbrew/.linuxbrew/bin/:$PATH
else
print_success "Homebrew is already installed."
fi
}
install_neovim() {
if ! command -v nvim &> /dev/null
then
print_info "Neovim is not installed. Installing now..."
brew install neovim lazygit
else
print_success "Neovim is already installed."
fi
}
enable_feature() {
local replacement="s/FEATURE_ENABLE_$1=false/FEATURE_ENABLE_$1=true/"
sed -i "$replacement" "$FEATURES_FILE"
}
print_info "Updating and upgrading your system..."
install_dependencies
install_homebrew
# Tmux
install_tmux
mkdir -p ~/.config/tmux/
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
install_zoxide
install_thefuck
install_nala
if ! command -v zsh &> /dev/null
then
print_info "ZSH is not installed. Installing now..."
sudo apt install zsh -y
else
print_success "ZSH is already installed."
fi
# Set ZSH as default shell
chsh -s $(which zsh)
install_oh_my_zsh
# NeoVim
install_neovim
git clone https://github.com/NvChad/NvChad ~/.config/nvim --depth 1
print_success "NVChad successfully installed."
# Linking neovim custom configs.
ln -s $DOTFILES_DIR/nvim/custom ~/.config/nvim/lua/custom
ln -s $DOTFILES_DIR/nvim/bin ~/bin
# Linking tmux configs.
ln -s $DOTFILES_DIR/tmux/tmux.conf ~/.config/tmux/tmux.conf
# Setting up the custom .zshrc file
rm ~/.zshrc
ln -s $DOTFILES_DIR/zshrc ~/.zshrc
ln -s $DOTFILES_DIR/zsh/themes ~/.oh-my-zsh/custom/themes/
cp "$DOTFILES_DIR/features.example.sh" "$DOTFILES_DIR/features.sh"
# Setting up variables to enable features
while [ "$#" -gt 0 ]; do
case "$1" in
--docker) enable_feature "DOCKER"; shift 1;;
--kubernetes) enable_feature "KUBERNETES"; shift 1;;
--dotnet) enable_feature "DOTNET"; shift 1;;
--firewalld) enable_feature "FIREWALLD"; shift 1;;
--1password) enable_feature "ONEPASSWORD"; shift 1;;
--arm) enable_feature "IS_ARM_BASED"; shift 1;;
esac
done
source "$FEATURES_FILE"
if [ "FEATURE_ENABLE_KUBERNETES" = "true" ]; then
brew install kubectl kubectx helm kube-ps1
fi
# Dotfiles are complete.
print_success "Dotfiles successfully installed."
if [ -z "$ZSH_VERSION" ]; then
exec zsh
else
source ~/.zshrc
fi