summaryrefslogtreecommitdiff
path: root/abi
blob: 6b02134ff400526b75f05e39c096eb94a0cc87a7 (plain)
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
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
#!/bin/sh

OS=$(grep -i ^id= /etc/os-release | cut -d= -f2)

#############################

echo
echo "################################"
echo "# Checking Internet Connection #"
echo "################################"
echo
echo
sleep 2

if ! ping -q -c 4 archlinux.org >/dev/null;then
	echo "YOU MUST HAVE INTERNET CONNECTION TO RUN THIS SCRIPT" && exit
fi


case "$OS" in
	"artix")
		pacman-key --init
		pacman-key --populate artix
esac
clear

#############################

echo
echo "######################"
echo "# Set Your Variables #"
echo "######################"
echo
echo
sleep 2

# Reading Variables
## Reading Keyboard Layout
printf "What is your Keyboard Layout (e.g. us)\n-> " && read -r KEYMAP && loadkeys "$KEYMAP" || exit
clear

## Reading Locale
printf "Select your locale (e.g. en_US)\n-> " && read -r LOCALE
clear

## Reading Desired Username
printf "Select your Username (Use only lowercase letters and numbers)\n-> " && read -r USERNAME
clear

## Reading Desired Hostname
printf "Select your Hostname (You can use Uppercase and lowercase letters, numbers and hypens)\n-> " && read -r HOSTNAME
clear

## Reading Desired Timezone
printf "Select the Timezone that better suits you...\nPress ENTER to continue and then press \"Q\" to exit" && read -r TIMEZONE
find /usr/share/zoneinfo -type d | grep -vi zoneinfo$ | grep -vi etc | xargs -I {} find {} -type f | sed s:"/usr/share/zoneinfo/"::g | less -i
printf "Which Timezone? (eg America/New_York)\n-> " && read -r TIMEZONE
clear

## Reading Kernel
printf "Select your kernel:\n1)linux\n2)linux-hardened\n3)linux-lts [Recommended](Default)\n4)linux-zen\n-> " && read -r KERNEL
case "$KERNEL" in
	1)
		KERNEL="linux"
		;;
	2)
		KERNEL="linux-hardened"
		;;
	4)
		KERNEL="linux-zen"
		;;
	*)
		KERNEL="linux-lts"
esac
clear

## Reading Init System
case "$OS" in
	"artix")
		printf "Select your init system:\n1) dinit\n2) OpenRC (default)\n3) Runit\n-> " && read -r INIT
		case "$INIT" in
			1)
				INIT="dinit"
				;;
			3)
				INIT="runit"
				;;
			*)
				INIT="openrc"
		esac
		;;

	*)
		INIT="systemd"
esac

#############################

echo
echo "#####################"
echo "# Disk Partitioning #"
echo "#####################"
echo
echo
sleep 2

#Partitioning HDD
## Reading Main Drive
lsblk
printf "What is your drive (e.g. sda)\n-> " && read -r SDX
clear

## Partitionier
cfdisk /dev/"$SDX"
clear

## Disk Encryption
lsblk
printf "Do you wish to use any encrypted parition? [Y/n]" && read -r ENCRYPTED
if [ "$ENCRYPTED" != "N" ] && [ "$ENCRYPTED" != "n" ]; then
	pacman --noconfirm --needed -Sy cryptsetup
	clear
fi
clear

## Mounting Partitions
echo "Mount your partitions to /mnt and wipe them if necessary"
echo "After partitioning, type \"exit\" to go back to the script"
echo ""
echo ""
lsblk
echo ""
bash
clear

#############################

echo
echo "#######################"
echo "# Bootstraping System #"
echo "#######################"
echo
echo
sleep 2

# Sorting Servers
echo "Downloading rankmirror script for pacman"
pacman -Sy --noconfirm --needed pacman-contrib
clear

echo "Updating Repos..."
mv /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup
grep -vi ^# /etc/pacman.d/mirrorlist.backup | rankmirrors - > /etc/pacman.d/mirrorlist
clear

# Bootstrapping Filesystem
echo "Bootstrapping Filesystem"

