-
Notifications
You must be signed in to change notification settings - Fork 2
/
install.sh
executable file
·417 lines (311 loc) · 10.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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
#!/bin/bash
# Stop on errors
set -e
# Make a base path
user=$(echo $USER)
userHome=$(echo $HOME)
basePath="$userHome/chara-dotfiles"
mkdir -p $basePath && cd $basePath
# Adding user to sudoers
sudo usermod -aG sudo $user
# do a global system update
echo "Running system update..."
sudo apt update -y && sudo apt upgrade -y
echo "Checking for git installation..."
# Checking to see if git path is registered
case "$(which git 2> /dev/null)" in
"")
echo "Git not detected, installing git..."
sudo apt install -y git;;
"/usr/bin/git") echo "Git already installed, moving to the next step...";;
esac
# Clone the repository
git clone https://github.com/CharaD7/chara-dotfiles.git .
# .gitconfig setup function
setGitConfig () {
echo "Installing prerequisites..."
sudo apt install -y curl \
gnupg ca-certificates \
gcc-multilib g++-multilib cmake libssl-dev pkg-config \
libfreetype6-dev libasound2-dev libexpat1-dev libxcb-composite0-dev \
libbz2-dev libsndio-dev freeglut3-dev libxmu-dev libxi-dev libfontconfig1-dev \
libxcursor-dev dunst flameshot simplescreenrecorder lxappearance
# Ask to use repo's gitconfig
read -p "Would you like to use repo's gitconfig aliases? [Y,n]: " gitAliases
if [ "$gitAliases" == "y" ] || [ "$gitAliases" == "Y" ]; then
# Configure git
cp -r .gitconfig $userHome/.gitconfig
alias g=git
sleep 1
fi
# Setting up gitconfig with alias
read -p "Would you like to setup your gitconfig now? [Y,n]: " gitConfigReply
if [ "$gitConfigReply" == "y" ] || [ "$gitConfigReply" == "Y" ]; then
# Configure git
read -p "Enter your git username: " gitUsername
read -p "Enter your git email address: " gitEmail
echo "Setting your global git username to '$gitUsername'"
git config --global user.name "$gitUsername"
echo "Setting your global git email to '$gitEmail'"
git config --global user.email "$gitEmail"
fi
sleep 1
echo "Your git command is now aliased 'g'"
echo "You can run 'g cn' to check your global git username and 'g ce' to check your global git email address."
sleep 1
echo "Copying global gitignore and git template message to home directory"
cp -rf .gitignore_global gitmessage.txt $userHome/
sleep 1
}
# Dunst and bat
setDunstConfig() {
dunstPath="$userHome/.config/dunst/"
mkdir -p $dunstPath
# Prep dunst configuration
echo "Prepping dunst configuration"
cp -rf dunst $userHome/.config/
sleep 1
# Install batcat and assign to alias "bat"
read -p "Would you like to install batcat, a more intuitive version of cat, now? [Y,n]: " batReply
if [ "$batReply" == "y" ] || [ "$batReply" == "Y" ]; then
echo "Installing batcat..."
sudo apt install batcat -y
# Set batcat alias to bat
alias bat=batcat
sleep 1
fi
}
# Fish terminal config setup function
setFishConfig() {
fishPath="$userHome/.config/fish/"
mkdir -p $fishPath
echo "Installing fish shell..."
sudo apt install fish -y
curl https://raw.githubusercontent.com/oh-my-fish/oh-my-fish/master/bin/install | bash
sleep 1
echo "Installing prerequisites for exa..."
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
echo "Adding cargo bin path to environment variables"
export PATH="$userHome/.cargo/bin:$PATH"
sleep 1
echo "Checking system path for wget..."
case "$( which wget 2> /dev/null )" in
"") sudo apt install wget -y;;
"/usr/bin/wget") echo "wget installed, moving to the next step...";;
esac
wget https://github.com/ogham/exa/archive/refs/heads/master.zip
mv master.zip exa.zip
sleep 1
echo 'Checking for unzip install path'
# Checking to see if path is registered
case "$( which unzip 2> /dev/null)" in
"") sudo apt install -y unzip;;
"/usr/bin/unzip") echo "Unzip already installed, moving to the next step...";;
esac
exaHome="$userHome/exa/"
mkdir -p $exaHome
unzip exa.zip -d $exaHome
cd $exaHome/exa-master/
cargo build --release
sudo cp -r target/release/exa /usr/bin/exa
echo "Copying fish configuration files to $fishPath..."
cd $basePath
cp -rf fish/* $fishPath
}
# Tmux terminal config setup function
setTmuxConfig() {
echo "Installing tmux essentials..."
sudo apt install -y python3 python3-pip powerline
echo "Installing tmux"
sudo apt install -y tmux
echo "Copying config files for tmux powerline setup..."
sudo cp -r powerline-config /usr/bin/powerline-config
cp -r .tmux.conf $userHome/.tmux.conf
cp -r .tmux.powerline.conf $userHome/.tmux.powerline.conf
echo "Setting system default shell to tmux"
sudo chsh -s $(which tmux)
echo "Changing to fish shell..."
tmux
omf install agnoster
omf theme agnoster
ech "Adding cargo bin directory to fish path..."
fish_add_path ~/.cargo/bin/
sleep 1
echo "Reverting to bash shell"
bash
}
# Bubbly config setup function
setBubblyConfig() {
# Install bubbly on user request
read -p "Would you like to install the bubbly chat widget now? [Y,n]: " bubblyReply
if [ "$bubblyReply" == "y" ] || [ "$bubblyReply" == "Y" ]; then
# Copy local content to ~/.loca/share/
echo "Setting up bubbly..."
bubblyDir="$userHome/.local/share/bubbly/"
mkdir -p $bubblyDir
echo "Copying bubbly files to respective directories"
cp -r bubbles/local/* $bubblyDir
bubblyHome="$userHome/.config/bubbly/"
mkdir -p $bubblyHome
cp -r bubbles/config/* $bubblyHome
# Register desktop application
echo "Registering desktop bubbly application"
cp -r bubbles/bubbly.desktop $userHome/.local/share/applications/
sleep 1
echo "Setup will now attempt to add you as member of the video group to allow you change screen brightness using the dashboard."
# Ask to accept adding to video group
read -p "Would you like setup to add you to video group? [Y,n]: " videoResult
if [ "$videoResult" == "y" ] || [ "$videoResult" == "Y" ]; then
# Add the user
sudo gpasswd video -a $(whoami)
# Add backlight rule to '/etc/udev/rules/' path
sudo cp -r backlight.rules /etc/udev/rules.d/backlight.rules
echo "User added. Setup will now continue with the remaining steps."
fi
else
echo "Skipping bubbly installation..."
fi
}
# Neovim installation
installNeovim() {
cd $userHome/Downloads/
sleep 1
# Download the image fil
echo "Downloading neovim image..."
curl -LO https://github.com/neovim/neovim/releases/latest/download/v0.10.0/nvim.appimage
chmod u+x nvim.appimage
sleep 1
# Exctract the files
echo "Extracting the image file"
./nvim.appimage --appimage-extract
# Exposing the executable globally
echo "Moving and registering Neovim globally..."
sudo mv squashfs-root ~
sudo ln -s ~/squashfs-root/AppRun /usr/bin/nvim
if [ "$( nvim --version 2> /dev/null )" != "" ]; then
echo "Done."
sleep 1
echo "Moving to the next step..."
cd $basePath
else
echo "There was a problem installing neovim"
fi
}
# Neovide config setup function
setNeovideConfig() {
# Configure neovim on user request
read -p "Would you like to configure the neovim IDE now? [Y,n]: " nvimReply
if [ "$nvimReply" == "y" ] || [ "$nvimReply" == "Y" ]; then
sleep 1
# Install nvim if it does not exist
echo "Checking for nvim installation..."
# Checking to see if nvim path is registered
if [ "$(which nvim)" == "" ]; then
echo "Nvim not detected, installing nvim..."
installNeovim
else
# Check nvim version
nvimVersion=$(nvim --version | head -1 | grep -o '[0-9]\.[0-9]')
if (( $(echo "$nvimVersion < 0.9 " |bc -l) )); then
echo "Unsupported version installed. Removing version and installing a supported version"
sudo apt remove -y neovim
installNeovim
else
echo "Nvim version 0.9 or greater is installed. Moving to the next step."
fi
fi
# Copy neovim files to ~/.config/nvim
nvimPath="$userHome/.config/nvim/"
mkdir -p $nvimPath
echo "Copying neovim files to $nvimPath..."
cp -r nvim/* $nvimPath
# Ask to install neovide
read -p "Would you like to install NEOVIDE now? [Y,n]: " neovideReply
if [ "$neovideReply" == "y" ] || [ "$neovideReply" == "Y" ]; then
# Install neovide
fish && cargo install --git https://github.com/neovide/neovide && bash
cd $basePath
fi
else
echo "Skipping neovide installation..."
fi
}
# DWM config setup function
setDWMConfig() {
sleep 1
echo "Last step!"
# Install dwm
sleep 1
# Install prerequisites for Dynamic Window Manager (dwm)
echo "Installing prerequisites for dwm..."
sudo apt install -y libxext-dev libxcb1-dev libxcb-damage0-dev libxcb-dpms0-dev libxcb-xfixes0-dev libxcb-shape0-dev libxcb-render-util0-dev libxcb-render0-dev libxcb-randr0-dev libxcb-composite0-dev libxcb-image0-dev libxcb-present-dev libxcb-glx0-dev libpixman-1-dev libdbus-1-dev libconfig-dev libgl-dev libegl-dev libpcre2-dev libevdev-dev uthash-dev libev-dev libx11-xcb-dev meson
sudo apt install -y build-essential libx11-dev libxinerama-dev sharutils suckless-tools libxft-dev stterm curl libimlib2-dev
sleep 1
# Installing other tools
echo "Installing other necessary tools"
sudo apt install -y picom feh acpi rofi brightnessctl
sleep 1
echo "Installing dwm..."
sudo apt install -y dwm
sleep 1
echo "Copying necessary files"
ewwHome="$userHome/.config/eww/"
mkdir -p $ewwHome
cp -r eww/ $ewwHome
picomHome="$userHome/.config/picom/"
mkdir -p $picomHome
cp -r picom/ $picomHome
rofiHome="$userHome/.config/rofi/"
mkdir -p $rofiHome
cp -r rofi/ $rofiHome
dwmHome="$userHome/.config/dwm/"
mkdir -p $dwmHome
cp -r dwm/ $dwmHome
slockInstalled=$(which slock)
# Checking to see if slock path is registered
if [ "$($slockInstalled 2> /dev/null)" == "" ]; then
echo "slock not detected, installing slock..."
sudo apt install -y slock
else
echo "slock already installed, moving to the next step...";;
fi
# Copy the desktop session call to xsessions
sudo cp -r dwm.desktop /usr/share/xsessions/dwm.desktop
# Copy background pictures to the Pictures folder
picHome="$userHome/Pictures/wall/"
mkdir -p $picomHome
sleep 1
echo "Copying wallpapers to $picHome"
cp -r wall/* $picHome/
# Compile dwm files
echo "Compiling dwm configuration"
cd $dwmHome/dwm && sudo make install
xrdb merge $dwmHome/.Xresources
sleep 1
echo "Compile done"
# Ask to restart
read -p "Would you like to reboot now? [Y,n]: " rebootResult
if [ "$rebootResult" == "y" ] || [ "$rebootResult" == "Y" ]; then
# Reboot system
sudo reboot
fi
}
# Do git config task
setGitConfig
# Do dunst and bat task
setDunstConfig
# Do NerdFont installation task
echo "Installing NerdFonts..."
nerdFontHome="$userHome/.local/share/fonts"
mkdir -p $nerdFontHome
cp -r NerdFonts/* $nerdFontHome
# Do fish config task
setFishConfig
# Do tmux config task
setTmuxConfig
# Do bubbly config task
setBubblyConfig
# Do neovide config task
setNeovideConfig
# Do dwm config task
setDWMConfig