-
Notifications
You must be signed in to change notification settings - Fork 1
/
arch
321 lines (290 loc) · 10.9 KB
/
arch
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
#!/bin/bash
# set -x # Enables printing of all commands
echo "Do you want to have everything run automatically? (Yes/No)"
read master_answer
# Change hostname
echo "Before we begin, do you want to change your hostname? (Y/N)"
read download_package
if [[ ${download_package,,} == "y" ]]; then
echo "Please enter your desired hostname:"
read desired_hostname
echo "Changing hostname to $desired_hostname"
sudo hostnamectl set-hostname "$desired_hostname" || echo "Failed to change hostname"
fi
# List of available browsers
browsers=("Firefox" "Chromium" "Tor Browser" "Vivaldi" "Haskell" "Librewolf" "Opera" "SKIP")
echo "Available browsers:"
for ((i = 0; i < ${#browsers[@]}; i++)); do
echo "$((i + 1)). ${browsers[i]}"
done
# Prompt user for selection
read -p "Enter the number(s) corresponding to your choice(s), separated by spaces (for example, "1 3 4 6"): " selected_indices
# Convert selected_indices to an array of integers
selected_indices=($selected_indices)
# Download selected browsers
for index in ${selected_indices[@]}; do
browser="${browsers[index - 1]}"
case "$browser" in
"Firefox") # Download Firefox
echo "Downloading Firefox..."
sudo pacman -S --noconfirm firefox || echo "Failed to download Firefox"
;;
"Chromium") # Download Chromium
echo "Downloading Chromium..."
sudo pacman -S --noconfirm chromium || echo "Failed to download Chromium"
;;
"Tor Browser") # Download Tor Browser
echo "Downloading Tor Browser..."
sudo pacman -S --noconfirm torbrowser-launcher || echo "Failed to download Tor Browser"
;;
"Vivaldi") # Download Vivaldi
echo "Downloading Vivaldi..."
sudo pacman -S --noconfirm vivaldi || echo "Failed to download Vivaldi"
;;
"Haskell") # Download Haskell
echo "Downloading Haskell..."
sudo pacman -S --noconfirm haskell-open-browser || echo "Failed to download Haskell"
;;
"Librewolf") # Download Librewolf
echo "Downloading librewolf..."
git clone https://gitlab.com/librewolf-community/browser/arch.git || echo "Failed to download Librewolf"
cd arch/
gpg --recv-key EBE41E90F6F12F6D
makepkg -si
cd ..
;;
"Opera") # Download Opera
echo "Downloading Opera..."
sudo pacman -S --noconfirm opera || echo "Failed to download Opera"
;;
"SKIP") # Skip
echo "Skipping browser installation..."
;;
*)
echo "Invalid selection: $browser"
;;
esac
done
echo "Finished!"
# Updates packages
echo "Updating packages - required"
sudo pacman -Syu --noconfirm
echo "All packages updated sucessfully"
# Downloads required packages
echo "downloading neccesary packages - required"
# git
echo "Downloading git"
sudo pacman -S --noconfirm git
# yay
echo "Downloading yay"
sudo pacman -Syu --noconfirm --needed base-devel git
git clone https://aur.archlinux.org/yay.git
cd yay
gpg --recv-key EBE41E90F6F12F6D
makepkg -si
cd ..
# snapd
echo "Downloading snapd"
git clone https://aur.archlinux.org/snapd.git
cd snapd
makepkg -si
sudo systemctl enable --now snapd.socket
sudo ln -s /var/lib/snapd/snap /snap
# Creating master_answer function data
if [[ ${master_answer,,} = "yes" ]]; then
auto_confirm=true
echo "starting automatic setup"
elif [[ ${master_answer,,} = "no" ]]; then
echo "starting manual setup" ||
auto_confirm=false
fi
# making user directories
if [[ ${master_answer,,} = "yes" ]]; then
echo "Making user directories"
sudo pacman -S --noconfirm xdg-user-dirs
xdg-user-dirs-update
elif [[ ${master_answer,,} = "no" ]]; then
echo "Would you like to add user directories? (Y/N)"
read download_answer
if [[ ${download_answer,,} = "y" || $download_answer = "" ]]; then
echo "Making user directories"
sudo pacman -S --noconfirm xdg-user-dirs
xdg-user-dirs-update
elif [[ ${download_answer,,} = "n" ]]; then
echo "Skipping user directories"
else
echo "Invalid input. Please enter a valid input"
fi
fi
# edits pacman config file for parallel downloads
if [[ ${master_answer,,} = "yes" ]]; then
echo "Configuring pacman parallel downloads"
# Back up OG file
sudo cp /etc/pacman.conf /etc/pacman.conf.bak || { echo "Failed to copy pacman .conf file"; exit 1; }
# Uncomment Parallel Downloads line
sudo sed -i '/ParallelDownloads/c\ParallelDownloads=5' /etc/pacman.conf || echo "Failed to eonfigure pacman parallel downloads"
elif [[ ${master_answer,,} = "no" ]]; then
echo "Would you like to configure pacman parallel downloads? (Y/N)"
read download_answer
if [[ ${download_answer,,} = "y" || $download_answer = "" ]]; then
echo "Configuring pacman parallel downloads"
sudo cp /etc/pacman.conf /etc/pacman.conf.bak || { echo "Failed to copy pacman .conf file"; exit 1; }
# Uncomment Parallel Downloads line
sudo sed -i '/ParallelDownloads/c\ParallelDownloads=5' /etc/pacman.conf || echo "Failed to eonfigure pacman parallel downloads"
elif [[ ${download_answer,,} = "n" ]]; then
echo "Download cancelled"
else
echo "Invalid input. Please enter a valid input"
fi
fi
# Downloading essential packages
if [[ ${master_answer,,} = "yes" ]]; then
echo "Downloading essential packages"
sudo pacman -S --noconfirm enchant mythes-en ttf-liberation hunspell-en_US ttf-bitstream-vera pkgstats adobe-source-sans-pro-fonts gst-plugins-good ttf-droid ttf-dejavu aspell-en icedtea-web gst-libav ttf-ubuntu-font-family ttf-anonymous-pro jre8-openjdk languagetool libmythes pip
echo "Essential packages downloaded sucessfully"
elif [[ ${master_answer,,} = "no" ]]; then
echo "Would you like to download essential packages? (Y/N)"
read download_answer
if [[ ${download_answer,,} = "y" || $download_answer = "" ]]; then
echo "Downloading essential packages"
sudo pacman -S --noconfirm enchant mythes-en ttf-liberation hunspell-en_US ttf-bitstream-vera pkgstats adobe-source-sans-pro-fonts gst-plugins-good ttf-droid ttf-dejavu aspell-en icedtea-web gst-libav ttf-ubuntu-font-family ttf-anonymous-pro jre8-openjdk languagetool libmythes pip
elif [[ ${download_answer,,} = "n" ]]; then
echo "Skipping essential packages"
else
echo "Invalid input. Please enter a valid input"
fi
fi
# Microcode install
# Function to detect CPU brand
if [[ ${master_answer,,} = "yes" ]]; then
get_cpu_brand() {
local vendor
vendor=$(lscpu | grep "Vendor ID" | awk '{print $3}')
echo "$vendor"
}
# Install microcode based on brand
case "$cpu_brand" in
"GenuineIntel")
sudo pacman -S --noconfirm intel-ucode
echo "Downloading Intel Microcode..."
;;
"AuthenticAMD")
sudo pacman -S --noconfirm amd-ucode
echo "Downloading AMD Microcode..."
;;
*)
echo "Unknown CPU brand. Skipping microcode installation."
;;
esac
fi
if [[ ${master_answer,,} = "no" ]]; then
echo "Would you like to download CPU Microcode? (Y/N)"
read download_answer
if [[ ${download_answer,,} = "y" || $download_answer = "" ]]; then
# Downloading Microcode
echo "CPU brand:"
echo "1. Intel"
echo "2. AMD"
echo "3. SKIP"
read -p "Enter the number corresponding to your CPU manufacturer: " selected_index
case "$selected_index" in
1)
brand="Intel"
sudo pacman -S --noconfirm intel-ucode
echo "Downloading Intel Microcode..."
;;
2)
brand="AMD"
sudo pacman -S --noconfirm amd-ucode
echo "Downloading AMD Microcode..."
;;
3)
brand="SKIP"
echo "Skipping Microcode installation."
;;
*)
echo "Invalid selection"
;;
esac
echo "Detected CPU brand: $brand"
fi
elif [[ ${download_answer,,} = "n" ]]; then
echo "Skipping Micrcode"
else
echo "Invalid input. Please enter a valid input"
fi
# Disable GRUB delay
if [[ ${master_answer,,} = "yes" ]]; then
echo "Lowering GRUB boot menu time"
sudo sed -i 's/GRUB_TIMEOUT=[0-9]\+/GRUB_TIMEOUT=-1/' /etc/default/grub
sudo update-grub
fi
if [[ ${master_answer,,} = "no" ]]; then
echo "Would you liketo disable 5 second GRUB menu on boot (can be reaccesed by holding 'esc' during boot)?"
read download_answer
if [[ ${download_answer,,} = "y" || $download_answer = "" ]]; then
echo "Lowering GRUB boot menu time"
sudo sed -i 's/GRUB_TIMEOUT=[0-9]\+/GRUB_TIMEOUT=-1/' /etc/default/grub
sudo update-grub
fi
elif [[ ${download_answer,,} = "n" ]]; then
echo "Skipping GRUB boot menu time Configuring"
else
echo "Invalid input. Please enter a valid input"
fi
# List of packages
packages=("gparted" "libreoffice-fresh" "filezilla" "pulseaudio" "vim" "nvim" "nano" "discord" "gimp" "thunderbird" "vlc" "yay")
# downloads all the packages
for package in "${packages[@]}"; do
if [[ ${master_answer,,} = "no" ]]; then
echo "Do you want to download $package? (Y/N)"
read download_answer
if [[ ${download_answer,,} = "y" || $download_answer = "" ]]; then
echo "Downloading $package..."
sudo pacman -S --noconfirm $package || echo "Failed to download $package"
fi
elif [[ ${master_answer,,} = "yes" ]]; then
echo "Downloading $package..."
sudo pacman -S --noconfirm $package || echo "Failed to download $package"
elif [[ ${download_answer,,} == "n" ]]; then
echo "Skipping $package"
continue
else
echo "Invalid input. Please enter a valid input."
fi
done
# Multimedia codecs
if [[ ${master_answer,,} = "no" ]]; then
echo "Do you want to install Multimedia Codecs? (Y/N)"
read download_package
if [[ ${download_package,,} != "n" ]]; then
echo "Installing Multimedia Codecs"
sudo pacman -S --noconfirm a52dec faac faad2 flac jasper lame libdca libdv libmad libmpeg2 libtheora libvorbis libxv wavpack x264 xvidcore gstreamer0.10-plugins || echo "Failed to install a codec"
fi
echo "Multimedia Codecs successfully installed"
fi
if [[ ${master_answer,,} = "yes" ]]; then
echo "Installing multimedia codecs"
sudo pacman -S --noconfirm a52dec faac faad2 flac jasper lame libdca libdv libmad libmpeg2 libtheora libvorbis libxv wavpack x264 xvidcore gstreamer0.10-plugins || echo "Failed to install a codec"
echo "Multimedia Codecs successfully installed"
fi
# Updates packages
echo "Updating packages"
sudo pacman -Syu --noconfirm
# Reboots to set in changes
if [[ ${master_answer,,} = "no" ]]; then
echo "Would you like to reboot to apply/view changes? (Y/N)"
read download_package
if [[ ${download_package,,} = "y" || $download_answer = "" ]]; then
echo "Rebooting"
reboot || echo "Failed to reboot"
fi
fi
if [[ ${download_package,,} = "y" ]];
echo "Setup is complete! It is reccomended you restart soon to see all changes"
fi
if [[ ${master_answer,,} = "yes" ]]; then
echo "Rebooting"
reboot || echo "Failed to reboot"
fi
chmod +x "$0"