if [ "$OS" = "artix" ]; then
	case "$INIT" in
		"dinit")
			basestrap /mnt base dinit elogind-dinit "$KERNEL"
			;;
		"runit")
			basestrap /mnt base runit elogind-runit "$KERNEL"
			;;
		*)
			basestrap /mnt base openrc elogind-openrc "$KERNEL"
	esac
	fstabgen -U /mnt >> /mnt/etc/fstab
else
	pacstrap /mnt base "$KERNEL"
	genfstab -U /mnt >> /mnt/etc/fstab
fi
clear

#############################

echo
echo "######################"
echo "# Configuring System #"
echo "######################"
echo
echo
sleep 2

if [ "$OS" = "artix" ]; then
	CHROOTC="artix-chroot /mnt /bin/bash -c"
	CHROOT="artix-chroot /mnt /bin/bash"
else
	CHROOTC="arch-chroot /mnt /bin/bash -c"
	CHROOT="arch-chroot /mnt /bin/bash"
fi

## Managing Localtime and Timezone
rm -rf /mnt/etc/localtime
$CHROOTC "ln -sf /usr/share/zoneinfo/$TIMEZONE /etc/localtime"

## Managing Users and Passwords
$CHROOTC "useradd -m -g users -G wheel $USERNAME"
echo "Enter a password for $USERNAME"
$CHROOTC -c "passwd $USERNAME"
clear

echo "Enter a new password for root account"
$CHROOTC -c "passwd root"
clear

if [ "$INIT" = "openrc" ]; then
	$CHROOTC "echo hostname=\"$HOSTNAME\" > /etc/conf.d/hostname"
	sed -i s:'keymap="us"':keymap="$KEYMAP":g /mnt/etc/conf.d/keymaps

else

	 $CHROOTC "echo $HOSTNAME > /etc/hostname"
	 $CHROOTC "echo KEYMAP=$KEYMAP > /etc/vconsole.conf"
fi

$CHROOTC "echo LANG=$LOCALE.UTF-8 > /etc/locale.conf"
$CHROOTC "awk 'FNR>23' /etc/locale.gen | grep $LOCALE | sed s:#::g >> /etc/locale.gen"
$CHROOTC "locale-gen"
clear

## Adding Encrypted Hook to Init Cpio
if [ "$ENCRYPTED" != "N" ] && [ "$ENCRYPTED" != "n" ]; then
	 $CHROOTC "pacman --noconfirm --needed -Sy cryptsetup"
	 HOOKS=$(grep ^HOOKS /mnt/etc/mkinitcpio.conf)
	 grep ^HOOKS /mnt/etc/mkinitcpio.conf | sed s:'block':'block encrypt':g | xargs -I {} sed -i s:"$HOOKS":{}:g /mnt/etc/mkinitcpio.conf
fi

## Generating Initramfs
$CHROOTC "mkinitcpio -p $KERNEL"
clear

#############################

echo
echo "#################"
echo "# Base Packages #"
echo "#################"
echo
echo
sleep 2

# Installation of Base Packages
echo "Installing Base Packages..."
$CHROOTC "pacman --needed -Syu base base-devel"
clear

# Enabling Sudo For :wheel Group
$CHROOTC "sed -i s/'# %wheel ALL=(ALL:ALL) ALL'/'%wheel ALL=(ALL:ALL) ALL'/g /etc/sudoers"

