auto


Logs | Files | README | README | LICENSE | GitLab


1
commit 20a67062ce4976fd0676cc554295c0293f5d5e9c
2
Author: Connor Etherington <[email protected]>
3
Date:   Tue Apr 26 07:28:18 2022 +0200
4
5
    Update.
6
---
7
 LICENSE          |  29 ++++
8
 PKGBUILD         |  21 +++
9
 README.md        |  64 +++++++
10
 auto             |  93 ++++++++++
11
 auto.install     |  41 +++++
12
 autoCleanInstall | 282 ++++++++++++++++++++++++++++++
13
 autoInstall      | 517 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
14
 autoPart         | 151 ++++++++++++++++
15
 8 files changed, 1198 insertions(+)
16
17
diff --git a/LICENSE b/LICENSE
18
new file mode 100644
19
index 0000000..e130fff
20
--- /dev/null
21
+++ b/LICENSE
22
@@ -0,0 +1,29 @@
23
+MIT/X Consortium License
24
+
25
+Creator and Maintainer :
26
+© 2020-2022 Connor Etherington <[email protected]>
27
+---------------------------------------------------------------------------
28
+Contributors:
29
+
30
+
31
+---------------------------------------------------------------------------
32
+
33
+Permission is hereby granted, free of charge, to any person obtaining a copy
34
+of this software and associated documentation files (the "Software"), to deal
35
+in the Software without restriction, including without limitation the rights
36
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
37
+copies of the Software, and to permit persons to whom the Software is
38
+furnished to do so, subject to the following conditions:
39
+
40
+THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN ALL
41
+COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE.
42
+
43
+
44
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
45
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
46
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
47
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
48
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
49
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
50
+SOFTWARE.
51
+
52
diff --git a/PKGBUILD b/PKGBUILD
53
new file mode 100644
54
index 0000000..072d3df
55
--- /dev/null
56
+++ b/PKGBUILD
57
@@ -0,0 +1,21 @@
58
+# Maintainer: Connor Etherington <[email protected]>
59
+# ---
60
+pkgname=auto
61
+pkgver=4.2
62
+pkgrel=1
63
+pkgdesc='ArchLinux bootstrap and partitioning script, with a selection of WM and DEs'
64
+arch=(x86_64)
65
+url="https://gitlab.com/a4to/${pkgname}"
66
+install="auto.install"
67
+license=('MIT')
68
+depends=(dialog)
69
+makedepends=(git)                 
70
+source=("git+$url.git")
71
+sha256sums=('SKIP')
72
+
73
+package() {
74
+  cd "$srcdir"
75
+    install -Dm755 ${pkgname}/{auto,autoCleanInstall,autoInstall,autoPart} -t "${pkgdir}/usr/bin"
76
+    install -Dm644 ${pkgname}/LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
77
+    install -Dm644 ${pkgname}/README.md "${pkgdir}/usr/share/doc/${pkgname}/README.md"
78
+}
79
diff --git a/README.md b/README.md
80
new file mode 100644
81
index 0000000..21eb2e3
82
--- /dev/null
83
+++ b/README.md
84
@@ -0,0 +1,64 @@
85
+# Automate BootStrapping Scripts
86
+
87
+Auto, was built as a method of providing users with a simple yet extensive way to bootstrap and install Arch Linux.
88
+
89
+During the installation process, you will be given the option to install either bare Arch Linux, and make all further installations decisions 
90
+yourself, or to choose from a selection of one of the supported bare, or pre-configured desktop environment and window managers. 
91
+
92
+We beleive that Arch Linux, being a rolling release distribution, should if possible always be installed via a script in opposed to an ISO
93
+image. This will in turn always ensure that the user is getting the most recent and up to date packages, enhancing user experience, numerous 
94
+security factors and ensuring a successfull installation.
95
+
96
+---
97
+
98
+The package consists of 4 scripts:
99
+
100
++ **auto**: A front-end to initiate the installlation process.
101
++ **autoPart**: A partitioning script.
102
++ **autoInstall**: The base install script.
103
++ **autoCleanInstall**: The clean install script.
104
+
105
+
106
+`autoInstall`: This script is to be used for installing AutoLinux ontop of an existing Arch Linux installation, as a new user profile.
107
+
108
+
109
+`autoCleanInstall`: This script is intended for use when performing a clean/fresh installation, with no pre-existing OS installed on the partition(s) reserved for the installation.
110
+This script also includes section for partitioning your drive, so running the autoPart script is **NOT** required.
111
+
112
+
113
+`autoPart`: This script is for useage outside of the AutoLinux installation process, and serves simply as a helper when partitioning your drive for any fresh installation.
114
+
115
+*NOTE*: The options are limited to partition selection, or drive wipe. 
116
+As for creating new partitions and deleting existing partitions, an external program such as cfdisk, fdisk or parted will be required if necessary.
117
+The script also does not allow for manual selection of a file system type, and the rootfs is automatially set to ext4.
118
+
119
+
120
+
121
+## Usage:
122
+
123
+The `auto` script is used to initiate the installation process, and each step of the install is explained there further.\n
124
+However, these scripts can also be run manually if the user chooses to do so.
125
+
126
+If run manually, please read the function of both the `autoInstall` and `autoCleanInstall` script, and select *EITHER* `autoInstall` or `autoCleanInstall` to carry out 
127
+the installation process. The `autoCleanInstall` script calls the `autoInstall` script upon completion of the base installation, so running both scripts is **NOT** required. 
128
+
129
+
130
+
131
+## Currently Supported Editions:
132
+
133
++ AutoLinux - DWM Edition
134
++ AutoLinux - Plasma Edition
135
++ KDE Plasma (Plasma out the box)
136
++ Gnome (Gnome out the box)
137
++ Xfce4 (Xfce out the box)
138
++ Bare Arch Linux (No Additional Packages)  
139
+
140
+
141
+
142
+**Prerequisites**
143
+
144
++ The script takes care of all requirements dependencies do not have to be manually installed. ✔
145
+
146
+
147
+I hope you find these scripts helpfull !      - a4to
148
+
149
diff --git a/auto b/auto
150
new file mode 100755
151
index 0000000..1c93c07
152
--- /dev/null
153
+++ b/auto
154
@@ -0,0 +1,93 @@
155
+#!/usr/bin/env bash
156
+########################################################################################################################################################################################
157
+##                                                                      ~   A U T O L I N U X    F R O N T E N D   ~                                                                  ##
158
+########################################################################################################################################################################################
159
+
160
+#                                                         _               _               _       __                         _  _                                                      # 
161
+#                                                        /.\     _    _  FJ_     ____    FJ      / J   _ _   _    _    _    FJ  LJ                                                     # 
162
+#                                                       //_\\   J |  | LJ  _|   F __ J  J |      LFJ  J ' \  J   J |  | L   J \/ F                                                     # 
163
+#                                                      / ___ \  | |  | || |-'  | |--| | | |      J  L | |\\   |  | |  | |   /    \                                                     # 
164
+#                                                     / L___J \ F L__J JF |__-.F L__J J F L_____ J  L F L \  JJ  F L__J J  /  /\  \                                                    # 
165
+#                                                    J__L   J__J\____,__\_____J\______/J________LJ__LJ__L \\J__LJ\____,__LJ__//\\__L                                                   # 
166
+#                                                    |__L   J__|J____,__J_____FJ______F|________||__||__L   J__| J____,__F|__/  \__|                                                   # 
167
+
168
+########################################################################################################################################################################################
169
+########################################################################################################################################################################################
170
+
171
+check_root(){ [ "$(id -u)" -ne 0 ] && err "root priviledges are required to run this script."; }
172
+
173
+err(){ echo -e "\n$(tput bold; tput setaf 1)[-] ERROR: ${*}$(tput sgr0)" && exit 1 ; }
174
+
175
+
176
+SRCDIR="$(realpath "$(dirname $0)")"
177
+
178
+TITLE=' ~  AutoLinux  ~ '
179
+
180
+TITLE2=' ~  Automate OS  ~ '
181
+
182
+WELCOME1="\n                               Welcome, and thank you for using AutoLinux!\n\n   This script is built to make the Arch Linux installation process as quick and painless as possible ...\n\n"
183
+
184
+WELCOME2="\nYou have the opportunity to select an edition out of of 3 installation categories, namely:\n\n\n
185
+1. AutoLinux Editions - Desktop environments and Window managers with AutoLinux at their heart, focused\n   on minimalism and a simple, yet comprehensive end user simplicity.\n\n
186
+2. Minimal Desktops - Desktop environments with only the minimal packages native to the DE, providing\n   the user with a basic desktop experience. No config files.\n\n
187
+3. Bare Arch Linux - A clean Arch Linux install. No additional packages whatsoever, leaving all further\n   decisions to the user. (Requires a very basic understanding of Arch Linux)\n\n\n
188
+Ready to begin?\n\n"
189
+
190
+cleanInstall=(
191
+  '1' 'Fresh Install'
192
+  '2' 'Existing OS')
193
+
194
+installTypes="\\n                         What kind of installation would you like to perform?\\n\\n
195
+1. Fresh Install - This is a clean install, with no existing OS on the installalation partitions/drive.\\n
196
+2. Existing OS   - I am installing AutoLinux ontop of an existing OS, as a new user profile.\\n "
197
+
198
+requierments(){ pacman -Qq dialog && dialog --infobox "Syncronizing package database..." 4 40 && 
199
+  pacman -Syy parted sudo --needed --noconfirm >/dev/null 2>&1 ||
200
+  pacman -Syy dialog parted sudo --needed --noconfirm ||
201
+  err 'User exited.' ; }
202
+
203
+well1Menu(){ dialog \
204
+    --stdout --colors \
205
+    --title "$TITLE2" \
206
+    --msgbox "$WELCOME1" \
207
+    9 113 ; }
208
+
209
+well2Menu(){ dialog \
210
+    --stdout --colors \
211
+    --title "$TITLE" \
212
+    --yes-label "Lets get Started!" \
213
+    --no-label "No, I changed my mind." \
214
+    --yesno "$WELCOME2" \
215
+    21 108 || exit 1 ; }
216
+
217
+installMenu(){ \
218
+  select=$(dialog \
219
+    --stdout --colors \
220
+    --title "$TITLE" \
221
+    --menu "$installTypes" \
222
+    12 108 0 "${cleanInstall[@]}" ) ;
223
+
224
+  case $select in
225
+    1) dialog \
226
+        --stdout --colors \
227
+        --title "$TITLE" \
228
+        --msgbox "\\n  Great, you will now be taken to partioning before the installation process begins.\n " \
229
+        7 90 && sh ${SRCDIR}/autoCleanInstall ;;
230
+    2) dialog \
231
+        --stdout --colors \
232
+        --title "$TITLE" \
233
+        --msgbox "\n                     Great, Thank you for choosing AutoLinux!\n " \
234
+        7 90 && sh ${SRCDIR}/autoInstall ;;
235
+    *) exit 1 ;; esac ; }
236
+
237
+
238
+check_root
239
+
240
+requierments || err "User exited."
241
+
242
+! well1Menu && clear && exit 1
243
+
244
+! well2Menu && clear && exit 1
245
+
246
+installMenu 
247
+
248
diff --git a/auto.install b/auto.install
249
new file mode 100644
250
index 0000000..f7fe1e5
251
--- /dev/null
252
+++ b/auto.install
253
@@ -0,0 +1,41 @@
254
+post_install() {
255
+echo -e '\n\033[1m\033[32m\033[4mAutomate BootStrapping Scripts
256
+
257
+\033[0m\033[36mAuto, was built as a method of providing users with a simple yet extensive way to bootstrap and install Arch Linux.
258
+
259
+During the installation process, you will be given the option to install either bare Arch Linux, and make all further installations 
260
+decisions yourself, or to choose from a selection of one of the supported bare, or pre-configured desktop environment and window managers. 
261
+
262
+We beleive that Arch Linux, being a rolling release distribution, should if possible always be installed via a script in opposed to an ISO
263
+image. This will in turn ensure that the user is getting the most recent and up to date packages, enhancing user experience, numerous 
264
+security factors and ensuring a successfull installation.
265
+
266
+
267
+\033[32mThe package consists of 4 scripts:
268
+
269
+\033[35mauto:\033[0m\033[36m A front-end to initiate the installation process.\033[0m
270
+\033[35mautoPart:\033[0m\033[36m A partitioning script.\033[0m
271
+\033[35mautoInstall:\033[0m\033[36m The base install script.\033[0m
272
+\033[35mautoCleanInstall:\033[0m\033[36m The clean install script.\033[0m\n
273
+
274
+\033[1m\033[33mautoInstall:\033[0m\033[36m This script is to be used for installing AutoLinux ontop of an existing Arch Linux installation, as a new user profile.
275
+
276
+\033[1m\033[33mautoCleanInstall:\033[0m\033[36m This script is intended for use when performing a clean/fresh installation, with no pre-existing OS installed on the partition(s) reserved for the installation.
277
+This script also includes section for partitioning your drive, so running the autoPart script is \033[31m\033[1mNOT\033[0m\033[36m required.
278
+
279
+\033[1m\033[33mautoPart:\033[0m\033[36m This script is for useage outside of the AutoLinux installation process, and serves simply as a helper when partitioning your drive for any fresh installation.
280
+
281
+\033[3m\033[1m\033[36mNOTE:\033[0m\033[36m The options are limited to partition selection, or drive wipe. 
282
+As for creating new partitions and deleting existing partitions, an external program such as cfdisk, fdisk or parted will be required if necessary.
283
+The script also does not allow for manual selection of a file system type, and the rootfs is automatially set to ext4.\n
284
+
285
+\033[32m\033[1mUsage: \033[36m
286
+
287
+The \033[33m\033[3m\033[1mauto\033[0m\033[36m script is provided to initiate the installation process, and each step of the install is explained there further.
288
+However, these scripts can also be run manually if the user chooses to do so.
289
+
290
+If run manually, please read the function of both the \033[33m\033[3m\033[1mautoInstall\033[0m\033[36m and \033[3m\033[33m\033[1mautoCleanInstall\033[0m\033[36m script, and select \033[35mEITHER\033[0m\033[36m \033[1m\033[33m\033[3mautoInstall\033[0m\033[36m or \033[33m\033[1m\033[3mautoCleanInstall\033[0m\033[36m to carry out 
291
+the installation process. The \033[33m\033[1m\033[3mautoCleanInstall\033[0m\033[36m script calls the \033[33m\033[1m\033[3mautoInstall\033[0m\033[36m script upon completion of the base installation, so running both scripts is \033[31m\033[1mNOT\033[0m\033[36m required.\n\n 
292
+
293
+\033[34mI hope you find these scripts helpful!    - \033[3m\033[1m\033[33ma4to\n\n\033[0m'
294
+}
295
diff --git a/autoCleanInstall b/autoCleanInstall
296
new file mode 100755
297
index 0000000..8bf2009
298
--- /dev/null
299
+++ b/autoCleanInstall
300
@@ -0,0 +1,282 @@
301
+#!/usr/bin/env bash
302
+#########################################################################################################################################################################################
303
+##                                                                A U T O L I N U X    B O O T S T R A P    S C R I P T                                                                ##
304
+#########################################################################################################################################################################################
305
+
306
+#                                                         _               _               _       __                         _  _                                                      # 
307
+#                                                        /.\     _    _  FJ_     ____    FJ      / J   _ _   _    _    _    FJ  LJ                                                     # 
308
+#                                                       //_\\   J |  | LJ  _|   F __ J  J |      LFJ  J ' \  J   J |  | L   J \/ F                                                     # 
309
+#                                                      / ___ \  | |  | || |-'  | |--| | | |      J  L | |\\   |  | |  | |   /    \                                                     # 
310
+#                                                     / L___J \ F L__J JF |__-.F L__J J F L_____ J  L F L \  JJ  F L__J J  /  /\  \                                                    # 
311
+#                                                    J__L   J__J\____,__\_____J\______/J________LJ__LJ__L \\J__LJ\____,__LJ__//\\__L                                                   # 
312
+#                                                    |__L   J__|J____,__J_____FJ______F|________||__||__L   J__| J____,__F|__/  \__|                                                   # 
313
+
314
+#########################################################################################################################################################################################
315
+#########################################################################################################################################################################################
316
+
317
+# Debugging:
318
+# trap 'lastCommand=$currentCommand; currentCommand=$BASH_COMMAND' DEBUG
319
+# trap 'echo $lastCommand' EXIT QUIT STOP ERR
320
+
321
+#########################################################################################################################################################################################
322
+
323
+lines(){ cat $1|wc -l; }
324
+
325
+selectParts(){ selBoot ; selSwap ; selRootFS ; }
326
+
327
+err(){ echo >&2 "$(tput bold; tput setaf 1)[-] ERROR: ${*}$(tput sgr0)" ; exit 1337 ; }
328
+
329
+dsks=$(mktemp)        ; selDsk=$(mktemp)
330
+selPar=$(mktemp)      ; selPart=$(mktemp)
331
+selSwap=$(mktemp)     ; selBoot=$(mktemp)
332
+selRootFS=$(mktemp)   ; selSwap=$(mktemp)
333
+wholeDisk=$(mktemp)   ; confirm=$(mktemp)
334
+partitions=$(mktemp)  ; chRootDir=$(mktemp)
335
+tmpZone=$(mktemp)     ; mntMntPT=$(mktemp)
336
+
337
+srcdir=$(cd $(dirname ${BASH_SOURCE[0]}) && pwd && echo)
338
+
339
+trap 'rm -f $dsks $selPar $selPart $selSwap $selBoot $selRootFS $wholeDisk $partitions $chRootDir $tmpZone $confirm' EXIT QUIT STOP ERR
340
+
341
+continents=(
342
+'Africa' 'Africa'
343
+'America' 'America'
344
+'Antarctica' 'Antarctica'
345
+'Arctic' 'Arctic'
346
+'Asia' 'Asia'
347
+'Atlantic' 'Atlantic'
348
+'Australia' 'Australia'
349
+'Brazil' 'Brazil'
350
+'Canad' 'Canada'
351
+'Chile' 'Chile'
352
+'Europe' 'Europe'
353
+'Indian' 'Indian'
354
+'Mexico' 'Mexico'
355
+'Pacific' 'Pacific'
356
+'US' 'US'
357
+'Etc' 'Etc')
358
+
359
+warn(){ echo >&2 "$(tput bold; tput setaf 1)[!] WARNING: ${*}$(tput sgr0)"; }
360
+
361
+check_root(){ [ "$(id -u)" -ne 0 ] && err "root priviledges are required to run this script."; }
362
+
363
+mkmnt(){ $(mkdir -p /mnt/home/drives/"$1" >/dev/null 2>&1 && $(mount /dev/"$2" /mnt/home/drives/"$1") >/dev/null 2>&1) ; }
364
+
365
+fail(){ err " CATASTROPHIC FAILIURE IN UNKNOWN REGIONS CAPTAIN . . ." ; }
366
+
367
+requierments(){ pacman -Qq dialog && dialog --infobox "Syncronizing package database..." 4 40 && 
368
+  pacman -Syy parted sudo --needed --noconfirm >/dev/null 2>&1 ||
369
+  pacman -Syy dialog parted sudo --needed --noconfirm ||
370
+  err 'User exited.' ; }
371
+
372
+init(){  
373
+pacConf /etc/pacman.conf &&
374
+timedatectl set-ntp true ; }
375
+
376
+pacConf(){ \
377
+dialog --infobox "Updating Repos and Keys..." 4 40  
378
+
379
+cat ${1}|grep -q "ILoveCandy" ||
380
+sed -i '/\[options\]/aILoveCandy' ${1}
381
+
382
+for repo in core extra community multilib; do
383
+grep -q "^\[$repo\]" ${1} || echo "[$repo]
384
+Include = /etc/pacman.d/mirrorlist
385
+" >> ${1} ; done ; }
386
+
387
+getLocale(){ \
388
+continent=$(dialog \
389
+  --title ' ~ Timezone Selection ~ ' \
390
+  --stdout --no-tags --no-cancel --menu \
391
+  "\n  Please select your native country :\n " 10 45 0 \
392
+  ${continents[@]})
393
+
394
+
395
+echo 'zones=(' >  $tmpZone
396
+for x in $(ls -1 /usr/share/zoneinfo/${continent}); do
397
+echo "'${x}' '${x}'" >>${tmpZone} ; done
398
+echo ')' >>${tmpZone}
399
+source ${tmpZone}
400
+
401
+zone=$(dialog \
402
+  --title ' ~ Timezone Selection ~ ' \
403
+  --stdout --no-tags --no-cancel --menu \
404
+  "\n      Select your local timezone :\n " 48 45 44  \
405
+  ${zones[@]})
406
+
407
+echo ${continent}/${zone} > ${tmpZone} ; }
408
+
409
+
410
+selDisk(){ \
411
+  dialog --stdout --colors  --title "Partitioning" \
412
+  --menu "\\n  Which drive will be used for the AutoLinux installation?\\n " 30 65 0 \
413
+  "${drives[@]}" > $selDsk || err "User exited."
414
+}
415
+
416
+selBoot(){ \
417
+  dialog --stdout --no-cancel --colors  --title "Partitioning" \
418
+  --menu "\\n  Which Partition will be used for the bootloader?\\n " 30 65 0 \
419
+  "${parts[@]}"  > $selBoot || err "User exited."
420
+}
421
+
422
+selSwap(){ \
423
+  dialog --stdout --colors  --title "Partitioning" \
424
+  --ok-label "Continue" \
425
+  --cancel-label "No Swap" \
426
+  --menu "\\n  Which Partition will be used for the swap?\\n " 30 65 0 \
427
+  "${parts[@]}" > $selSwap
428
+}
429
+
430
+selRootFS(){ \
431
+  dialog --stdout --no-cancel --colors  --title "Partitioning" \
432
+  --menu "\\n  Which Partition will be used for the root filesystem?\\n " 30 65 0 \
433
+  "${parts[@]}" > $selRootFS || err "User exited."
434
+}
435
+
436
+wholeDisk(){ \
437
+  dialog --stdout --colors --extra-button \
438
+  --title "Partitioning" \
439
+  --extra-label "WIPE DISK" \
440
+  --yes-label 'Select Partitions' \
441
+  --no-label 'Go Back' \
442
+  --yesno "Would you like to wipe the entire drive, or manually select partitions?" 6 80 ; 
443
+  echo $? > $wholeDisk
444
+}
445
+
446
+allDisks(){ \
447
+fdisk -l|grep -B 1 "Disk model:"|sed 's/,.*sectors//g;s/://g;s/Disk\s*\///g;s/Disk model //g'|xargs|sed \
448
+'s/ -- /\n/g;s/dev/"\/dev/g;s/\n/"\n/g;s/^/drives=(\n/g;s/$/"\n)/g'|sed 's/ /" "/;s/iB /iB    /' >$dsks ; source $dsks ; }
449
+
450
+getDisk(){ \
451
+eval $(fdisk -lo Device,Size,Type|grep $(cat $selDsk) >$selPar ; n=1 ; echo "parts=(" >$selPart
452
+cat $selPar|while read x; do echo "$(head -n $n $selPar|tail -n1|cut -d' ' -f1|sed "s/^/'/;s/$/'/")\
453
+$(echo $x|cut -d' ' -f2-|sed "s/^/\t\'/;s/$/\'/")"|sed '/Disk.*bytes,.*sectors/d'; ((n++)) ; done >>$selPart &&
454
+echo -e ")" >>$selPart) ; source $selPart ; }
455
+
456
+confirm(){ \
457
+  dialog --stdout --colors --title "Partitioning" \
458
+  --yes-label 'NO. Go Back' \
459
+  --no-label 'YES. Continue' \
460
+  --yesno "\\nAre you sure you want to completely wipe $(cat $selDsk)?\\n\\nThis action CANNOT be undone." 9 90 ;
461
+  WIPE=$? ; }
462
+
463
+wipeDisk(){ \
464
+  PRTED="parted -s $(cat $selDsk)"
465
+  wipefs $(cat $selDsk)
466
+  dialog --colors --title "Partitioning" --infobox "Preparing $(cat $selDsk)1 - the legacy boot partition, Pease be patient..." 3 80 ;
467
+  $PRTED mklabel gpt >/dev/null 2>&1
468
+  $PRTED mkpart primary 1 3 >/dev/null 2>&1
469
+  $PRTED name 1 legacy >/dev/null 2>&1
470
+  $PRTED set 1 bios_grub on
471
+  dialog --colors --title "Partitioning" --infobox "Preparing $(cat $selDsk)2 - the uefi boot partition, Pease be patient..." 3 80 ;
472
+  $PRTED mkpart primary fat32 3MiB 256MiB >/dev/null 2>&1
473
+  $PRTED name 2 boot >/dev/null 2>&1
474
+  $PRTED set 2 boot on
475
+  yes|mkfs.fat -F32 $(cat $selDsk)2 >/dev/null 2>&1
476
+  dialog --colors --title "Partitioning" --infobox "Preparing $(cat $selDsk)3 - the swap partition, Pease be patient..." 3 80 ;
477
+  swapoff $(cat $selDsk)3 >/dev/null 2>&1
478
+  $PRTED mkpart primary 256MiB 4352MiB >/dev/null 2>&1
479
+  $PRTED name 3 swap >/dev/null 2>&1
480
+  $PRTED set 3 swap on
481
+  yes|mkswap $(cat $selDsk)3 >/dev/null 2>&1 ;
482
+  swapon $(cat $selDsk)3 >/dev/null 2>&1
483
+  dialog --colors --title "Partitioning" --infobox "Preparing $(cat $selDsk)4 - the root filesystem, Pease be patient..." 3 80 ;
484
+  $PRTED mkpart primary ext4 4352MiB 100% >/dev/null 2>&1
485
+  $PRTED name 4 rootfs >/dev/null 2>&1
486
+  yes|mkfs.ext4 $(cat $selDsk)4 >/dev/null 2>&1 ; }
487
+
488
+definedPartitioning(){ \
489
+  dialog --colors --title "Partitioning" --infobox "Preparing the $(cat $selBoot) - the boot partition, Pease be patient..." 3 80 ;
490
+  yes|mkfs.fat -F32 $(cat $selBoot) >/dev/null 2>&1
491
+  [ -n "$(cat $selSwap)" ] && dialog --colors --title "Partitioning" --infobox "Preparing the $(cat $selSwap) - the swap partition, Pease be patient..." 3 80 ;
492
+  [ -n "$(cat $selSwap)" ] && yes|mkswap $(cat $selSwap) >/dev/null 2>&1
493
+  dialog --colors --title "Partitioning" --infobox "Preparing  $(cat $selRootFS) - the root filesystem, Pease be patient..." 3 80 ;
494
+  yes|mkfs.ext4 $(cat $selRootFS) >/dev/null 2>&1
495
+  [ -n "$(cat $selSwap)" ] && swapon $(cat $selSwap) >/dev/null 2>&1
496
+}
497
+
498
+definedConfirm(){ \
499
+  dialog --colors --title "Partitioning" \
500
+  --yes-label "Wait, Go Back" \
501
+  --no-label "Im Sure" \
502
+  --yesno "\\nAre you happy with your selection?\\n\\n1. Boot Partition: $(cat $selBoot)\\n2. Swap Partition: $(cat $selSwap)\\n3. Root File System: $(cat $selRootFS)\\n\\nOnce you have confirmed, there in no going back." 14 80 ;
503
+  defConf=$? ; }
504
+
505
+completion(){ dialog --colors --title " ~ AutoLinux ~ " \
506
+  --infobox "\\nPartitioning Completed Successfully! Now continuing to install base system..." 5 85 ; }
507
+
508
+begin(){ \
509
+n=1 ; selDisk || err "User Exited."
510
+getDisk || err "User Exited."
511
+wholeDisk || err "User Exited."
512
+  
513
+case "$(cat $wholeDisk)" in
514
+  1) getDisk && begin ;;
515
+  0) selectParts ; definedConfirm && [ $defConf -eq 0 ] && begin ||  
516
+    [ $defConf -eq 1 ] && definedPartitioning && wipeType='manual' ;;
517
+  3) confirm && case "$(echo $WIPE)" in 
518
+    '0') begin ;;
519
+    '1') wipeDisk && wipeType='automatic'; mount $(cat $selDsk)4 /mnt  ;;
520
+  esac ;; esac ; }
521
+
522
+base_install(){	\
523
+  for x in base linux-firmware base-devel; do
524
+    dialog --colors --title " ~ AutoLinux ~ " --infobox "Installing $x, part of the fundaemental system packages..." 3 80 ;
525
+    sudo pacstrap /mnt ${x} --noconfirm >/dev/null 2>&1 ; done ; unset x ; }
526
+
527
+post_install(){ \
528
+  for x in efibootmgr dosfstools mtools pacman-contrib os-prober; do
529
+    dialog --colors --title " ~ AutoLinux ~ " --infobox "Installing $x, needed for the installation..." 3 80 ;
530
+    sudo pacstrap /mnt ${x} --noconfirm >/dev/null 2>&1 ; done ; unset x ; }
531
+
532
+cp_scripts(){ cd $srcdir ; cp autoInstall /mnt ; }
533
+
534
+checkMnt(){ \
535
+  echo -en "mntMount='$(lsblk -lnD --output NAME,MOUNTPOINT|grep '/mnt'|uniq|cut -d' ' -f1|xargs|sed 's/ /,/g')'" >>${mntMntPT} && source ${mntMntPT} ; echo $mntMount|read mntMount
536
+  [ -z "${mntMount}" ] && [ $(ls -1 /mnt|wc -l) -eq 0 ] && return 0
537
+  [ -z "${mntMount}" ] && [ $(ls -1 /mnt|wc -l) -ge 1 ] && dialog --colors --title " ~ AutoLinux ~ " --msgbox "\\n              WARNING: The /mnt directory is not empty.\\n\\nThis will cause problems with the installation. Please ensure that you empty '/mnt' before proceeding." 10 80 && clear && echo -e "\n" && exit 1
538
+  [ -n "${mntMount}" ] &&  dialog --colors --title " ~ AutoLinux ~ " --yes-label "Continue" --no-label "EXIT" --yesno "\\nWARNING: "$mntMount" - is/are currently mounted at /mnt.\\n\\nAny files and directories will be lost. Are you sure you want to continue?" 10 80 && return 0 || clear && echo -e "\n" && exit 1  
539
+}
540
+
541
+linkLocale(){ \
542
+  dialog --colors --title " ~ AutoLinux ~ " --infobox "Setting timezone..." 3 50 ;
543
+  ln -sf /usr/share/zoneinfo/$(cat $tmpZone) /mnt/etc/localtime
544
+}
545
+
546
+
547
+# Script Begins:
548
+
549
+check_root ; checkMnt
550
+
551
+requierments ; init 
552
+
553
+allDisks ||  err "Could not find any disks."
554
+
555
+getLocale || err "User Exited."
556
+
557
+begin
558
+
559
+
560
+case "$wipeType" in
561
+  'manual') mount $(cat $selRootFS) /mnt && completion && sleep 3 || 
562
+    swapoff $(cat ${selSwap}) >/dev/null 2>&1  
563
+  ! [ -d /mnt/boot/EFI ] && mkdir -p /mnt/boot/EFI; mount $(cat $selBoot) /mnt/boot/EFI ;;
564
+  'automatic') mount $(cat $selDsk)4 /mnt && completion && sleep 3 || 
565
+  ! [ -d /mnt/boot/EFI ] && mkdir -p /mnt/boot/EFI; mount $(cat $selDsk)2 /mnt/boot/EFI ;;
566
+esac
567
+
568
+
569
+base_install && post_install || err "User Exited."
570
+
571
+linkLocale || err "User Exited."
572
+
573
+pacConf /mnt/etc/pacman.conf
574
+
575
+genfstab -U /mnt > /mnt/etc/fstab 
576
+
577
+cp_scripts && arch-chroot /mnt /usr/bin/bash /autoInstall &&
578
+  rm /mnt/autoInstall && umount -l /mnt && exit 0
579
+
580
+
581
+#########################################################################################################################################################################################
582
+#########################################################################################################################################################################################
583
diff --git a/autoInstall b/autoInstall
584
new file mode 100755
585
index 0000000..122a17b
586
--- /dev/null
587
+++ b/autoInstall
588
@@ -0,0 +1,517 @@
589
+#!/usr/bin/env bash
590
+#########################################################################################################################################################################################
591
+##                                                                A U T O L I N U X    B O O T S T R A P    S C R I P T                                                                ##
592
+#########################################################################################################################################################################################
593
+
594
+#                                                         _               _               _       __                         _  _                                                      # 
595
+#                                                        /.\     _    _  FJ_     ____    FJ      / J   _ _   _    _    _    FJ  LJ                                                     # 
596
+#                                                       //_\\   J |  | LJ  _|   F __ J  J |      LFJ  J ' \  J   J |  | L   J \/ F                                                     # 
597
+#                                                      / ___ \  | |  | || |-'  | |--| | | |      J  L | |\\   |  | |  | |   /    \                                                     # 
598
+#                                                     / L___J \ F L__J JF |__-.F L__J J F L_____ J  L F L \  JJ  F L__J J  /  /\  \                                                    # 
599
+#                                                    J__L   J__J\____,__\_____J\______/J________LJ__LJ__L \\J__LJ\____,__LJ__//\\__L                                                   # 
600
+#                                                    |__L   J__|J____,__J_____FJ______F|________||__||__L   J__| J____,__F|__/  \__|                                                   # 
601
+
602
+#########################################################################################################################################################################################
603
+#########################################################################################################################################################################################
604
+
605
+# Debugging:
606
+# trap 'lastCommand=$currentCommand; currentCommand=$BASH_COMMAND' DEBUG
607
+# trap 'echo $lastCommand' EXIT QUIT STOP ERR
608
+
609
+#########################################################################################################################################################################################
610
+
611
+ #-------------------------------#
612
+## ### VARIABLES & FUNCTIONS ### ##
613
+ #-------------------------------#
614
+
615
+pkgdir="/opt"
616
+
617
+aurhelper="yay"
618
+
619
+TITLE=' ~ Automate OS ~ '
620
+
621
+mirlist="/etc/pacman.d/mirrorlist"
622
+
623
+lmirlist="/etc/pacman.d/local-mirrorlist"
624
+
625
+envConf="https://gitlab.com/a4to/dotfiles.git"
626
+
627
+
628
+arch="$(uname -m)"
629
+
630
+srcdir="$(cd $(dirname ${BASH_SOURCE[0]}) && pwd && echo)"
631
+
632
+area="$(curl -4 ifconfig.co/country-iso 2>/dev/null)"           
633
+
634
+bootid="$(lsblk|grep boot |sed 's/p.*$//;s/├─//;s/└─//'|sed 's/^/\/dev\//;s/$/\//')"
635
+
636
+rmdblck="$([ -f /var/lib/pacman/db.lck ] && rm -rf /var/lib/pacman/db.lck)"
637
+
638
+
639
+KERNELS=(
640
+  '1' 'linux                                       '
641
+  '2' 'linux-lts                                   '
642
+  '3' 'linux-hardened                              '
643
+  '4' 'linux-zen                                   ')
644
+
645
+EDITIONS=(  
646
+  '1' 'AutoLinux - DWM Edition                     '
647
+  '2' 'AutoLinux - Plasma Edition                  '
648
+  '3' 'KDE Plasma (Plasma Desktop and Apps)        '
649
+  '4' 'Gnome (Gnome Desktop and Apps)              '
650
+  '5' 'Xfce (Xfce4 Desktop and Apps)               '
651
+  '6' 'Bare Arch Linux (No Additional Packages)    ')
652
+ 
653
+
654
+installpkg(){ pacman --noconfirm --needed -S "$*" >/dev/null 2>&1 ; }
655
+
656
+check_root(){ [ "$(id -u)" -ne 0 ] && err "Root priviledges are required to run this script!"; }
657
+
658
+err(){ echo >&2 "$(tput bold; tput setaf 1)[-] ERROR: ${*}$(tput sgr0)" && $rmdblck ; exit 1337; }
659
+
660
+
661
+newmirrors(){ \
662
+    dialog --title "$TITLE" --infobox " Testing fastest mirrors for most efficient downloads..." 4 50
663
+    mv /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup && reflector --sort rate -a48 -f20 -l20 -c 'ZA,US,UK,Germany,Netherlands' \
664
+-p 'http,https' --save /etc/pacman.d/mirrorlist >/dev/null 2>&1  ; }
665
+
666
+initmsg1(){ \
667
+  dialog --title " Welcome to Automate! " --msgbox "\\n                Welcome, and thank you for using AutoLinux!\\n\\n  This script will now install the Arch/AutoLinux edition of your choice.\\n" 9 80 ; }
668
+
669
+whichedition(){
670
+  edition="$(dialog --title "$TITLE" --colors --menu "\\n    Please Select the Edition You Wish to Install :\\n   " 16 60 5 "${EDITIONS[@]}" 3>&1 1>&2 2>&3 3>&1)" ; }
671
+
672
+initmsg2(){
673
+	dialog --colors --title " Please Note :" --yes-label " Lets Get Going! " --no-label " I Changed My Mind. " --yesno "\\n    An Arch Linux, or Arch based system is required for the AutoLinux installation.\\n\\n       If you are running any other distrobution the installation will fail." 9 90 ; }
674
+
675
+selKernel(){
676
+  kernel="$(dialog --colors --title "Kernel Selection" --menu "\\n            Please choose your kernel:\\n\\n (If unsure, select the default '1. Linux' kernel)" 15 56 6 "${KERNELS[@]}" 3>&1 1>&2 2>&3 3>&1)" ; } 
677
+
678
+
679
+user_and_password() {
680
+	name=$(dialog --inputbox " Please enter a name for the user account: " 10 60 3>&1 1>&2 2>&3 3>&1) || exit 1
681
+	while ! echo "$name" | grep -q "^[a-z_][a-z0-9_-]*$"; do
682
+		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)
683
+	done
684
+	pass1=$(dialog --no-cancel --passwordbox "Enter a password for that user:" 10 60 3>&1 1>&2 2>&3 3>&1)
685
+	pass2=$(dialog --no-cancel --passwordbox "Retype the password." 10 60 3>&1 1>&2 2>&3 3>&1)
686
+	while ! [ "$pass1" = "$pass2" ]; do
687
+		unset pass2
688
+		pass1=$(dialog --no-cancel --passwordbox "Passwords do not match.\\n\\nEnter password again." 10 60 3>&1 1>&2 2>&3 3>&1)
689
+		pass2=$(dialog --no-cancel --passwordbox "Retype password." 10 60 3>&1 1>&2 2>&3 3>&1)
690
+	done ; }
691
+
692
+root_user_password(){
693
+  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 ;
694
+  pass3=$(dialog --no-cancel --passwordbox "Enter a password for the root user:" 10 60 3>&1 1>&2 2>&3 3>&1)
695
+	pass4=$(dialog --no-cancel --passwordbox "Retype the password." 10 60 3>&1 1>&2 2>&3 3>&1)
696
+	while ! [ "$pass3" = "$pass4" ]; do
697
+		unset pass2
698
+		pass3=$(dialog --no-cancel --passwordbox "Passwords do not match.\\n\\nEnter password again." 10 60 3>&1 1>&2 2>&3 3>&1)
699
+		pass4=$(dialog --no-cancel --passwordbox "Retype password." 10 60 3>&1 1>&2 2>&3 3>&1)
700
+    done ; }
701
+
702
+usercheck() { \
703
+	! { id -u "$name" >/dev/null 2>&1; } ||
704
+	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 ; }
705
+
706
+preinstall() { \
707
+	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 ; }
708
+
709
+
710
+adduserandpass() { \
711
+	dialog --infobox " Adding user \"$name\"..." 4 50
712
+	useradd -m "$name"  >/dev/null 2>&1
713
+	usermod -aG wheel,audio,optical,video,kvm,network,adm "$name" && chown $name /home/"$name"  >/dev/null 2>&1
714
+	export repodir="/home/$name/.local/src"; mkdir -p "$repodir"; chown -R "$name":wheel "$(dirname "$repodir")"
715
+	echo "$name:$pass1" | chpasswd >/dev/null 2>&1
716
+	unset pass1 pass2 ; }
717
+
718
+setrootpass(){
719
+	dialog --infobox " Changing password for root user..." 4 50
720
+  [ -z "$pass3" ] && pass3="autolinux" ;
721
+	echo "root:$pass3" | chpasswd >/dev/null 2>&1
722
+	unset pass3 pass4 ; }
723
+
724
+bootload(){
725
+    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 &&
726
+        loader="$?" ; }
727
+
728
+addmirrors(){
729
+    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
730
+        yesmir="$?" ; }
731
+
732
+chshell(){
733
+chsh -s /bin/zsh >/dev/null 2>&1
734
+chsh -s /bin/zsh "$name" >/dev/null 2>&1
735
+sudo -u "$name" mkdir -p "/home/$name/.cache/zsh/" ; }
736
+
737
+refreshkeys() { \
738
+		dialog --infobox "Refreshing Arch Keyring..." 4 40
739
+		pacman --noconfirm -S archlinux-keyring >/dev/null 2>&1
740
+  dialog --infobox "Updating Repos and Keys..." 4 40  
741
+  for repo in core extra community multilib; do
742
+  grep -q "^\[$repo\]" /etc/pacman.conf || echo "[$repo]
743
+Include = /etc/pacman.d/mirrorlist
744
+" >> /etc/pacman.conf
745
+done
746
+
747
+    pacman-key --init >/dev/null 2>&1 
748
+    pacman-key --populate >/dev/null 2>&1
749
+    pacman -Syy >/dev/null 2>&1
750
+}
751
+
752
+addConcise(){
753
+
754
+  dialog --infobox "Adding Concise Keyring..." 4 40
755
+  
756
+  yes|pacman-key --recv-key 81BACEEBC3EA26E127166E4A819BB92A9A48160E --keyserver keyserver.ubuntu.com >/dev/null 2>&1 
757
+  yes|pacman-key --lsign-key 81BACEEBC3EA26E127166E4A819BB92A9A48160E   >/dev/null 2>&1
758
+  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 
759
+	
760
+  cat /etc/pacman.conf|grep -q "^\[concise\]"|| cat << EOF >>/etc/pacman.conf
761
+    
762
+[concise]
763
+SigLevel = Required DatabaseOptional
764
+Server = https://gitlab.com/a4to/\$repo/-/raw/master/\$arch
765
+EOF
766
+
767
+ pacman-key --init >/dev/null 2>&1 
768
+ pacman-key --populate >/dev/null 2>&1
769
+ pacman -Syy >/dev/null 2>&1
770
+
771
+  }
772
+
773
+conciseRepos(){
774
+  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
775
+  yesConcise="$?" ; }
776
+
777
+
778
+sudoers(){ echo -e "\n$*" >> /etc/sudoers ; }
779
+
780
+gpudrivers(){ \
781
+    dialog --infobox " Detecting Graphics Card..." 4 40
782
+    local GPU="$(hwinfo|grep gpu|grep Driver:|cut -d ':' -f2|sed 's/\s*//;s/"//g')"
783
+	
784
+    case ${GPU} in
785
+        AMD|amd|Amd|amd-gpu) dialog --infobox " Installing AMD GPU Drivers..." 4 40
786
+	    yes|${aurhelper} -S  --needed xf86-video-amdgpu >/dev/null 2>&1 ;;
787
+        NVIDIA|Nvidia|nvidia|nvidia-gpu)  dialog --infobox " Installing NVIDIA GPU Drivers..." 4 40
788
+	    yes|${aurhelper} -S  --needed nvidia-470xx-dkms nvidia-470xx-settings nvidia-470xx-utils >/dev/null 2>&1 ;;
789
+        Intel|INTEL|intel|intel-gpu)   dialog --infobox " Installing Intel GPU Drivers..." 4 40
790
+	    yes|${aurhelper} -S --needed vulkan-intel xf86-video-intel intel-gpu-tools >/dev/null 2>&1 ;;
791
+        Radeon|radeon|RADEON|radeon-gpu) dialog --infobox " Installing Radeon GPU Drivers..." 4 40
792
+	    yes|${aurhelper} -S  --needed opencl-mesa vulkan-raedon >/dev/null 2>&1 ;;
793
+             *)  dialog --infobox " Unknown GPU Detected, Skipping GPU Driver Installation..." 4 40 && sleep 2 ;;
794
+
795
+    esac; unset x ; }
796
+
797
+cpudrivers(){ \
798
+    dialog --infobox " Detecting CPU..." 4 40
799
+    local CPU="$(lscpu|grep 'Model name:'|cut -d ':' -f2|sed 's/\s*//'|cut -d\  -f1)"
800
+    
801
+    case ${CPU} in
802
+        Intel|INTEL|intel|intel-cpu) dialog --infobox " Installing Intel CPU Drivers..." 4 40
803
+            yes|${aurhelper} -S --needed intel-ucode >/dev/null 2>&1 ;;
804
+          AMD|amd|Amd|amd-cpu) dialog --infobox " Installing AMD CPU Drivers..." 4 40
805
+            yes|${aurhelper} -S --needed amd-ucode >/dev/null 2>&1 ;;
806
+            *) dialog --infobox " Unknown CPU Detected, Skipping CPU Driver Installation..." 4 40 ; sleep 2 ;;
807
+
808
+    esac ; unset x ; }
809
+
810
+replacedir(){ \
811
+    dialog --infobox "Installing AutoLinux custom builds of '$(basename "$1")' ($n of $total).  $2" 5 70
812
+	destdir="/usr/share"
813
+	clonename="$(basename "$1" .git)"
814
+    clonepath="$destdir/$clonename"
815
+	[ -e "$clonepath" ] && sudo mv $clonepath "$clonepath'-old'" ;
816
+	git clone "$1" $clonepath  >/dev/null 2>&1
817
+	cd /tmp || return 1 ; }
818
+
819
+archlinuxinstall(){
820
+    dialog --infobox "Installing "$1", an AUR helper..." 4 50
821
+	[ -d "$pkgdir"/"$1" ] && rm -rf "$pkgdir"/"$1" ;
822
+    sudo git clone --depth 1 https://aur.archlinux.org/"$1".git $pkgdir/"$1" >/dev/null 2>&1 ;
823
+	chown "$name":wheel $pkgdir/"$1" ||{ cd "$pkgdir/$1" || return 1 ; sudo -u "$name" git pull --force origin master;}
824
+	cd "$pkgdir/$1"&&sudo -u "$name" makepkg --noconfirm -si >/dev/null 2>&1 || return 1 ; cd /tmp ; }
825
+
826
+maininstall(){
827
+	dialog --title "AutoLinux Installation" --infobox "Installing '$1' ($n of $total).   $2" 5 70
828
+	installpkg "$1" ; }
829
+
830
+gitinstall(){
831
+	progname="$(basename "$1" .git)"
832
+	dir="$repodir/$progname"
833
+	dialog --title "AutoLinux Installation" --infobox "Cloning and Building '$progname' ($n of $total). '$(basename "$1")' $2" 5 70
834
+	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;}
835
+	cd "$dir" || exit 1
836
+	makepkg -sri >/dev/null 2>&1
837
+	cd /tmp || return 1 ; }
838
+
839
+gitcompile(){
840
+	progname="$(basename "$1" .git)"
841
+    dir="$repodir/$progname"
842
+	dialog --title "AutoLinux Installation" --infobox "Installing the AutoLinux  build of '$progname' ($n of $total). $(basename "$1") $2" 5 70
843
+	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;}
844
+	cd "$dir" || exit 1
845
+	make >/dev/null 2>&1
846
+	make install >/dev/null 2>&1
847
+	cd /tmp || return 1 ; }
848
+
849
+aurinstall(){ \
850
+	dialog --title "AutoLinux Installation" --infobox "Installing '$1' ($n of $total) from the AUR. $2" 5 70
851
+	echo "$aurinstalled" | grep -q "^$1$" && return 1
852
+	sudo -u "$name" $aurhelper -S --noconfirm "$1" >/dev/null 2>&1
853
+	}
854
+
855
+pipinstall(){ \
856
+	dialog --title "AutoLinux Installation" --infobox "Installing the Python package '$1' ($n of $total). $2" 5 70
857
+	[ -x "$(command -v "pip")" ] || installpkg python-pip >/dev/null 2>&1
858
+	yes | pip install "$1" ; }
859
+
860
+installationloop(){ \
861
+	([ -f "$pkgsfile" ] && cp "$pkgsfile" /tmp/editions.csv) || curl -Ls "$pkgsfile" | sed '/^#/d' > /tmp/editions.csv
862
+	total=$(wc -l < /tmp/editions.csv)
863
+	aurinstalled=$(pacman -Qqm)
864
+	while IFS=, read -r tag program comment; do
865
+		n=$((n+1))
866
+		echo "$comment" | grep -q "^\".*\"$" && comment="$(echo "$comment" | sed "s/\(^\"\|\"$\)//g")"
867
+		case "$tag" in
868
+			"A") aurinstall "$program" "$comment" ;;
869
+			"M") gitinstall "$program" "$comment" ;;
870
+			"G") gitcompile "$program" "$comment" ;;
871
+			"P") pipinstall "$program" "$comment" ;;
872
+			"R") replacedir "$program" "$comment" ;;
873
+ 	     *) maininstall "$program" "$comment" ;;
874
+		esac
875
+	done < /tmp/editions.csv ; }
876
+
877
+placeconfigs() {
878
+	dialog --infobox " Downloading and installing config files..." 4 60
879
+	branch="$configChoice" ; dir=$(mktemp -d)
880
+	[ ! -d "$2" ] && mkdir -p "$2"
881
+	chown "$name":wheel "$dir" "$2"
882
+	sudo -u "$name" git clone --recursive -b "$branch" --depth 1 --recurse-submodules "$1" "$dir" >/dev/null 2>&1
883
+	sudo -u "$name" cp -rfT "$dir" "$2" ; }
884
+
885
+systembeepoff() { dialog --infobox "Getting rid of that retarded error beep sound..." 4 40
886
+	rmmod pcspkr >/dev/null 2>&1 & echo "blacklist pcspkr" > /etc/modprobe.d/nobeep.conf >/dev/null 2>&1 ; sleep 2 ; }
887
+
888
+mirrors(){
889
+cd /tmp
890
+    dialog --infobox " Adding ArcoLinux Mirrors and Keys..." 4 50
891
+    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
892
+yes |sudo pacman -U --noconfirm --needed /tmp/arcolinux-keyring-20230919-6-any.pkg.tar.zst >/dev/null 2>&1
893
+    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
894
+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 ;
895
+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 ;
896
+
897
+    dialog --infobox " Adding Chaotic Mirrors and Keys..." 4 50 &&
898
+yes|pacman-key --recv-key FBA220DFC880C036 --keyserver keyserver.ubuntu.com >/dev/null 2>&1
899
+yes|pacman-key --lsign-key FBA220DFC880C036 >/dev/null 2>&1
900
+yes|pacman -U \
901
+    'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-keyring.pkg.tar.zst'  >/dev/null 2>&1 \
902
+    'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-mirrorlist.pkg.tar.zst' >/dev/null 2>&1 &&
903
+sed -i '/chaotic-aur/{N;d}' /etc/pacman.conf
904
+echo -e "[chaotic-aur]\nInclude = /etc/pacman.d/chaotic-mirrorlist\n" >> /etc/pacman.conf ;
905
+
906
+  dialog --infobox " Adding BlackArch Mirrors and Keys..." 4 50  &&
907
+curl -LO blackarch.org/strap.sh >/dev/null 2>&1  &&
908
+echo 46f035c31d758c077cce8f16cf9381e8def937bb strap.sh | sha1sum -c >/dev/null 2>&1  &&
909
+chmod +x strap.sh  ; sudo sh strap.sh >/dev/null 2>&1 &&
910
+
911
+  dialog --infobox " Updating System Keys and Mirrors..." 4 50
912
+yes|pacman -Syyu >/dev/null 2>&1 ; }
913
+
914
+
915
+system_config(){ \
916
+dialog --infobox "Setting System Information..." 4 40 ; sleep 2 
917
+
918
+case $edition in
919
+  1) systemctl enable mpd.service >/dev/null 2>&1  ; systemctl enable NetworkManager.service >/dev/null 2>&1 ;;
920
+  2) systemctl enable sddm.service >/dev/null 2>&1 ; systemctl enable NetworkManager.service >/dev/null 2>&1 ;;
921
+  3) systemctl enable sddm.service >/dev/null 2>&1 ; systemctl enable NetworkManager.service >/dev/null 2>&1 ;;
922
+  4) systemctl enable gdm.service >/dev/null 2>&1  ; systemctl enable NetworkManager.service >/dev/null 2>&1 ;;
923
+  5) systemctl enable sddm.service >/dev/null 2>&1 ; systemctl enable NetworkManager.service >/dev/null 2>&1 ;;
924
+esac
925
+
926
+case $edition in
927
+  1|2) hostname="AutoLinux" ; grep -q "ILoveCandy" /etc/pacman.conf || 
928
+    sed -i "/^\[options\]/aILoveCandy" /etc/pacman.conf ;  
929
+    sed -i "/^#ParallelDownloads = .*/ParallelDownloads = 10/;s/^#Color$/Color/" /etc/pacman.conf
930
+   systemctl enable bluetooth-autoconnect.service >/dev/null 2>&1 ;;
931
+  3|4|5|6) hostname="ArchLinux" ;;
932
+esac
933
+
934
+! [ -f /etc/hostname ] && echo "$hostname" > /etc/hostname
935
+sed -i "s/#en_"${area}".UTF-8/en_"${area}".UTF-8/g" /etc/locale.gen
936
+echo "LANG=en_${area}.UTF-8" >> /etc/locale.conf ; locale-gen >/dev/null 2>&1
937
+
938
+[ $(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
939
+
940
+[ -f /etc/localtime ] && rm /etc/localtime ; ln -sF /usr/share/zoneinfo/Africa/Harare /etc/localtime ; systemctl enable bluetooth.service >/dev/null 2>&1
941
+rm -rf /tmp/pulse* ~/.pulse* ~/.config/pulse /home/$name/.pulse* /home/$name/.config/pulse* ; }
942
+
943
+
944
+xftlib(){ \                                            
945
+    dialog --title "AutoLinux Installation" --infobox "Lastly installing 'libxft-bgra' .\nSuckless software to display color emojis without causing any errors." 6 80
946
+    ! pacman -Qq libxft-bgra >/dev/null 2>&1 && pacman -R --noconfirm libxft-bgra >/dev/null 2>&1 ;
947
+    yes | sudo -u "$name" $aurhelper -S libxft-bgra-git >/dev/null 2>&1 ; }
948
+
949
+
950
+yesGrub(){ \
951
+    dialog --infobox "Initiating the Grub Bootloader..." 4 40
952
+        pacman -S --noconfirm --needed grub >/dev/null 2>&1 
953
+        ! [ -d /sys/firmware/efi/efivars ] && 
954
+            grub-install --target=i386-pc --bootloader-id=AutoLinux --force  >/dev/null 2>&1 ;
955
+        [ -d /sys/firmware/efi/efivars ] && pacman -S --noconfirm --needed grub efibootmgr >/dev/null 2>&1 &&
956
+            grub-install --target=x86_64-efi --bootloader-id=AutoLinux --recheck >/dev/null 2>&1 ;
957
+            grub-mkconfig -o /boot/grub/grub.cfg >/dev/null 2>&1 ; grubtheme ; }
958
+
959
+grubTheme(){ \
960
+	dialog --infobox "Setting Grub theme..." 4 30 
961
+    sleep 1 && mkdir -p /boot/grub/themes/AutoLinux &&
962
+    cp /home/$name/.local/share/wallpapers/0.jpg /boot/grub/themes/AutoLinux/wp1.jpg  >/dev/null 2>&1 
963
+    sed -i 's/#GRUB_BACKGROUND.*/GRUB_BACKGROUND="\/boot\/grub\/themes\/AutoLinux\/wp1jpg"/g' /etc/default/grub >/dev/null 2>&1
964
+    sed -i 's/GRUB_BACKGROUND.*/GRUB_BACKGROUND="\/boot\/grub\/themes\/AutoLinux\/wp1jpg"/g' /etc/default/grub >/dev/null 2>&1
965
+    sed -i 's/GRUB_TIMEOUT=.*/GRUB_TIMEOUT=10/g' /etc/default/grub >/dev/null 2>&1
966
+    sed -i 's/#GRUB_GFXMODE.*/GRUB_GFXMODE=1920x1080x32/g' /etc/default/grub >/dev/null 2>&1
967
+}
968
+
969
+
970
+finalize(){ \
971
+	dialog --infobox "Preparing welcome message..." 4 50
972
+  case $edition in
973
+    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 ;;
974
+    *) 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 ; } 
975
+
976
+
977
+rebootmsg(){ \
978
+    i=10 ; i=$i ; clear
979
+    until [ $i -lt 0 ] ; do
980
+    echo -e " Exiting in: $i\n" | figlet -tc |lolcat && sleep 1 && clear &&
981
+    ((i=$i-1)) ; done && umount -l /mnt && exit 0 || rebootmsg ; }
982
+
983
+
984
+
985
+### SCRIPT BEGIN ###
986
+
987
+check_root
988
+
989
+installpkg dialog || err "Root priviledges are required to run this script!"
990
+
991
+initmsg1 || err "User exited."
992
+
993
+initmsg2 || err "User exited."
994
+
995
+whichedition || err "User exited."
996
+
997
+user_and_password || err "User exited."
998
+
999
+usercheck || err "User exited."