-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·242 lines (208 loc) · 6.95 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
#!/usr/bin/env bash
CRE=$(tput setaf 1)
CYE=$(tput setaf 3)
CGR=$(tput setaf 2)
CBL=$(tput setaf 4)
BLD=$(tput bold)
CNC=$(tput sgr0)
username=$(whoami)
backup_folder=~/.ricebkp
date=$(date +%Y%m%d-%H%M%S)
logo () {
local text="${1:?}"
printf "\n"
echo "██╗ ██╗███╗ ███╗██╗ ██╗ █████╗ ██╗ ██╗██╗███████╗";
echo "██║ ██║████╗ ████║██║ ██║██╔══██╗██║ ██║██║██╔════╝";
echo "██║ ██║██╔████╔██║██║ █╗ ██║███████║██║ ██║██║█████╗ ";
echo "╚██╗ ██╔╝██║╚██╔╝██║██║███╗██║██╔══██║╚██╗ ██╔╝██║██╔══╝ ";
echo " ╚████╔╝ ██║ ╚═╝ ██║╚███╔███╔╝██║ ██║ ╚████╔╝ ██║███████╗";
echo " ╚═══╝ ╚═╝ ╚═╝ ╚══╝╚══╝ ╚═╝ ╚═╝ ╚═══╝ ╚═╝╚══════╝";
printf "\n\n"
printf '%s%s%s%s%s%s%s' "${CRE}" "${text}"
}
logo "Welcome ${username}!"
printf '\n%s%sThis script will change your systems configuration files, and install some development tools of your choice.\n Although the backup will be made, it will only be your configurations, so only install it if you are completely sure of what you are doing.%s\n\n' "${BLD}" "${CRE}" "${CNC}"
while true; do
read -rp "Do you wish to continue? [y/N]: " yn
case $yn in
[Yy]* ) break;;
[Nn]* ) exit;;
* ) printf " Error: just write 'y' or 'n'\n\n";;
esac
done
clear
logo "Backup files"
printf "Backup files will be stored in ${backup_folder} \n\n" "${BLD}" "${CRE}" "$HOME" "${CNC}"
sleep 10
if [ ! -d "$backup_folder" ]; then
mkdir -p "$backup_folder"
fi
for folder in alacritty bspwm lvim polybar rofi sxhkd picom; do
if [ -d "$HOME/.config/$folder" ]; then
mv "$HOME/.config/$folder" "$backup_folder/${folder}_$date"
echo "$folder folder backed up successfully at $backup_folder/${folder}_$date"
else
echo "The folder $folder does not exist in $HOME/.config/"
fi
done
[ -f ~/.zshrc ] && mv ~/.zshrc ~/${backup_folder}/.zshrc-backup-"$(date +%Y.%m.%d-%H.%M.%S)"
printf "%s%sDone!!%s\n\n" "${BLD}" "${CGR}" "${CNC}"
sleep 5
clear
logo "Installing needed packages.."
dependencias=(base-devel rustup pacman-contrib bspwm polybar sxhkd \
alacritty brightnessctl neovim dunst rofi lsd stalonetray \
jq polkit-gnome git playerctl mpd xclip \
geany ranger mpc xdo xdotool jgmenu \
feh ueberzug maim pamixer libwebp xdg-user-dirs \
webp-pixbuf-loader xorg-xprop xorg-xkill physlock papirus-icon-theme \
ttf-jetbrains-mono ttf-jetbrains-mono-nerd ttf-terminus-nerd ttf-inconsolata ttf-joypixels \
zsh zsh-autosuggestions zsh-history-substring-search zsh-syntax-highlighting \
imagemagick xorg-xdpyinfo xorg-xsetroot xorg-xwininfo xorg-xrandr meson ninja)
is_installed() {
pacman -Qi "$1" &> /dev/null
return $?
}
printf "%s%s\nChecking for required packages...%s\n" "${BLD}" "${CBL}" "${CNC}"
for paquete in "${dependencias[@]}"
do
if ! is_installed "$paquete"; then
sudo pacman -S "$paquete" --noconfirm
printf "\n"
else
printf '%s%s is already installed on your system!%s\n' "${CGR}" "$paquete" "${CNC}"
sleep 1
fi
done
sleep 3
clear
logo "Installing paru"
rustup default stable
git clone https://aur.archlinux.org/paru.git
cd paru
makepkg -si
cd ..
rm -rf paru
sleep 5
clear
logo "Installing packages, select the best option for the packages listed"
paru -a picom-git
paru -a google-chrome
paru -a visual-studio-code-bin
paru -a betterlockscreen
bash <(curl -s https://raw.githubusercontent.com/lunarvim/lunarvim/master/utils/installer/install.sh)
sleep 5
clear
logo "Installing dotfiles.."
printf "Copying files to respective directories..\n"
[ ! -d ~/.config ] && mkdir -p ~/.config
[ ! -d ~/.local/share/fonts ] && mkdir -p ~/.local/share/fonts
for files in dotfiles/home/.config/*; do
cp "${files}" ~/.config/
if [ $? -eq 0 ]; then
printf "%s%s%s folder copied succesfully!%s\n" "${BLD}" "${CGR}" "${files}" "${CNC}"
sleep 1
else
printf "%s%s%s failed to been copied, you must copy it manually%s\n" "${BLD}" "${CRE}" "${files}" "${CNC}"
sleep 1
fi
done
for files in dotfiles/misc/fonts/; do
cp "${files}" ~/.local/share/fonts/
if [ $? -eq 0 ]; then
printf "%s%s%s copied succesfully!%s\n" "${BLD}" "${CGR}" "${files}" "${CNC}"
sleep 1
else
printf "%s%s%s failed to been copied, you must copy it manually%s\n" "${BLD}" "${CRE}" "${files}" "${CNC}"
sleep 1
fi
done
cp -f dotfiles/home/.zshrc ~/
fc-cache -rv >/dev/null 2>&1
printf "%s%sFiles copied succesfully!!%s\n" "${BLD}" "${CGR}" "${CNC}"
sleep 3
echo ""
logo "Select the necessary development environments:"
echo ""
source utils/checkbox.sh "android-sdk" "react" "flutter" "vuejs" "php" "nodejs"
printf "\n"
android_sdk=false;
react=false;
flutter=false;
vuejs=false;
php=false;
nodejs=false;
for ((i = 0; i < max; i++)); do
if [ "$i" = 0 ] && [ "${selected[i]}" = true ]; then
android_sdk=true;
fi
if [ "$i" = 1 ] && [ "${selected[i]}" = true ]; then
react=true;
fi
if [ "$i" = 2 ] && [ "${selected[i]}" = true ]; then
flutter=true;
fi
if [ "$i" = 3 ] && [ "${selected[i]}" = true ]; then
vuejs=true;
fi
if [ "$i" = 4 ] && [ "${selected[i]}" = true ]; then
php=true;
fi
if [ "$i" = 5 ] && [ "${selected[i]}" = true ]; then
nodejs=true;
fi
done
sleep 5
clear
if [ $android_sdk == true ];then
logo "Setuping android-sdk environment..."
sudo pacman -S jdk17-openjdk
archlinux-java set java-17-openjdk
paru -a android-studio
sleep 5
clear
fi
if [ $react == true ];then
logo "Setuping react-js/react-native environment (for react-native emulator use android-sdk option)..."
sudo pacman -S nodejs npm yarn
paru -a nvm
sudo npm install -g typescript --save-dev
sleep 5
clear
fi
if [ $flutter == true ];then
logo "Setuping flutter environment (for emulator use android-sdk option).."
paru -a flutter
sleep 5
clear
fi
if [ $vuejs == true ];then
logo "Setuping vuejs environment..."
sudo pacman -S nodejs npm yarn
paru -a nvm
sudo npm install -g @vue/cli
sleep 5
clear
fi
if [ $php == true ];then
logo "Setuping php environment..."
sudo pacman -S nodejs npm yarn
paru -a php72
paru -a php72-fpm
paru -a php72-xdebug
sudo pacman -S nginx
sudo systemctl enable php72-fpm
sudo systemctl enable nginx
cp dotfiles/misc/nginx/nginx.conf /etc/nginx/
cp dotfiles/misc/php/40-xdebug.ini /etc/php72/conf.d/
sleep 5
clear
fi
if [ $nodejs == true ];then
logo "Setuping nodejs environment..."
sudo pacman -S nodejs npm yarn
paru -a nvm
paru -a postman-bin
sleep 5
clear
fi