# Installation of Extra Base
printf "Do you want to install Extra Base Packages? [Y/n]" && read -r EXTRA
if [ "$EXTRA" != "N" ] && [ "$EXTRA" != "n" ]; then

	# Text Editor Setup
	printf "Select a Text Editor:\n1) emacs\n2) nano\n3) neovim\n4) vi\n5) vim\n-> " && read -r TEXT
	case "$TEXT" in
		1)
			$CHROOTC "pacman --needed -S emacs"
			;;
		2)
			$CHROOTC "pacman --needed -S nano"
			;;
		3)
			$CHROOTC "pacman --needed -S neovim"
			;;
		4)
			$CHROOTC "pacman --needed -S vi"
			;;
		5)
			$CHROOTC "pacman --needed -S vim"
	esac
	clear

	# WiFi and Ethernet Setup
	printf "Do you wish to use WiFi? [Y/n]" && read -r WIFI
	clear
	if [ "$WIFI" != "N" ] && [ "$WIFI" != "n" ]; then
		printf "Select a Network Manager:\n1) connman\n2) network manager\n-> " && read -r NM
		case "$NM" in
			1)
				$CHROOTC "pacman --noconfirm --needed -S connman wpa_supplicant"
				case "$INIT" in
					"dinit")
						$CHROOTC "pacman --noconfirm --needed -S connman-dinit && ln -s /etc/dinit.d/connmand /etc/dinit.d/boot.d/"
						;;

					"openrc")
						$CHROOTC "pacman --noconfirm --needed -S connman-openrc && rc-update add connmand default"
						;;

					"runit")
						$CHROOTC "pacman --noconfirm --needed -S connman-runit && ln -s /etc/runit/sv/connmand /etc/runit/runsvdir/default"
						;;
					*)
						$CHROOTC "systemctl enable connmand"
				esac
				;;
			2)
				$CHROOTC "pacman --noconfirm --needed -S networkmanager"
				case "$INIT" in
					"dinit")
						$CHROOTC "pacman --noconfirm --needed -S networkmanager-dinit && ln -s /etc/dinit.d/NetworkManager /etc/dinit.d/boot.d/"
						;;

					"openrc")
						$CHROOTC "pacman --noconfirm --needed -S networkmanager-openrc && rc-update add NetworkManager default"
						;;

					"runit")
						$CHROOTC "pacman --noconfirm --needed -S networkmanager-runit && ln -s /etc/runit/sv/NetworkManager /etc/runit/runsvdir/default"
						;;
					*)
						$CHROOTC "systemctl enable NetworkManager"
				esac
		esac
	else
		$CHROOTC "pacman --noconfirm --needed -S dhcpcd"
		case "$INIT" in
			"dinit")
				$CHROOTC "pacman --noconfirm --needed -S dhcpcd-dinit && ln -s /etc/dinit.d/dhcpcd /etc/dinit.d/boot.d/"
				;;

			"openrc")
				$CHROOTC "pacman --noconfirm --needed -S dhcpcd-openrc && rc-update add dhcpcd default"
				;;

			"runit")
				$CHROOTC "pacman --noconfirm --needed -S dhcpcd-runit && ln -s /etc/runit/sv/dhcpcd /etc/runit/runsvdir/default"
				;;
			*)
				$CHROOTC "systemctl enable dhcpcd"
		esac
	fi
	clear

	# Installation of Base Fonts
	printf "Do you want to install Base Fonts Packages? [Y/n]" && read -r FONTS
	if [ "$FONTS" != "N" ] && [ "$FONTS" != "n" ]; then
		$CHROOTC "pacman --needed --noconfirm -S ttf-bitstream-vera ttf-dejavu gnu-free-fonts adobe-source-code-pro-fonts noto-fonts-cjk noto-fonts-emoji"
	fi
	clear

	# Installation of Proprietary Blobs
	printf "Do you want to install support for Proprietary Firmware? [Y/n]" && read -r BLOBS
	if [ "$BLOBS" != "N" ] && [ "$BLOBS" != "n" ]; then
		$CHROOTC "pacman --needed --noconfirm -S linux-firmware"
	fi
	clear

	# Installation of Audio System
	printf "Select an Audio Package:\n1) alsa\n2) jack\n3) pipewire\n4) pulseaudio\n-> " && read -r AUDIO
	case "$AUDIO" in
		1)
			$CHROOTC "pacman --needed -S alsa-lib alsa-oss alsa-utils alsa-plugins"
			;;
		2)
			$CHROOTC "pacman --needed -S jack"
			;;
		3)
			$CHROOTC "pacman --needed -S pipewire pipewire-pulse pipewire-alsa"
			;;
		4)
			$CHROOTC "pacman --needed -S pulseaudio pavucontrol pulseaudio-alsa alsa-utils"
	esac
	clear

	# Installation of a Graphical Environment
	printf "Select a Graphical Environment:\n1) bspwm\n2) Cinnamon\n3) dwm (Requires Online Git Build)\n4) Gnome\n5) i3 [Gaps Edition]\n6) Kde\n7) LXDE\n8) LXQt\n9) Mate\n10) Openbox\n11) XFCE\n12) Xorg\n13) None\n-> " && read -r ENVIRONMENT

	case "$ENVIRONMENT" in
		1)
			$CHROOTC "pacman --needed -S bspwm sxhkd"
			;;
		2)
			$CHROOTC "pacman --needed -S cinnamon nemo-fileroller gnome-terminal"
			;;
		3)
			printf "Enter your dwm build location (e.g. https://git.suckless.org/dwm)\n-> " && read -r DWM
			$CHROOTC "git clone $DWM /tmp/dwm && cd /tmp/dwm && make clean install && cd /"
			;;
		4)
			$CHROOTC "pacman --needed -S gnome nautilus gnome-terminal"
			;;
		5)
			$CHROOTC "pacman --needed -S i3 dmenu i3blocks"
			;;
		6)
			$CHROOTC "pacman --needed -S plasma kde-applications"
			;;
		7)
			$CHROOTC "pacman --needed -S lxde"
			;;
		8)
			$CHROOTC "pacman --needed -S lxqt"
			;;
		9)
			$CHROOTC "pacman --needed -S mate mate-extra"
			;;
		10)
			$CHROOTC "pacman --needed -S openbox obconf-qt menumaker"
			;;
		11)
			$CHROOTC "pacman --needed -S xfce4 xfce4-goodies"
			;;
		12)
			$CHROOTC "pacman --needed -S xorg xorg-apps xorg-server xorg-xinit"
	esac
	clear

	# Installation of Xorg and Drivers
	if [ "$ENVIRONMENT" -ge 1 ] && [ "$ENVIRONMENT" -le 12 ]; then
		$CHROOTC "pacman --needed -S xorg"
		clear

		echo "Pick your Xorg Driver:"
		"$CHROOTC" "pacman --needed -S xorg-drivers"
	fi
	clear

	# Installation of a Display Manager
	printf "Select your desired Display Manager\n1) Gdm\n2) Lightdm\n3) Sddm\n4) None\n-> " && read -r DISPLAY && clear
	case "$DISPLAY" in
		1)
			$CHROOTC "pacman --needed -S gdm"
			clear
			case "$INIT" in
				"dinit")
					$CHROOTC "pacman --needed --noconfirm -S gdm-dinit && ln -s /etc/dinit.d/gdm /etc/dinit.d/boot.d/"
					;;
				"openrc")
					$CHROOTC "pacman --needed --noconfirm -S gdm-openrc && rc-update add gdm default"
					;;
				"runit")
					$CHROOTC "pacman --needed --noconfirm -S gdm-runit && ln -s /etc/runit/sv/gdm /etc/runit/runsvdir/default"
					;;
				*)
					$CHROOTC "systemctl enable gdm"
			esac
			;;
		2)
			$CHROOTC "pacman --needed -S lightdm lightdm-gtk-greeter"
			clear
			case "$INIT" in
				"dinit")
					$CHROOTC "pacman --needed --noconfirm -S lightdm-dinit && ln -s /etc/dinit.d/lightdm /etc/dinit.d/boot.d/"
					;;
				"openrc")
					$CHROOTC "pacman --needed --noconfirm -S lightdm-openrc && rc-update add lightdm default"
					;;
				"runit")
					$CHROOTC "pacman --needed --noconfirm -S lightdm-runit && ln -s /etc/runit/sv/lightdm /etc/runit/runsvdir/default"
					;;
				*)
					$CHROOTC "systemctl enable lightdm"
			esac
			;;
		3)
			$CHROOTC "pacman --needed -S sddm"
			clear
			case "$INIT" in
				"dinit")
					$CHROOTC "pacman --needed --noconfirm -S sddm-dinit && ln -s /etc/dinit.d/sddm /etc/dinit.d/boot.d/"
					;;
				"openrc")
					$CHROOTC "pacman --needed --noconfirm -S sddm-openrc && rc-update add sddm default"
					;;
				"runit")
					$CHROOTC "pacman --needed --noconfirm -S sddm-runit && ln -s /etc/runit/sv/sddm /etc/runit/runsvdir/default"
					;;
				*)
					$CHROOTC "systemctl enable sddm"
			esac
	esac
	clear

	printf "Do you want to install GRUB? [Y/n]" && read -r GRUB
	if [ "$GRUB" != "N" ] && [ "$GRUB" != "n" ]; then

		# Installing GRUB
		$CHROOTC "pacman --needed -Syu grub"
		clear

		# Installation of GRUB Bootloader
		printf "Choose the type of boot you want to use for grub\n1) BIOS\n2) EFI\n3) Auto\n-> " && read -r GRUB
		clear

		## Adding Encrypted Config to GRUB
		if [ "$ENCRYPTED" != "N" ] && [ "$ENCRYPTED" != "n" ]; then
			lsblk
			echo ""
			echo ""
			printf "Which encrypted partition should GRUB boot from? (e.g. sda1)\n-> " && read -r ENCRYPTEDPARTITION
			$CHROOTC "pacman --needed --noconfirm -Syu cryptsetup"
			sed -i s:'GRUB_CMDLINE_LINUX=""':"GRUB_CMDLINE_LINUX=\"cryptdevice=/dev/$ENCRYPTEDPARTITION\:cryptdevice\"":g /mnt/etc/default/grub
			sed -i s:"#GRUB_ENABLE_CRYPTODISK=y":"GRUB_ENABLE_CRYPTODISK=y":g /mnt/etc/default/grub
		fi

		case "$GRUB" in
			1)
				$CHROOTC "grub-install --target=i386-pc /dev/$SDX"
				$CHROOTC "grub-mkconfig -o /boot/grub/grub.cfg"
				;;
			2)
				$CHROOTC "pacman --noconfirm --needed -S efibootmgr"
				$CHROOTC "grub-install --target=x86_46-efi /dev/$SDX"
				$CHROOTC "grub-mkconfig -o /boot/grub/grub.cfg"
				;;
			*)
				$CHROOTC "grub-install /dev/$SDX"
				$CHROOTC "grub-mkconfig -o /boot/grub/grub.cfg"
		esac
		clear
	fi
