-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathautoInstall
More file actions
executable file
·517 lines (379 loc) · 26.8 KB
/
autoInstall
File metadata and controls
executable file
·517 lines (379 loc) · 26.8 KB
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
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
#!/usr/bin/env sh
#########################################################################################################################################################################################
## A U T O L I N U X B O O T S T R A P S C R I P T ##
#########################################################################################################################################################################################
# _ _ _ __ _ _ #
# /.\ _ _ FJ_ ____ FJ / J _ _ _ _ _ FJ LJ #
# //_\\ J | | LJ _| F __ J J | LFJ J ' \ J J | | L J \/ F #
# / ___ \ | | | || |-' | |--| | | | J L | |\\ | | | | | / \ #
# / L___J \ F L__J JF |__-.F L__J J F L_____ J L F L \ JJ F L__J J / /\ \ #
# J__L J__J\____,__\_____J\______/J________LJ__LJ__L \\J__LJ\____,__LJ__//\\__L #
# |__L J__|J____,__J_____FJ______F|________||__||__L J__| J____,__F|__/ \__| #
#########################################################################################################################################################################################
#########################################################################################################################################################################################
#-------------------------------#
## ### VARIABLES & FUNCTIONS ### ##
#-------------------------------#
trap 'lastCommand=$currentCommand; currentCommand=$BASH_COMMAND' DEBUG
trap 'echo $lastCommand' EXIT QUIT STOP ERR
pkgdir="/opt"
aurhelper="yay"
TITLE=' ~ Automate OS ~ '
mirlist="/etc/pacman.d/mirrorlist"
lmirlist="/etc/pacman.d/local-mirrorlist"
dotfiles="https://gitlab.com/a4to/dotfiles.git"
arch="$(uname -m)"
srcdir=$(cd $(dirname ${BASH_SOURCE[0]}) && pwd && echo)
area="$(curl -4 ifconfig.co/country-iso)"
bootid="$(lsblk|grep boot |sed 's/p.*$//;s/├─//;s/└─//'|sed 's/^/\/dev\//;s/$/\//')"
rmdblck="$([ -f /var/lib/pacman/db.lck ] && rm -rf /var/lib/pacman/db.lck)"
KERNELS=(
'1' 'linux '
'2' 'linux-lts '
'3' 'linux-hardened '
'4' 'linux-zen ')
EDITIONS=(
'1' 'DWM AutoLinux '
'2' 'Plasma AutoLinux '
'3' 'Plasma (KDE Desktop and Apps) '
'4' 'Gnome (Gnome Desktop and Apps) '
'5' 'Xfce (Xfce Desktop and Apps) '
'6' 'Bare ArchLinux (No Additional Packages) ')
installpkg(){ pacman --noconfirm --needed -S "$*" >/dev/null 2>&1 ; }
check_root(){ [ "$(id -u)" -ne 0 ] && err "Root priviledges are required to run this script!"; }
err(){ echo >&2 "$(tput bold; tput setaf 1)[-] ERROR: ${*}$(tput sgr0)" && $rmdblck ; exit 1337; }
newmirrors(){ \
dialog --title "$TITLE" --infobox " Testing fastest mirrors for most efficient downloads..." 4 50
mv /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup && reflector --sort rate -a48 -f20 -l20 -c 'ZA,US,UK,Germany,Netherlands' \
-p 'http,https' --save /etc/pacman.d/mirrorlist >/dev/null 2>&1 ; }
initmsg1(){ \
dialog --title " Welcome to Automate OS! " --msgbox "\\n Welcome, and thank you for choosing AutoLinux!\\n\\n This script will now install the AutoLinux edition of your choice.\\n" 9 80 ; }
whichedition(){
edition="$(dialog --title "$TITLE" --colors --menu " Please Select the AutoLinux Edition to Install :" 14 56 5 "${EDITIONS[@]}" 3>&1 1>&2 2>&3 3>&1)" ; }
initmsg2(){
dialog --colors --title " Please Note :" --yes-label " Lets Boogie! " --no-label " Lets not boogie :| " --yesno "\\n An Arch Linux, or Arch based system is required for the installation of AutoLinux.\\n\\n If you are running any other distrobution the installation will fail." 9 90 ; }
selKernel(){
kernel="$(dialog --colors --title "Kernel Selection" --menu " Please choose your kernel:\\n (If unsure, just select the default linux kernel)" 14 56 6 "${KERNELS[@]}" 3>&1 1>&2 2>&3 3>&1)" ; }
user_and_password() {
name=$(dialog --inputbox " Please enter a name for the user account: " 10 60 3>&1 1>&2 2>&3 3>&1) || exit 1
while ! echo "$name" | grep -q "^[a-z_][a-z0-9_-]*$"; do
name=$(dialog --no-cancel --inputbox "Username not valid. Give a username beginning with a letter, with only lowercase letters, - or _." 10 60 3>&1 1>&2 2>&3 3>&1)
done
pass1=$(dialog --no-cancel --passwordbox "Enter a password for that user:" 10 60 3>&1 1>&2 2>&3 3>&1)
pass2=$(dialog --no-cancel --passwordbox "Retype the password." 10 60 3>&1 1>&2 2>&3 3>&1)
while ! [ "$pass1" = "$pass2" ]; do
unset pass2
pass1=$(dialog --no-cancel --passwordbox "Passwords do not match.\\n\\nEnter password again." 10 60 3>&1 1>&2 2>&3 3>&1)
pass2=$(dialog --no-cancel --passwordbox "Retype password." 10 60 3>&1 1>&2 2>&3 3>&1)
done ; }
root_user_password(){
dialog --colors --title "$TITLE" --yes-label ' Change Root Password ' --no-label ' Keep Current Password ' --yesno "\\nWould you like to change the root password?\\n\\nIf this is a clean install and not an addition to an existing system, it is essential that you change the root password.\\n\\nChange root password?" 12 66 3>&1 1>&2 2>&3 3>&1 || return 0 ;
pass3=$(dialog --no-cancel --passwordbox "Enter a password for the root user:" 10 60 3>&1 1>&2 2>&3 3>&1)
pass4=$(dialog --no-cancel --passwordbox "Retype the password." 10 60 3>&1 1>&2 2>&3 3>&1)
while ! [ "$pass3" = "$pass4" ]; do
unset pass2
pass3=$(dialog --no-cancel --passwordbox "Passwords do not match.\\n\\nEnter password again." 10 60 3>&1 1>&2 2>&3 3>&1)
pass4=$(dialog --no-cancel --passwordbox "Retype password." 10 60 3>&1 1>&2 2>&3 3>&1)
done ; }
usercheck() { \
! { id -u "$name" >/dev/null 2>&1; } ||
dialog --colors --title "WARNING!" --yes-label " CONTINUE " --no-label " RETURN " --yesno "\nThe user '$name' already exists on this system. AutoLinux can install for this user, but will overwrite any existing configuration files existing on \\nthis users account. \\n\\nHowever, it will not overwrite any other user files, documents, videos, or personal files of any sorts.\\n\\nIrrespective, only click <CONTINUE> if you are certain you have backed up any wanted system 'config' files.\\n\\nThe users password will also be changed to the one you just provided." 17 85 ; }
preinstall() { \
dialog --title " The calm before the STORM!" --yes-label "CONTINUE" --no-label " EXIT " --yesno "\\nThe rest of the proccess is automated and might take a while, depending on your connection. \\n\\nSo sit back, relax and please do not stop the process if it seems stuck.\\nSome packages just take longer to compile than others.\\n\\n\\nReady when you are?" 14 82 ; }
adduserandpass() { \
dialog --infobox " Adding user \"$name\"..." 4 50
useradd -m "$name" >/dev/null 2>&1
usermod -aG wheel,audio,optical,video,kvm,network,adm "$name" && chown $name /home/"$name" >/dev/null 2>&1
export repodir="/home/$name/.local/src"; mkdir -p "$repodir"; chown -R "$name":wheel "$(dirname "$repodir")"
echo "$name:$pass1" | chpasswd >/dev/null 2>&1
unset pass1 pass2 ; }
setrootpass(){
dialog --infobox " Changing password for root user..." 4 50
[ -z "$pass3" ] && pass3="autolinux" ;
echo "root:$pass3" | chpasswd >/dev/null 2>&1
unset pass3 pass4 ; }
bootload(){
dialog --colors --title " Clean Install or Existing System? " --yes-label " Install GRUB! " --no-label " I have a bootloader. " --yesno "\\n Would you like AutoLinux to install the GRUB bootloader? \\n\\n If it is your first time installing an OS and you have not yet installed or \n configured a bootloader, then selecting 'yes' would be a required for the \n system to function or boot." 11 82 &&
loader="$?" ; }
addmirrors(){
dialog --colors --title " Additional Mirrors and Repositories " --yes-label " Yes, Add Them! " --no-label " No Thanks. " --yesno "\\n Would you like to add the additional Mirrors and Repositories to the build?\\n\\n These mirrors would be beneficial as they would give you access/availability to many extra\n resources and repositories to acquire packages and other software.\n\n\n NOTE: Adding these extra mirrors would also significantly speed up the installation process,\n since you will be downloading binary versions of most aur packages, instead of compiling \n everything from source." 15 100
yesmir="$?" ; }
chshell(){
chsh -s /bin/zsh >/dev/null 2>&1
chsh -s /bin/zsh "$name" >/dev/null 2>&1
sudo -u "$name" mkdir -p "/home/$name/.cache/zsh/" ; }
refreshkeys() { \
dialog --infobox "Refreshing Arch Keyring..." 4 40
pacman --noconfirm -S archlinux-keyring >/dev/null 2>&1
dialog --infobox "Updating Repos and Keys..." 4 40
for repo in core extra community multilib; do
grep -q "^\[$repo\]" /etc/pacman.conf || echo "[$repo]
Include = /etc/pacman.d/mirrorlist
" >> /etc/pacman.conf
done
pacman-key --init >/dev/null 2>&1
pacman-key --populate >/dev/null 2>&1
pacman -Syy >/dev/null 2>&1
}
addConcise(){
dialog --infobox "Adding Concise Keyring..." 4 40
yes|pacman-key --recv-key 81BACEEBC3EA26E127166E4A819BB92A9A48160E --keyserver keyserver.ubuntu.com >/dev/null 2>&1
yes|pacman-key --lsign-key 81BACEEBC3EA26E127166E4A819BB92A9A48160E >/dev/null 2>&1
yes|pacman -U 'https://gitlab.com/a4to/concise/-/raw/master/x86_64/concise-keyring-1.0.3-1-any.pkg.tar.zst' >/dev/null 2>&1
cat /etc/pacman.conf|grep -q "^\[concise\]"|| cat << EOF >>/etc/pacman.conf
[concise]
SigLevel = Required DatabaseOptional
Server = https://gitlab.com/a4to/\$repo/-/raw/master/\$arch
EOF
pacman-key --init >/dev/null 2>&1
pacman-key --populate >/dev/null 2>&1
pacman -Syy >/dev/null 2>&1
}
conciseRepos(){
dialog --stdout --title "$TITLE" --yes-label "Yes, Add Them!" --no-label "No Thanks." --yesno "\\n\\n Would you like to add the Concise mirrors and repositories to your build?\\n\\n\\nThese mirrors are highly recommended and would be very beneficial as they contain all the AutoLinux pre-compiled binaries as well as easy access to many more packages and other software.\n\nNOTE: Adding these mirrors would also significantly speed up the installation process,\nsince you will be downloading binary versions of most aur packages, instead of compiling \neverything from source." 18 95
yesConcise="$?" ; }
sudoers(){ echo -e "\n$*" >> /etc/sudoers ; }
gpudrivers(){ \
dialog --infobox " Detecting Graphics Card..." 4 40
local GPU="$(neofetch |grep GPU|sed 's/^\.*.s//' |cut -d" " -f2)"
case $GPU in
AMD) dialog --infobox " Installing AMD GPU Drivers..." 4 40
yes|pacman -S --needed xf86-video-amdgpu >/dev/null 2>&1 ;;
NVIDIA) dialog --infobox " Installing NVIDIA GPU Drivers..." 4 40
yes|pacman -S --needed nvidia-470xx-dkms nvidia-470xx-settings nvidia-470xx-utils >/dev/null 2>&1 ;;
Intel) dialog --infobox " Installing Intel GPU Drivers..." 4 40
yes|pacman -S --needed vulkan-intel xf86-video-intel intel-gpu-tools >/dev/null 2>&1 ;;
Radeon) dialog --infobox " Installing Radeon GPU Drivers..." 4 40
yes|pacman -S --needed opencl-mesa vulkan-raedon >/dev/null 2>&1 ;;
*) dialog --infobox " Unknown GPU Detected, Skipping GPU Driver Installation..." 4 40 && sleep 2 ;;
esac; unset x ; }
cpudrivers(){ \
dialog --infobox " Detecting CPU..." 4 40
local CPU="$(neofetch |grep CPU |sed 's/^\.*.s//' |cut -d" " -f2)"
case $CPU in
Intel) dialog --infobox " Installing Intel CPU Drivers..." 4 40
yes|pacman -S --needed intel-ucode >/dev/null 2>&1 ;;
AMD) dialog --infobox " Installing AMD CPU Drivers..." 4 40
yes|pacman -S --needed amd-ucode >/dev/null 2>&1 ;;
*) dialog --infobox " Unknown CPU Detected, Skipping CPU Driver Installation..." 4 40 ; sleep 2 ;;
esac ; unset x ; }
replacedir(){ \
dialog --infobox "Installing AutoLinux custom builds of '$(basename "$1")' ($n of $total). $2" 5 70
destdir="/usr/share"
clonename="$(basename "$1" .git)"
clonepath="$destdir/$clonename"
[ -e "$clonepath" ] && sudo mv $clonepath "$clonepath'-old'" ;
git clone "$1" $clonepath >/dev/null 2>&1
cd /tmp || return 1 ; }
archlinuxinstall(){
dialog --infobox "Installing "$1", an AUR helper..." 4 50
[ -d "$pkgdir"/"$1" ] && rm -rf "$pkgdir"/"$1" ;
sudo git clone --depth 1 https://aur.archlinux.org/"$1".git $pkgdir/"$1" >/dev/null 2>&1 ;
chown "$name":wheel $pkgdir/"$1" ||{ cd "$pkgdir/$1" || return 1 ; sudo -u "$name" git pull --force origin master;}
cd "$pkgdir/$1"&&sudo -u "$name" makepkg --noconfirm -si >/dev/null 2>&1 || return 1 ; cd /tmp ; }
maininstall(){
dialog --title "AutoLinux Installation" --infobox "Installing '$1' ($n of $total). $2" 5 70
installpkg "$1" ; }
gitinstall(){
progname="$(basename "$1" .git)"
dir="$repodir/$progname"
dialog --title "AutoLinux Installation" --infobox "Cloning and Building '$progname' ($n of $total). '$(basename "$1")' $2" 5 70
sudo -u "$name" git clone --depth 1 "$1" "$dir" >/dev/null 2>&1 || { cd "$dir" || return 1 ; sudo -u "$name" git pull --force origin master;}
cd "$dir" || exit 1
makepkg -sri >/dev/null 2>&1
cd /tmp || return 1 ; }
gitcompile(){
progname="$(basename "$1" .git)"
dir="$repodir/$progname"
dialog --title "AutoLinux Installation" --infobox "Installing the AutoLinux build of '$progname' ($n of $total). $(basename "$1") $2" 5 70
sudo -u "$name" git clone --depth 1 "$1" "$dir" >/dev/null 2>&1 || { cd "$dir" || return 1 ; sudo -u "$name" git pull --force origin master;}
cd "$dir" || exit 1
make >/dev/null 2>&1
make install >/dev/null 2>&1
cd /tmp || return 1 ; }
aurinstall(){ \
dialog --title "AutoLinux Installation" --infobox "Installing '$1' ($n of $total) from the AUR. $2" 5 70
echo "$aurinstalled" | grep -q "^$1$" && return 1
sudo -u "$name" $aurhelper -S --noconfirm "$1" >/dev/null 2>&1
}
pipinstall(){ \
dialog --title "AutoLinux Installation" --infobox "Installing the Python package '$1' ($n of $total). $2" 5 70
[ -x "$(command -v "pip")" ] || installpkg python-pip >/dev/null 2>&1
yes | pip install "$1" ; }
installationloop(){ \
([ -f "$pkgsfile" ] && cp "$pkgsfile" /tmp/editions.csv) || curl -Ls "$pkgsfile" | sed '/^#/d' > /tmp/editions.csv
total=$(wc -l < /tmp/editions.csv)
aurinstalled=$(pacman -Qqm)
while IFS=, read -r tag program comment; do
n=$((n+1))
echo "$comment" | grep -q "^\".*\"$" && comment="$(echo "$comment" | sed "s/\(^\"\|\"$\)//g")"
case "$tag" in
"A") aurinstall "$program" "$comment" ;;
"M") gitinstall "$program" "$comment" ;;
"G") gitcompile "$program" "$comment" ;;
"P") pipinstall "$program" "$comment" ;;
"R") replacedir "$program" "$comment" ;;
*) maininstall "$program" "$comment" ;;
esac
done < /tmp/editions.csv ; }
placeconfigs() {
dialog --infobox " Downloading and installing config files..." 4 60
branch="$configChoice" ; dir=$(mktemp -d)
[ ! -d "$2" ] && mkdir -p "$2"
chown "$name":wheel "$dir" "$2"
sudo -u "$name" git clone --recursive -b "$branch" --depth 1 --recurse-submodules "$1" "$dir" >/dev/null 2>&1
sudo -u "$name" cp -rfT "$dir" "$2" ; }
systembeepoff() { dialog --infobox "Getting rid of that retarded error beep sound..." 4 40
rmmod pcspkr >/dev/null 2>&1 & echo "blacklist pcspkr" > /etc/modprobe.d/nobeep.conf >/dev/null 2>&1 ; sleep 2 ; }
promptfix(){ \
dialog --infobox " Fixing Shell Syntax Coloring Issue..." 4 45
pacman -R lolcat --noconfirm >/dev/null 2>&1
sudo -u $name paru -S --noconfirm python-lolcat >/dev/null 2>&1 ; }
mirrors(){
cd /tmp
dialog --infobox " Adding ArcoLinux Mirrors and Keys..." 4 50
sudo wget https://github.com/arcolinux/arcolinux_repo/raw/master/x86_64/arcolinux-keyring-20230919-6-any.pkg.tar.zst -O /tmp/arcolinux-keyring-20230919-6-any.pkg.tar.zst >/dev/null 2>&1
yes |sudo pacman -U --noconfirm --needed /tmp/arcolinux-keyring-20230919-6-any.pkg.tar.zst >/dev/null 2>&1
sudo wget https://raw.githubusercontent.com/arcolinux/arcolinux-mirrorlist/master/etc/pacman.d/arcolinux-mirrorlist -O /etc/pacman.d/arcolinux-mirrorlist >/dev/null 2>&1
sed -i '/arcolinux_repo/{N;d}' /etc/pacman.conf; sed -i '/arcolinux_repo_3party/{N;d}' /etc/pacman.conf; sed -i '/arcolinux_repo_xlarge/{N;d}' /etc/pacman.conf ;
echo -e "[arcolinux_repo]\nInclude = /etc/pacman.d/arcolinux-mirrorlist\n\n[arcolinux_repo_3party]\nInclude = /etc/pacman.d/arcolinux-mirrorlist\n\n[arcolinux_repo_xlarge]\nInclude = /etc/pacman.d/arcolinux-mirrorlist\n" >> /etc/pacman.conf ;
dialog --infobox " Adding Chaotic Mirrors and Keys..." 4 50 &&
yes|pacman-key --recv-key FBA220DFC880C036 --keyserver keyserver.ubuntu.com >/dev/null 2>&1
yes|pacman-key --lsign-key FBA220DFC880C036 >/dev/null 2>&1
yes|pacman -U \
'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-keyring.pkg.tar.zst' >/dev/null 2>&1 \
'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-mirrorlist.pkg.tar.zst' >/dev/null 2>&1 &&
sed -i '/chaotic-aur/{N;d}' /etc/pacman.conf
echo -e "[chaotic-aur]\nInclude = /etc/pacman.d/chaotic-mirrorlist\n" >> /etc/pacman.conf ;
dialog --infobox " Adding BlackArch Mirrors and Keys..." 4 50 &&
curl -LO blackarch.org/strap.sh >/dev/null 2>&1 &&
echo 46f035c31d758c077cce8f16cf9381e8def937bb strap.sh | sha1sum -c >/dev/null 2>&1 &&
chmod +x strap.sh ; sudo sh strap.sh >/dev/null 2>&1 &&
dialog --infobox " Updating System Keys and Mirrors..." 4 50
yes|pacman -Syyu >/dev/null 2>&1 ; }
system_config(){ \
dialog --infobox "Setting System Information..." 4 40 ; sleep 2
case $edition in
1) systemctl enable mpd.service >/dev/null 2>&1 ; systemctl enable NetworkManager.service >/dev/null 2>&1 ;;
2) systemctl enable sddm.service >/dev/null 2>&1 ; systemctl enable NetworkManager.service >/dev/null 2>&1 ;;
3) systemctl enable sddm.service >/dev/null 2>&1 ; systemctl enable NetworkManager.service >/dev/null 2>&1 ;;
4) systemctl enable gdm.service >/dev/null 2>&1 ; systemctl enable NetworkManager.service >/dev/null 2>&1 ;;
5) systemctl enable sddm.service >/dev/null 2>&1 ; systemctl enable NetworkManager.service >/dev/null 2>&1 ;;
esac
case $edition in
1|2) hostname="AutoLinux" ; grep -q "ILoveCandy" /etc/pacman.conf ||
sed -i "s/VerbosePkgLists/aILoveCandy" /etc/pacman.conf ;
sed -i "s/^#ParallelDownloads = .*/ParallelDownloads = 10/;s/^#Color$/Color/" /etc/pacman.conf
systemctl enable bluetooth-autoconnect.service >/dev/null 2>&1 ;;
3|4|5|6) hostname="ArchLinux" ;;
esac
! [ -f /etc/hostname ] && echo "$hostname" > /etc/hostname
sed -i "s/#en_"${area}".UTF-8/en_"${area}".UTF-8/g" /etc/locale.gen
echo "LANG=en_${area}.UTF-8" >> /etc/locale.conf ; locale-gen >/dev/null 2>&1
[ $(cat /etc/hosts|wc -wc|sed 's/\s*//g') -eq 1165 ] && echo -e "127.0.0.1 localhost\n::1 localhost\n127.0.1.1 $hostname.localhost $hostname" >/etc/hosts
[ -f /etc/localtime ] && rm /etc/localtime ; ln -sF /usr/share/zoneinfo/Africa/Harare /etc/localtime ; systemctl enable bluetooth.service >/dev/null 2>&1
rm -rf /tmp/pulse* ~/.pulse* ~/.config/pulse /home/$name/.pulse* /home/$name/.config/pulse* ; }
xftlib(){ \
dialog --title "AutoLinux Installation" --infobox "Lastly installing 'libxft-bgra' .\nSuckless software to display color emojis without causing any errors." 6 80
! pacman -Qq libxft-bgra >/dev/null 2>&1 && pacman -R --noconfirm libxft-bgra >/dev/null 2>&1 ;
yes | sudo -u "$name" $aurhelper -S libxft-bgra-git >/dev/null 2>&1 ; }
yesGrub(){ \
dialog --infobox "Initiating the Grub Bootloader..." 4 40
pacman -S --noconfirm --needed grub >/dev/null 2>&1
! [ -d /sys/firmware/efi/efivars ] &&
grub-install --target=i386-pc --bootloader-id=AutoLinux --force >/dev/null 2>&1 ;
[ -d /sys/firmware/efi/efivars ] && pacman -S --noconfirm --needed grub efibootmgr >/dev/null 2>&1 &&
grub-install --target=x86_64-efi --bootloader-id=AutoLinux --recheck >/dev/null 2>&1 ;
grub-mkconfig -o /boot/grub/grub.cfg >/dev/null 2>&1 ; grubtheme ; }
grubTheme(){ \
dialog --infobox "Setting Grub theme..." 4 30
sleep 1 && mkdir -p /boot/grub/themes/AutoLinux &&
cp /home/$name/.local/share/wallpapers/0.jpg /boot/grub/themes/AutoLinux/wp1jpg >/dev/null 2>&1
sed -i 's/#GRUB_BACKGROUND.*/GRUB_BACKGROUND="\/boot\/grub\/themes\/AutoLinux\/wp1jpg"/g' /etc/default/grub >/dev/null 2>&1
sed -i 's/GRUB_BACKGROUND.*/GRUB_BACKGROUND="\/boot\/grub\/themes\/AutoLinux\/wp1jpg"/g' /etc/default/grub >/dev/null 2>&1
sed -i 's/GRUB_TIMEOUT=.*/GRUB_TIMEOUT=10/g' /etc/default/grub >/dev/null 2>&1
sed -i 's/#GRUB_GFXMODE.*/GRUB_GFXMODE=1920x1080x32/g' /etc/default/grub >/dev/null 2>&1
}
finalize(){ \
dialog --infobox "Preparing welcome message..." 4 50
case $edition in
2) sed -i 's/Name=.*$/Name=AutoLinux (Plasma)/g' /usr/share/xsessions/plasma.desktop && cp -r /home/$name/.local/bin/* /usr/local/bin/ && dialog --title "Time to Celebrate" --msgbox "\\n The AutoLinux installation process has completed successfully\!\\n\\n\\n Provided there were no hidden errors, all the programs and configuration files should be in place.\\n\\nautolinux-Plasma will automatically start up in the login manager the next time you reboot your computer.\\n\\n\\n\\n Enjoy AutoLinux! - a4to" 17 110 ;;
*) dialog --title "Time to Celebrate!" --msgbox "\\nInstallation completed successfully! Provided there were no hidden errors, all the programs and configuration files should be in place.\\n\\nTo run the new graphical environment, log out and log back in as your new user, then run the command 'startx' to start the graphical environment \\n(it will start automatically in tty1).\\n\\n Enjoy AutoLinux! - a4to" 13 80 ;; esac ; }
rebootmsg(){ \
i=10 ; i=$i ; clear
until [ $i -lt 0 ] ; do
echo -e " Exiting in: $i\n" | figlet -tc |lolcat && sleep 1 && clear &&
((i=$i-1)) ; done && umount -l /mnt && exit 0 || rebootmsg ; }
### SCRIPT BEGIN ###
check_root
installpkg dialog || err "Root priviledges are required to run this script!"
initmsg1 || err "User exited."
initmsg2 || err "User exited."
whichedition || err "User exited."
user_and_password || err "User exited."
usercheck || err "User exited."
root_user_password || err "User exited."
selKernel || err "User exited."
case $edition in
3|4|5|6) conciseRepos ;;
esac
bootload
preinstall || err "User exited."
refreshkeys || err "Automatically refreshing Arch keyring. Consider doing so manually."
case $edition in
1|2) addConcise ;;
3|4|5|6) [ ${yesConcise} -eq 0 ] && addConcise ;;
esac
for x in curl ca-certificates base-devel archlinux-keyring hwinfo neofetch rsync git ntp zsh ; do
dialog --title "$TITLE" --infobox "Installing '$x' which is required to install and configure other programs." 5 70
installpkg "$x"
done
pacman-key --init >/dev/null 2>&1; pacman-key --populate >/dev/null 2>&1
dialog --title "AutoLinux Installation" --infobox "Synchronizing system time to ensure successful and secure installation of software..." 5 70
ntpdate 0.us.pool.ntp.org >/dev/null 2>&1
# newmirrors || err "User exited."
adduserandpass || err "Adding username and/or password."
setrootpass || err "Changing root password."
sudoers "%wheel ALL=(ALL) NOPASSWD: ALL #AutoLinux"
archlinuxinstall yay-bin
case $edition in
1) pkgsfile="https://gitlab.com/a4to/auto/-/raw/editions/dwm.csv" && configChoice="dwm" ;;
2) pkgsfile="https://gitlab.com/a4to/auto/-/raw/editions/plasma.csv" && configChoice="plasma" ;;
3) pkgsfile="https://gitlab.com/a4to/auto/-/raw/editions/bare-plasma.csv" && configChoice="bare-plasma" ;;
4) pkgsfile="https://gitlab.com/a4to/auto/-/raw/editions/bare-gnome.csv" && configChoice="bare-gnome" ;;
5) pkgsfile="https://gitlab.com/a4to/auto/-/raw/editions/bare-xfce.csv" && configChoice="bare-xfce" ;;
6) pkgsfile="https://gitlab.com/a4to/auto/-/raw/editions/bare.csv" && configChoice="bare" ;;
esac
case $kernel in
1) kernelChoice='linux' ;;
2) kernelChoice='linux-lts' ;;
3) kernelChoice='linux-hardened' ;;
4) kernelChoice='linux-zen' ;;
esac
for x in $kernelChoice ; do
dialog --title "$TITLE" --infobox "\\nInstalling the "$x" kernel..." 5 70 && installpkg "$x"
dialog --title "$TITLE" --infobox "\\nInstalling the "$x" headers..." 5 70 && installpkg "$x"-headers
done
! [ $edition = '6' ] && installationloop && cpudrivers && gpudrivers
[ $edition = '1' ] && xftlib
[ $edition = '1' ] || [ $edition = '2' ] && systembeepoff && promptfix && placeconfigs \
"$dotfiles" "/home/$name" "$configChoice" && rm -rf "/home/$name/.git" && chshell
mkdir -p /etc/X11/xinit/xinitrc.d >/dev/null 2>&1 &&
[ -f /home/$name/.config/shell/profile ] && cat /home/$name/.config/shell/profile > /etc/zsh/zprofile >/dev/null 2>&1
[ -f /home/$name/.config/x11/xinitrc ] && cat /home/$name/.config/x11/xinitrc > /etc/X11/xinit/xinitrc >/dev/null 2>&1
[ -d /root/.config ] && mv /root/.config /root/.config-old >/dev/null 2>&1
[ -d /root/.local/ ] && mv /root/.local/ /root/.local-old >/dev/null 2>&1
ln -s /home/$name/{.config,.local/} /root >/dev/null 2>&1 &&
cp /home/$name/.config/shell/profile /root/.zprofile >/dev/null 2>&1
[ $edition = '1' ] && cp /home/$name/.local/src/dwm/dwm /usr/bin/dwm && cp /home/$name/.local/src/dwm/dwm /usr/bin/AutoLinux-DWM
[ $edition = '2' ] && pacman -S cp /usr/bin/startplasma-x11 /usr/bin/AutoLinux-plasma >/dev/null 2>&1
grep -q "OTHER_OPTS='-a pulseaudio -m alsa_seq -r 48000'" /etc/conf.d/fluidsynth ||
echo "OTHER_OPTS='-a pulseaudio -m alsa_seq -r 48000'" >> /etc/conf.d/fluidsynth
system_config
pkill -15 -x 'pulseaudio' >/dev/null 2>&1 ;
sudo -u "$name" pulseaudio --start >/dev/null 2>&1
[ "$loader" = '0' ] && yesGrub
[ $edition = '1' ] || [ $edition = '2' ] && [ "$loader" = '0' ] && grubTheme
finalize ; clear ; [ $edition = '1' ] || [ $edition = '2' ] && skell
#########################################################################################################################################################################################
#########################################################################################################################################################################################