fi
clear

#############################

echo
echo "##################"
echo "# Extra Packages #"
echo "##################"
echo
echo
sleep 2

# Printer and Scanners
printf "Do you want to install Printers & Scanners support? [Y/n]" && read -r CUPS
if [ "$CUPS" != "N" ] && [ "$CUPS" != "n" ]; then
	$CHROOTC "pacman --needed -S cups cups-pdf hplip system-config-printer simple-scan"
	case "$INIT" in
		1)
			$CHROOTC "pacman --needed --noconfirm -S cups-dinit avahi-dinit && ln -s /etc/dinit.d/cupsd /etc/dinit.d/boot.d/"
			;;
		2)
			$CHROOTC "pacman --needed --noconfirm -S cups-openrc avahi-openrc && rc-update add cupsd default && rc-update add avahi default"
			;;
		3)
			$CHROOTC "pacman --needed --noconfirm -S cups-runit avahi-runit && ln -s /etc/runit/sv/cupsd /etc/runit/runsvdir/default && ln -s /etc/runit/sv/runit /etc/runit/runsvdir/default"
			;;
		*)
			$CHROOTC "systemctl enable cupsd && systemctl enable avahi"
	esac
fi
clear

if [ "$OS" = "artix" ]; then
	printf "Do you want to install Arch Linux Repos? [Y/n]" && read -r ARCH
	if [ "$ARCH" != "N" ] && [ "$ARCH" != "n" ]; then
		echo
		echo "############################################"
		echo "# Installation of Arch Linux Support Repos #"
		echo "############################################"
		echo
		echo
		sleep 2

		# Adding Arch Linux Support
		printf "\n[universe]\nInclude = /etc/pacman.d/mirrorlist-universe" >> /mnt/etc/pacman.conf
		printf "Server = https://universe.artixlinux.org/\$arch\n\nServer = https://mirror1.artixlinux.org/universe/\$arch\n\nServer = https://mirror.pascalpuffke.de/artix-universe/\$arch\n\nServer = https://artixlinux.qontinuum.space/artixlinux/universe/os/\$arch\n\nServer = https://mirror1.cl.netactuate.com/artix/universe/\$arch\n\nServer = https://ftp.crifo.org/artix-universe/" >> /mnt/etc/pacman.d/mirrorlist-universe
		$CHROOTC "pacman --needed --noconfirm -Syu artix-archlinux-support"
		printf "\n#[testing]\n#Include = /etc/pacman.d/mirrorlist-arch\n\n[extra]\nInclude = /etc/pacman.d/mirrorlist-arch\n\n[community]\nInclude = /etc/pacman.d/mirrorlist-arch\n\n#[community-testing]\n#Include = /etc/pacman.d/mirrorlist-arch" >> /mnt/etc/pacman.conf
		$CHROOTC "pacman-key --populate archlinux"
		mv /mnt/etc/pacman.d/mirrorlist-arch /mnt/etc/pacman.d/mirrorlist-arch.backup
		mv /mnt/etc/pacman.d/mirrorlist-universe /mnt/etc/pacman.d/mirrorlist-universe.backup
		clear

		echo "Updating Arch Linux Repos..."
		grep -vi ^# /mnt/etc/pacman.d/mirrorlist-arch.backup | rankmirrors - > /mnt/etc/pacman.d/mirrorlist-arch
		grep -vi ^# /mnt/etc/pacman.d/mirrorlist-universe.backup | rankmirrors - > /mnt/etc/pacman.d/mirrorlist-universe
		clear
	fi
fi

if [ "$OS" = "arch" ]; then
	printf "Do you want to multilib repo? [Y/n]" && read -r MULTI
	if [ "$MULTI" != "N" ] && [ "$MULTI" != "n" ]; then
		printf "[multilib]\nSigLevel = PackageRequired\nInclude = /etc/pacman.d/mirrorlist" >> /mnt/etc/pacman.conf
		$CHROOTC "pacman --needed --noconfirm -Syu"
	fi
else
	if [ "$OS" = "artix" ]; then
		if [ "$ARCH" != "N" ] && [ "$ARCH" != "n" ]; then
			printf "Do you want to multilib repo? [Y/n]" && read -r MULTI
			if [ "$MULTI" != "N" ] && [ "$MULTI" != "n" ]; then
				printf "\n[multilib]\nInclude = /etc/pacman.d/mirrorlist-arch" >> /mnt/etc/pacman.conf
				$CHROOTC "pacman --needed --noconfirm -Syu"
			fi
		fi
	fi
fi
clear

# Gaming Related Stuff
if [ "$MULTI" != "N" ] && [ "$MULTI" != "n" ]; then
	printf "Do you want to install Gaming software and related dependencies? (steam, lutris, 32 bit libraries) [Y/n]" && read -r GAME
	if [ "$GAME" != "N" ] && [ "$GAME" != "n" ]; then
		$CHROOTC "pacman --needed -S wine-staging wine-mono wine-gecko winetricks giflib lib32-giflib libpng lib32-libpng libldap lib32-libldap gnutls lib32-gnutls mpg123 lib32-mpg123 openal lib32-openal v4l-utils lib32-v4l-utils libpulse lib32-libpulse libgpg-error lib32-libgpg-error alsa-plugins lib32-alsa-plugins alsa-lib lib32-alsa-lib libjpeg-turbo lib32-libjpeg-turbo sqlite lib32-sqlite libxcomposite lib32-libxcomposite libxinerama lib32-libgcrypt libgcrypt lib32-libxinerama ncurses lib32-ncurses opencl-icd-loader lib32-opencl-icd-loader libxslt lib32-libxslt libva lib32-libva gtk3 lib32-gtk3 gst-plugins-base-libs lib32-gst-plugins-base-libs vulkan-icd-loader lib32-vulkan-icd-loader lutris steam"
		clear

		printf "Select a graphics card brand:\n1)AMD\n2)Intel\n3)NVIDIA\n-> " && read -r GPU
		case "$GPU" in
			1)
				$CHROOTC "pacman --needed -S lib32-mesa vulkan-radeon lib32-vulkan-radeon vulkan-icd-loader lib32-vulkan-icd-loader"
				;;
			2)
				$CHROOTC "pacman --needed -S lib32-mesa vulkan-intel lib32-vulkan-intel vulkan-icd-loader lib32-vulkan-icd-loader"
				;;
			3)
				$CHROOTC "pacman --needed -S nvidia nvidia-utils lib32-nvidia-utils nvidia-settings vulkan-icd-loader lib32-vulkan-icd-loader"
		esac
	fi
fi
clear

# Office Suite
printf "Do you want to install LibreOffice Suite? [Y/n]" && read -r OFFICE
if [ "$OFFICE" != "N" ] && [ "$OFFICE" != "n" ]; then
	$CHROOTC "pacman --needed -S libreoffice"
fi
clear

# Internet Related Stuff
printf "Do you want to install Internet related stuff? (firefox and transmission) [Y/n]" && read -r INTERNET
if [ "$INTERNET" != "N" ] && [ "$INTERNET" != "n" ]; then

	$CHROOTC "pacman --needed --noconfirm -S firefox"

	if [ "$ENVIRONMENT" -eq 6 ] || [ "$ENVIRONMENT" -eq 8 ]; then
		$CHROOTC "pacman --needed --noconfirm -S transmission-qt"
	else
		$CHROOTC "pacman --needed --noconfirm -S transmission-gtk"
	fi
fi
clear

# Multimedia Related Stuff
printf "Do you want to install Multimedia manipulation tools? (gimp, inkscape, kdenlive, vlc) [Y/n]" && read -r MEDIA
if [ "$MEDIA" != "N" ] && [ "$MEDIA" != "n" ]; then
	$CHROOTC "pacman --needed -S gimp kdenlive frei0r-plugins breeze-icons vlc inkscape"
fi
clear

# AUR
printf "Do you want to Enable AUR support? [Y/n] (yay)" && read -r AUR
if [ "$AUR" != "N" ] && [ "$AUR" != "n" ]; then
	$CHROOTC "pacman --noconfirm --needed -Sy curl"
	$CHROOTC "sudo -u $USERNAME mkdir /home/$USERNAME/AUR && cd /home/$USERNAME/AUR && sudo -u $USERNAME curl -LO 'https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=yay' && sudo -u $USERNAME mv PKGBUILD\?h\=yay PKGBUILD && sudo -u $USERNAME makepkg --noconfirm -si && cd / && rm -rf /home/$USERNAME/AUR /home/$USERNAME/go"
fi
clear

# Extra Programs
printf "Do you want to install any extra packages not mentioned above? [Y/n]" && read -r MISSING
if [ "$MISSING" != "N" ] && [ "$MISSING" != "n" ]; then
	printf "Type below the extra packages you want to install separated by spaces:\n-> " && read -r PACKAGES
	$CHROOTC "pacman --needed -S $PACKAGES"
fi
clear

#############################

echo "###############################"
echo "# Updating System Services... #"
echo "###############################"
echo
echo
sleep 2

printf "Do you want to Disable internal system beep? [Y/n]" && read -r BEEP
if [ "$BEEP" != "N" ] && [ "$BEEP" != "n" ]; then
	$CHROOTC "echo "blacklist pcspkr" > /mnt/etc/modprobe.d/nobeep.conf"
fi
clear

$CHROOTC "pacman -Syyuu"
clear

$CHROOTC "pacman --noconfirm -Scc"
clear

#############################

echo "###########"
echo "# DONE :) #"
echo "###########"
echo "           "
echo "Installation Complete"

printf "Do you wish to do any changes before rebooting? [Y/n]" && read -r CHANGES
if [ "$CHANGES" != "N" ] && [ "$CHANGES" != "n" ]; then
	$CHROOT
fi
clear

echo "System will reboot in a second"
reboot