Add: Support for 'Zram Swap' has been added

Add: 'Custom Setup' > Add Packages : Added auto-configuration for 'lightdm' if the 'Lightdm GTK/Slick/Deepin Greeter' has been selected
Remove: Do not reload the 'Partition Manager' stage after auto-unmounting filesystems and switching to 'Manual Mode' (if formatting or mounting errors have occured)
Change: Put code blocks into functions and re-arrange code, for script simplification
Change: A few prompts have been edited for aesthetic purposes
This commit is contained in:
elementrick 2024-07-28 16:35:23 +00:00
parent 1913ee51f2
commit 05d47511e0

708
Amelia.sh
View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Amelia Installer # Amelia Installer
# Version: 6.8 # Version: 6.9
set -euo pipefail set -euo pipefail
trap 's=$?; echo "$0: Error on line "$LINENO": $BASH_COMMAND"; exit $s' ERR trap 's=$?; echo "$0: Error on line "$LINENO": $BASH_COMMAND"; exit $s' ERR
@ -143,7 +143,7 @@ unmount (){
sleep 0.3 sleep 0.3
line3 line3
REDBG " ${yellow}------------------------- " REDBG " ${yellow}------------------------- "
REDBG " ${yellow}[!] Unmount and Retry${redbg} [!] " REDBG " ${yellow}[!] Unmount and Retry [!] "
REDBG " ${yellow}------------------------- " REDBG " ${yellow}------------------------- "
echo echo
reload reload
@ -257,9 +257,9 @@ arch (){
cnfg (){ cnfg (){
sleep 0.3 sleep 0.3
line3 line3
YELLOWBG "------------------------------------------------------------------------------------------------- " MAGENTABG "------------------------------------------------------------------------------------------------- "
YELLOWBG " ### Configuring... ### " MAGENTABG " ### Configuring... ### "
YELLOWBG "------------------------------------------------------------------------------------------------- " MAGENTABG "------------------------------------------------------------------------------------------------- "
echo echo
sleep 0.3 sleep 0.3
} }
@ -293,13 +293,13 @@ first_check (){
if [[ "${tty}" == *"tty"* && -f /usr/share/kbd/consolefonts/ter-v18b.psf.gz && -f /usr/share/kbd/consolefonts/ter-v32b.psf.gz ]]; then if [[ "${tty}" == *"tty"* && -f /usr/share/kbd/consolefonts/ter-v18b.psf.gz && -f /usr/share/kbd/consolefonts/ter-v32b.psf.gz ]]; then
until slct_font; do : ; done until slct_font; do : ; done
elif [[ "${tty}" == *"pts"* && -f /usr/share/kbd/consolefonts/ter-v18b.psf.gz && -f /usr/share/kbd/consolefonts/ter-v32b.psf.gz ]]; then elif [[ "${tty}" == *"pts"* && -f /usr/share/kbd/consolefonts/ter-v18b.psf.gz && -f /usr/share/kbd/consolefonts/ter-v32b.psf.gz ]]; then
MAGENTABG " 'Terminus Font' detected. Switch to console (tty) and re-run the installer to activate " MAGENTABG " 'Terminus Font' detected > Switch to console (tty) and re-run the installer to activate "
echo echo
fi fi
if [[ "${run_as}" == "root" ]]; then if [[ "${run_as}" == "root" ]]; then
REDBGBL " ---------------------------------------- " REDBGBL " ${yellow}---------------------------------------- "
REDBGBL " ### The Installer Runs In ROOT Mode ### " REDBGBL " ${yellow}### The Installer Runs In ROOT Mode ### "
REDBGBL " ---------------------------------------- " REDBGBL " ${yellow}---------------------------------------- "
else else
YELLOWBGBL " ---------------------------------------- " YELLOWBGBL " ---------------------------------------- "
YELLOWBGBL " ### The Installer Runs In DEMO Mode ### " YELLOWBGBL " ### The Installer Runs In DEMO Mode ### "
@ -1099,7 +1099,9 @@ ${magenta}###${nc}-------------------------------------${magenta}[ ${bwhite}Swap
[2] Swapfile [2] Swapfile
[3] None " [3] Zram Swap
[4] None "
BLUE " BLUE "
@ -1118,8 +1120,8 @@ Enter a number: "
CYAN " CYAN "
[!] Swap type will default to 'None' [!] [!] Swap type will default to 'None' [!]
" "
sleep 3 sleep 2
swapmode="3" swapmode="4"
skip skip
ok ok
if [[ "${vga_slct}" == "yes" ]]; then if [[ "${vga_slct}" == "yes" ]]; then
@ -1144,8 +1146,8 @@ Enter a number: "
CYAN " CYAN "
[!] Swap type will default to 'None' [!] [!] Swap type will default to 'None' [!]
" "
sleep 4 sleep 2
swapmode="3" swapmode="4"
skip skip
ok ok
if [[ "${vga_slct}" == "yes" ]]; then if [[ "${vga_slct}" == "yes" ]]; then
@ -1168,6 +1170,8 @@ Enter a number: "
" "
until set_swapsize; do : ; done ;; until set_swapsize; do : ; done ;;
3) 3)
zram="zram-generator" ;;
4)
sleep 0.3 sleep 0.3
YELLOW " YELLOW "
@ -1668,11 +1672,11 @@ Enter [y/n]: "
if [[ "${nvidia_suspend}" == "n" ]]; then if [[ "${nvidia_suspend}" == "n" ]]; then
skip skip
elif [[ "${nvidia_suspend}" == "y" && "${swapmode}" == "3" ]]; then elif [[ "${nvidia_suspend}" == "y" ]] && [[ "${swapmode}" == "3" || "${swapmode}" == "4" ]]; then
sleep 0.3 sleep 0.3
RED " RED "
[!] Incompatible 'No Swap' Setting has been detected " [!] Incompatible Swap Setting has been detected "
CYAN " CYAN "
[!] Nvidia's Video Memory Preserving feature will NOT be enabled [!] [!] Nvidia's Video Memory Preserving feature will NOT be enabled [!]
" "
@ -1998,7 +2002,9 @@ ${magenta}###${nc}--------------------------------${magenta}[ ${bwhite}LightDM G
[1] Gtk [1] Gtk
[2] Slick " [2] Slick
[3] Deepin "
BLUE " BLUE "
@ -2019,6 +2025,12 @@ Enter a number: "
NC " NC "
==> [${green}Lightdm Slick Greeter OK${nc}] " ;; ==> [${green}Lightdm Slick Greeter OK${nc}] " ;;
3)
greeter="lightdm-deepin-greeter"
sleep 0.3
NC "
==> [${green}Lightdm Deepin Greeter OK${nc}] " ;;
"") "")
sleep 0.3 sleep 0.3
echo echo
@ -2418,10 +2430,9 @@ ${magenta}###${nc}---------------------------------${magenta}[ ${bwhite}Automati
REDBG " ------------------------------------------------------------ " REDBG " ------------------------------------------------------------ "
line2 line2
if [[ -e "${instl_drive}" && "${use_manpreset}" != "yes" ]]; then if [[ -e "${instl_drive}" && "${use_manpreset}" != "yes" ]]; then
sleep 0.3
line2 line2
YELLOWBG " ------------------------------------------------------- " REDBG "${yellow}> Apply 'Smart Partitioning' on disk '${instl_drive}'? [y/n] "
YELLOWBG " > Apply 'Smart Partitioning' on disk '${instl_drive}'? [y/n] "
YELLOWBG " ------------------------------------------------------- "
echo echo
read -r -p " read -r -p "
==> " smartpart ==> " smartpart
@ -2467,19 +2478,21 @@ Enter a disk number ${bwhite}(empty to skip)${blue}: "
until dsks_submn; do : ; done until dsks_submn; do : ; done
fi fi
if [[ -z "${use_manpreset}" ]] ; then if [[ -z "${use_manpreset}" ]]; then
if [[ "${fs}" == "2" && "${swapmode}" == "1" ]]; then if [[ "${fs}" == "2" ]]; then
if [[ "${swapmode}" == "1" ]]; then
preset="2" preset="2"
elif [[ "${fs}" == "2" && "${swapmode}" == "2" ]] || [[ "${fs}" == "2" && "${swapmode}" == "3" ]]; then else
preset="1" preset="1"
fi
elif [[ "${fs}" == "1" ]] ; then elif [[ "${fs}" == "1" ]] ; then
if [[ "${sep_home}" == "y" && "${swapmode}" == "1" ]] ; then if [[ "${sep_home}" == "y" && "${swapmode}" == "1" ]]; then
preset="4" preset="4"
elif [[ "${sep_home}" == "y" && "${swapmode}" == "2" ]] || [[ "${sep_home}" == "y" && "${swapmode}" == "3" ]]; then elif [[ "${sep_home}" == "y" && "${swapmode}" != "1" ]]; then
preset="3" preset="3"
elif [[ "${sep_home}" == "n" && "${swapmode}" == "1" ]] ; then elif [[ "${sep_home}" == "n" && "${swapmode}" == "1" ]]; then
preset="2" preset="2"
elif [[ "${sep_home}" == "n" && "${swapmode}" == "2" ]] || [[ "${sep_home}" == "n" && "${swapmode}" == "3" ]]; then elif [[ "${sep_home}" == "n" && "${swapmode}" != "1" ]]; then
preset="1" preset="1"
fi fi
else else
@ -3150,6 +3163,7 @@ ${multi_swap}
" "
read -r -p " read -r -p "
==> " partok ==> " partok
echo
local prompt="Confirm Disk" local prompt="Confirm Disk"
local stage_prompt="Partitioning" local stage_prompt="Partitioning"
@ -3193,6 +3207,7 @@ ${multi_swap}
" "
read -r -p " read -r -p "
==> " partok ==> " partok
echo
local prompt="Confirm Disk" local prompt="Confirm Disk"
local stage_prompt="Partitioning" local stage_prompt="Partitioning"
@ -3569,7 +3584,6 @@ ${magenta}###${nc}----------------------------------------${magenta}[ ${bwhite}A
" "
else else
umount_manual umount_manual
until disk_mngr; do : ; done
until form_root; do : ; done until form_root; do : ; done
until mount_mnt; do : ; done until mount_mnt; do : ; done
fi fi
@ -3602,7 +3616,6 @@ ${magenta}###${nc}----------------------------------------${magenta}[ ${bwhite}A
" "
else else
umount_manual umount_manual
until disk_mngr; do : ; done
until form_root; do : ; done until form_root; do : ; done
until mount_mnt; do : ; done until mount_mnt; do : ; done
fi fi
@ -3617,7 +3630,6 @@ ${magenta}###${nc}----------------------------------------${magenta}[ ${bwhite}A
" "
else else
umount_manual umount_manual
until disk_mngr; do : ; done
until form_efi; do : ; done until form_efi; do : ; done
until mount_mnt; do : ; done until mount_mnt; do : ; done
until mount_boot; do : ; done until mount_boot; do : ; done
@ -3654,7 +3666,6 @@ ${magenta}###${nc}----------------------------------------${magenta}[ ${bwhite}A
" "
else else
umount_manual umount_manual
until disk_mngr; do : ; done
until form_home; do : ; done until form_home; do : ; done
until mount_mnt; do : ; done until mount_mnt; do : ; done
until mount_boot; do : ; done until mount_boot; do : ; done
@ -3741,9 +3752,9 @@ Enter a partition number ${bwhite}(empty to skip and proceed)${blue}: "
fi fi
fi fi
RED " RED "
-----------------------------------------------------
[!] WARNING: PARTITION HAS NOT BEEN FORMATTED [!] ### WARNING: > ${yellow}PARTITION HAS NOT BEEN FORMATTED ${red}< ###
" -----------------------------------------------------"
sleep 2 sleep 2
skip skip
done done
@ -3858,9 +3869,9 @@ Enter a name ${bwhite}(empty to skip and proceed)${blue}: "
return 0 return 0
else else
RED " RED "
-----------------------------------------------------
[!] WARNING: PARTITION HAS NOT BEEN FORMATTED [!] ### WARNING: > ${yellow}PARTITION HAS NOT BEEN FORMATTED ${red}< ###
" -----------------------------------------------------"
sleep 2 sleep 2
skip skip
return 0 return 0
@ -3986,6 +3997,10 @@ Enter a name ${bwhite}(empty to skip and proceed)${blue}: "
skip skip
return 0 return 0
else else
RED "
-----------------------------------------------------
### WARNING: > ${yellow}PARTITION HAS NOT BEEN FORMATTED ${red}< ###
-----------------------------------------------------"
skip skip
return 0 return 0
fi fi
@ -4562,11 +4577,11 @@ ${magenta}###${nc}-------------------------------------${magenta}[ ${bwhite}Pacs
fi fi
fi fi
if [[ "${vendor}" == "Virtual Machine" ]]; then if [[ "${vendor}" == "Virtual Machine" ]]; then
basepkgs="base pkgstats nano sudo vim ${bootldr_pkgs} ${fstools} ${kernel} ${microcode} ${vmpkgs} ${devel}" basepkgs="base pkgstats nano sudo vim ${bootldr_pkgs} ${fstools} ${kernel} ${microcode} ${vmpkgs} ${devel} ${zram}"
elif [[ "${vendor}" == "Nvidia" ]]; then elif [[ "${vendor}" == "Nvidia" ]]; then
basepkgs="base linux-firmware pkgstats nano sudo vim ${bootldr_pkgs} ${fstools} ${kernel} ${kernel}-headers ${microcode} ${vgapkgs} ${wireless_reg} ${devel}" basepkgs="base linux-firmware pkgstats nano sudo vim ${bootldr_pkgs} ${fstools} ${kernel} ${kernel}-headers ${microcode} ${vgapkgs} ${wireless_reg} ${devel} ${zram}"
else else
basepkgs="base linux-firmware pkgstats nano sudo vim ${bootldr_pkgs} ${fstools} ${kernel} ${microcode} ${vgapkgs} ${wireless_reg} ${devel}" basepkgs="base linux-firmware pkgstats nano sudo vim ${bootldr_pkgs} ${fstools} ${kernel} ${microcode} ${vgapkgs} ${wireless_reg} ${devel} ${zram}"
fi fi
case "${packages}" in case "${packages}" in
@ -4716,6 +4731,165 @@ ${magenta}###${nc}--------------------------${magenta}[ ${bwhite}Setting Up Wire
fi fi
} }
################################################################################################### ###################################################################################################
btldr_conf (){
if [[ "${bootloader}" == "1" ]]; then
cnfg
local stage_prompt="Systemd-boot"
if arch-chroot /mnt <<-BOOTCTL > /dev/null 2>&1 ; then
bootctl install || exit
echo "default arch.conf" > /boot/loader/loader.conf || exit
echo "
title ${entrname}
linux /vmlinuz-${kernel}
initrd /initramfs-${kernel}.img
options rw ${boot_opts}" | tee /boot/loader/entries/arch.conf || exit
systemctl enable systemd-boot-update || exit
BOOTCTL
stage_ok
else
stage_fail
fi
elif [[ "${bootloader}" == "2" ]]; then
cnfg
local stage_prompt="Grub"
if arch-chroot /mnt <<-GRUB > /dev/null 2>&1 ; then
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB || exit
sed -i \
-e 's|^GRUB_CMDLINE_LINUX_DEFAULT.*|GRUB_CMDLINE_LINUX_DEFAULT="${boot_opts}"|g' \
-e "/^#GRUB_DISABLE_OS_PROBER=false/s/^#//" \
/etc/default/grub || exit
grub-mkconfig -o /boot/grub/grub.cfg || exit
GRUB
stage_ok
else
stage_fail
fi
if [[ "${fs}" == "2" ]]; then
cnfg
local stage_prompt="Grub-Btrfsd"
if arch-chroot /mnt <<-GRUB_BTRFSD > /dev/null 2>&1 ; then
systemctl enable grub-btrfsd || exit
GRUB_BTRFSD
stage_ok
else
stage_fail
fi
fi
if [[ "${vgaconf}" == "y" && "${vendor}" == "Nvidia" ]]; then
cnfg
local stage_prompt="Grub-Nvidia"
if arch-chroot /mnt <<-NVIDIA_GRUB > /dev/null 2>&1 ; then
sed -i "/^#GRUB_TERMINAL_OUTPUT=console/s/^#//" /etc/default/grub || exit
grub-mkconfig -o /boot/grub/grub.cfg || exit
NVIDIA_GRUB
stage_ok
else
stage_fail
fi
fi
fi
}
###################################################################################################
trim_conf (){
if [[ -n "${trim}" ]]; then
cnfg
local stage_prompt="Trim Service"
if arch-chroot /mnt <<-TRIM > /dev/null 2>&1 ; then
systemctl enable ${trim} || exit
TRIM
stage_ok
else
stage_fail
fi
fi
}
###################################################################################################
vm_serv_conf (){
if [[ -n "${vm_services}" ]]; then
cnfg
local stage_prompt="VM Service(s)"
if arch-chroot /mnt <<-VM > /dev/null 2>&1 ; then
systemctl enable ${vm_services} || exit
VM
stage_ok
else
stage_fail
fi
fi
}
###################################################################################################
nvidia_serv_conf (){
if [[ -n "${nvidia_services}" ]]; then
cnfg
local stage_prompt="Nvidia Services"
if arch-chroot /mnt <<-NVIDIA_SERV > /dev/null 2>&1 ; then
systemctl enable ${nvidia_services} || exit
NVIDIA_SERV
stage_ok
else
stage_fail
fi
fi
}
###################################################################################################
zram_conf (){
if [[ -n "${zram}" ]]; then
cnfg
local stage_prompt="Zram Swap"
zram_service="systemd-zram-setup@zram0.service"
if arch-chroot /mnt <<-ZRAM > /dev/null 2>&1 ; then
mkdir -p /etc/systemd/zram-generator.conf.d
echo "
[zram0]
zram-size = ram / 2
compression-algorithm = zstd" | tee /etc/systemd/zram-generator.conf.d/zram.conf || exit
systemctl daemon-reload || exit
systemctl start ${zram_service} || exit
ZRAM
stage_ok
else
stage_fail
fi
fi
}
###################################################################################################
nvidia_hook_conf (){
if [[ "${vgaconf}" == "y" && "${vendor}" == "Nvidia" ]]; then
if [[ "${kernelnmbr}" == "1" ]] || [[ "${kernelnmbr}" == "2" && "${family}" == "1" ]] || [[ "${kernelnmbr}" == "2" && "${family}" == "2" && "${nvdriver}" == "2" ]]; then
cnfg
local stage_prompt="Nvidia-Hook"
if arch-chroot /mnt <<-NVIDIA_HOOK > /dev/null 2>&1 ; then
mkdir -p /etc/pacman.d/hooks/ || exit
echo "
[Trigger]
Operation=Install
Operation=Upgrade
Operation=Remove
Type=Package
Target=${nvname}
Target=${kernel}
[Action]
Description=Update NVIDIA module in initcpio
Depends=mkinitcpio
When=PostTransaction
NeedsTargets
Exec=/bin/sh -c 'while read -r trg; do case $trg in linux*) exit 0; esac; done; /usr/bin/mkinitcpio -P' " | tee /etc/pacman.d/hooks/nvidia.hook || exit
NVIDIA_HOOK
stage_ok
else
stage_fail
fi
fi
fi
}
###################################################################################################
chroot_conf (){ chroot_conf (){
sleep 0.3 sleep 0.3
@ -4726,7 +4900,7 @@ ${magenta}###${nc}--------------------------------${magenta}[ ${bwhite}Chroot &
" "
# Linux-Hardened = No Swap # Linux-Hardened = No Swap
if [[ "${kernelnmbr}" == "3" ]]; then if [[ "${kernelnmbr}" == "3" ]]; then
swapmode="3" swapmode="4"
fi fi
#### Encrypted Setup Vars #### Encrypted Setup Vars
@ -4756,8 +4930,11 @@ ${magenta}###${nc}--------------------------------${magenta}[ ${bwhite}Chroot &
fi fi
# Encrypted Swapfile Kernel Boot Options # Encrypted Swapfile Kernel Boot Options
encr_swap_bootopts="resume=${encr_root_dev} resume_offset=${offst} " encr_swap_bootopts="resume=${encr_root_dev} resume_offset=${offst} "
## No Swap ## Zram Swap
elif [[ "${swapmode}" == "3" ]]; then elif [[ "${swapmode}" == "3" ]]; then
zram_bootopts="zswap.enabled=0"
## No Swap
elif [[ "${swapmode}" == "4" ]]; then
# No Swap Kernel Boot Options # No Swap Kernel Boot Options
encr_swap_bootopts="" encr_swap_bootopts=""
fi fi
@ -4829,11 +5006,15 @@ ${magenta}###${nc}--------------------------------${magenta}[ ${bwhite}Chroot &
fi fi
fi fi
### Kernel Boot Options (Encryption) ### Kernel Boot Options (Encryption)
boot_opts="${encr_root_bootopts}${encr_swap_bootopts}${vga_bootopts}${cust_bootopts}${btrfs_bootopts}" boot_opts="${encr_root_bootopts}${encr_swap_bootopts}${vga_bootopts}${cust_bootopts}${btrfs_bootopts}${zram_bootopts}"
#------------------------------------------------------------------------------------------------------------- #-------------------------------------------------------------------------------------------------------------
#### Unencrypted Setup Vars #### Unencrypted Setup Vars
elif [[ "${encrypt}" == "no" ]]; then elif [[ "${encrypt}" == "no" ]]; then
### Swap Setup
if [[ "${swapmode}" == "3" ]]; then
zram_bootopts="zswap.enabled=0"
fi
### Graphics Setup ### Graphics Setup
## Configuration = 'Yes' ## Configuration = 'Yes'
if [[ "${vgaconf}" == "y" ]]; then if [[ "${vgaconf}" == "y" ]]; then
@ -4903,16 +5084,15 @@ ${magenta}###${nc}--------------------------------${magenta}[ ${bwhite}Chroot &
if [[ "${autoroot}" == "y" ]]; then if [[ "${autoroot}" == "y" ]]; then
### Kernel Boot Options [Multi-Root Disk] (No Encryption) ### Kernel Boot Options [Multi-Root Disk] (No Encryption)
boot_opts="${multiroot_opts}${vga_bootopts}${cust_bootopts}${btrfs_bootopts}" boot_opts="${multiroot_opts}${vga_bootopts}${cust_bootopts}${btrfs_bootopts}${zram_bootopts}"
else else
### Kernel Boot Options [Single Root Disk] (No Encryption) ### Kernel Boot Options [Single Root Disk] (No Encryption)
boot_opts="${vga_bootopts}${cust_bootopts}${btrfs_bootopts}" boot_opts="${vga_bootopts}${cust_bootopts}${btrfs_bootopts}${zram_bootopts}"
fi fi
fi fi
#-------------------------------------------------------------------------------------------------- #--------------------------------------------------------------------------------------------------
# NOTE: All Vanilla Desktops Basic Configuration: # 'VANILLA Desktops' Configuration:
if [[ "${packages}" =~ ^(1|3|5|6|7|8|9|10|11)$ ]]; then if [[ "${packages}" =~ ^(1|3|5|6|7|8|9|10|11)$ ]]; then
cnfg cnfg
stage_prompt="Basic System" stage_prompt="Basic System"
@ -4943,7 +5123,6 @@ VANILLA_CONF
else else
stage_fail stage_fail
fi fi
if [[ -f /mnt/etc/lightdm/lightdm.conf ]]; then if [[ -f /mnt/etc/lightdm/lightdm.conf ]]; then
cnfg cnfg
if [[ "${packages}" == "7" ]]; then if [[ "${packages}" == "7" ]]; then
@ -4975,66 +5154,6 @@ SLICK
fi fi
fi fi
fi fi
if [[ "${bootloader}" == "1" ]]; then
cnfg
stage_prompt="Systemd-boot"
if arch-chroot /mnt <<-BOOTCTL > /dev/null 2>&1 ; then
bootctl install || exit
echo "default arch.conf" > /boot/loader/loader.conf || exit
echo "
title ${entrname}
linux /vmlinuz-${kernel}
initrd /initramfs-${kernel}.img
options rw ${boot_opts}" | tee /boot/loader/entries/arch.conf || exit
systemctl enable systemd-boot-update || exit
BOOTCTL
stage_ok
else
stage_fail
fi
elif [[ "${bootloader}" == "2" ]]; then
cnfg
stage_prompt="Grub"
if arch-chroot /mnt <<-GRUB > /dev/null 2>&1 ; then
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB || exit
sed -i \
-e 's|^GRUB_CMDLINE_LINUX_DEFAULT.*|GRUB_CMDLINE_LINUX_DEFAULT="${boot_opts}"|g' \
-e "/^#GRUB_DISABLE_OS_PROBER=false/s/^#//" \
/etc/default/grub || exit
grub-mkconfig -o /boot/grub/grub.cfg || exit
GRUB
stage_ok
else
stage_fail
fi
if [[ "${fs}" == "2" ]]; then
cnfg
stage_prompt="Grub-Btrfsd"
if arch-chroot /mnt <<-GRUB_BTRFSD > /dev/null 2>&1 ; then
systemctl enable grub-btrfsd || exit
GRUB_BTRFSD
stage_ok
else
stage_fail
fi
fi
if [[ "${vgaconf}" == "y" && "${vendor}" == "Nvidia" ]]; then
cnfg
stage_prompt="Grub-Nvidia"
if arch-chroot /mnt <<-NVIDIA_GRUB > /dev/null 2>&1 ; then
sed -i "/^#GRUB_TERMINAL_OUTPUT=console/s/^#//" /etc/default/grub || exit
grub-mkconfig -o /boot/grub/grub.cfg || exit
NVIDIA_GRUB
stage_ok
else
stage_fail
fi
fi
fi
if [[ -n "${bluetooth}" ]]; then if [[ -n "${bluetooth}" ]]; then
cnfg cnfg
stage_prompt="Bluetooth Service" stage_prompt="Bluetooth Service"
@ -5046,7 +5165,6 @@ BLUETOOTH
stage_fail stage_fail
fi fi
fi fi
if [[ -n "${displaymanager}" ]]; then if [[ -n "${displaymanager}" ]]; then
cnfg cnfg
stage_prompt="Display Manager Service" stage_prompt="Display Manager Service"
@ -5058,7 +5176,6 @@ DM_SERVICE
stage_fail stage_fail
fi fi
fi fi
if [[ -n "${network}" ]]; then if [[ -n "${network}" ]]; then
cnfg cnfg
stage_prompt="Network Manager Service" stage_prompt="Network Manager Service"
@ -5070,91 +5187,111 @@ NETWORK
stage_fail stage_fail
fi fi
fi fi
if [[ -n "${trim}" ]]; then btldr_conf
trim_conf
vm_serv_conf
nvidia_serv_conf
zram_conf
nvidia_hook_conf
completion
fi
#--------------------------------------------------------------------------------------------------
# 'Custom System' Configuration (Add any extra configuration below):
if [[ "${packages}" == "12" ]]; then
cnfg cnfg
stage_prompt="Trim Service" stage_prompt="Basic System"
if arch-chroot /mnt <<-TRIM > /dev/null 2>&1 ; then if arch-chroot /mnt <<-CUSTOM_CONF > /dev/null 2>&1 ; then
systemctl enable ${trim} || exit sed -i "/^#${SETLOCALE}/s/^#//" /etc/locale.gen || exit
TRIM locale-gen || exit
stage_ok echo LANG=${SETLOCALE} > /etc/locale.conf || exit
else export LANG=${SETLOCALE} || exit
stage_fail echo KEYMAP=${SETKBD} > /etc/vconsole.conf || exit
fi
fi
if [[ -n "${vm_services}" ]]; then
cnfg
stage_prompt="VM Service(s)"
if arch-chroot /mnt <<-VM > /dev/null 2>&1 ; then
systemctl enable ${vm_services} || exit
VM
stage_ok
else
stage_fail
fi
fi
if [[ -n "${nvidia_services}" ]]; then
cnfg
stage_prompt="Nvidia Services"
if arch-chroot /mnt <<-NVIDIA_SERV > /dev/null 2>&1 ; then
systemctl enable ${nvidia_services} || exit
NVIDIA_SERV
stage_ok
else
stage_fail
fi
fi
if [[ "${vgaconf}" == "y" && "${vendor}" == "Nvidia" ]]; then
if [[ "${kernelnmbr}" == "1" ]] || [[ "${kernelnmbr}" == "2" && "${family}" == "1" ]] || [[ "${kernelnmbr}" == "2" && "${family}" == "2" && "${nvdriver}" == "2" ]]; then
cnfg
stage_prompt="Nvidia-Hook"
if arch-chroot /mnt <<-NVIDIA_HOOK > /dev/null 2>&1 ; then
mkdir -p /etc/pacman.d/hooks/ || exit
echo " echo "
[Trigger] ${mkinitcpio_mods}
Operation=Install ${mkinitcpio_hooks}" | tee /etc/mkinitcpio.conf.d/mkinitcpiod.conf || exit
Operation=Upgrade mkinitcpio -P || exit
Operation=Remove ln -sf /usr/share/zoneinfo/$(curl -s http://ip-api.com/line?fields=timezone) /etc/localtime || exit
Type=Package hwclock --systohc || exit
Target=${nvname} echo ${HOSTNAME} > /etc/hostname || exit
Target=${kernel} echo "
127.0.0.1 localhost
[Action] ::1 localhost
Description=Update NVIDIA module in initcpio 127.0.1.1 ${HOSTNAME}.localdomain ${HOSTNAME}" >> /etc/hosts || exit
Depends=mkinitcpio echo root:${ROOTPASSWD2} | chpasswd || exit
When=PostTransaction useradd -m -G wheel -s /bin/bash ${USERNAME} || exit
NeedsTargets echo ${USERNAME}:${USERPASSWD2} | chpasswd || exit
Exec=/bin/sh -c 'while read -r trg; do case $trg in linux*) exit 0; esac; done; /usr/bin/mkinitcpio -P' " | tee /etc/pacman.d/hooks/nvidia.hook || exit echo "%wheel ALL=(ALL) ALL" | tee /etc/sudoers.d/sudoersd || exit
NVIDIA_HOOK visudo -c /etc/sudoers.d/sudoersd || exit
CUSTOM_CONF
stage_ok
else
stage_fail
fi
if [[ -f /mnt/etc/lightdm/lightdm.conf ]]; then
cnfg
if [[ "${greeternmbr}" == "1" ]]; then
stage_prompt="GTK Greeter"
if arch-chroot /mnt <<-GTK > /dev/null 2>&1 ; then
sed -i 's|^#greeter-session=example-gtk-gnome|greeter-session=lightdm-gtk-greeter|g' /etc/lightdm/lightdm.conf || exit
GTK
stage_ok
else
stage_fail
fi
elif [[ "${greeternmbr}" == "2" ]]; then
stage_prompt="Slick Greeter"
if arch-chroot /mnt <<-SLICK > /dev/null 2>&1 ; then
sed -i 's|^#greeter-session=example-gtk-gnome|greeter-session=lightdm-slick-greeter|g' /etc/lightdm/lightdm.conf || exit
SLICK
stage_ok
else
stage_fail
fi
elif [[ "${greeternmbr}" == "3" ]]; then
stage_prompt="Deepin Greeter"
if arch-chroot /mnt <<-DEEPIN > /dev/null 2>&1 ; then
sed -i 's|^#greeter-session=example-gtk-gnome|greeter-session=lightdm-deepin-greeter|g' /etc/lightdm/lightdm.conf || exit
DEEPIN
stage_ok stage_ok
else else
stage_fail stage_fail
fi fi
fi fi
fi fi
if [[ -n "${customservices}" ]]; then
cnfg
stage_prompt="Custom Service(s)"
if arch-chroot /mnt <<-CUSTOM_SERV > /dev/null 2>&1 ; then
systemctl enable ${customservices} || exit
CUSTOM_SERV
stage_ok
else
stage_fail
fi
fi
btldr_conf
trim_conf
vm_serv_conf
nvidia_serv_conf
zram_conf
nvidia_hook_conf
completion completion
fi fi
#-------------------------------------------------------------------------------------------------- #--------------------------------------------------------------------------------------------------
# NOTE: Plasma / Gnome & Systemd-boot Optimized-System Configuration: # NOTE: Plasma / Gnome & Systemd-boot Optimized-System Configuration:
if [[ "${packages}" == "2" || "${packages}" == "4" ]]; then
if [[ "${packages}" == "2" ]] || [[ "${packages}" == "4" ]]; then
stage_prompt="Custom System" stage_prompt="Custom System"
cnfg cnfg
if [[ "${packages}" == "2" ]]; then if [[ "${packages}" == "2" ]]; then
displaymanager="sddm" displaymanager="sddm"
elif [[ "${packages}" == "4" ]]; then elif [[ "${packages}" == "4" ]]; then
displaymanager="gdm" displaymanager="gdm"
fi fi
if [[ -n "${nrg_plc}" ]]; then if [[ -n "${nrg_plc}" ]]; then
arch-chroot /mnt <<-NRG > /dev/null 2>&1 arch-chroot /mnt <<-NRG > /dev/null 2>&1
${nrg_plc} performance ${nrg_plc} performance
NRG NRG
fi fi
if arch-chroot /mnt <<-OPTIMIZED_CONF > /dev/null 2>&1 ; then if arch-chroot /mnt <<-OPTIMIZED_CONF > /dev/null 2>&1 ; then
sed -i "/^#${SETLOCALE}/s/^#//" /etc/locale.gen || exit sed -i "/^#${SETLOCALE}/s/^#//" /etc/locale.gen || exit
locale-gen || exit locale-gen || exit
@ -5292,229 +5429,8 @@ OPTIMIZED_CONF
else else
stage_fail stage_fail
fi fi
zram_conf
if [[ "${vgaconf}" == "y" && "${vendor}" == "Nvidia" ]]; then nvidia_hook_conf
if [[ "${kernelnmbr}" == "1" ]] || [[ "${kernelnmbr}" == "2" && "${family}" == "1" ]] || [[ "${kernelnmbr}" == "2" && "${family}" == "2" && "${nvdriver}" == "2" ]]; then
cnfg
stage_prompt="Nvidia-Hook"
if arch-chroot /mnt <<-NVIDIAHOOK > /dev/null 2>&1 ; then
mkdir -p /etc/pacman.d/hooks/ || exit
echo "
[Trigger]
Operation=Install
Operation=Upgrade
Operation=Remove
Type=Package
Target=${nvname}
Target=${kernel}
[Action]
Description=Update NVIDIA module in initcpio
Depends=mkinitcpio
When=PostTransaction
NeedsTargets
Exec=/bin/sh -c 'while read -r trg; do case $trg in linux*) exit 0; esac; done; /usr/bin/mkinitcpio -P' " | tee /etc/pacman.d/hooks/nvidia.hook || exit
NVIDIAHOOK
stage_ok
else
stage_fail
fi
fi
fi
completion
fi
#--------------------------------------------------------------------------------------------------
# NOTE: Custom System Configuration (Add any extra configuration below):
if [[ "${packages}" == "12" ]]; then
cnfg
stage_prompt="Basic System"
if arch-chroot /mnt <<-CUSTOM_CONF > /dev/null 2>&1 ; then
sed -i "/^#${SETLOCALE}/s/^#//" /etc/locale.gen || exit
locale-gen || exit
echo LANG=${SETLOCALE} > /etc/locale.conf || exit
export LANG=${SETLOCALE} || exit
echo KEYMAP=${SETKBD} > /etc/vconsole.conf || exit
echo "
${mkinitcpio_mods}
${mkinitcpio_hooks}" | tee /etc/mkinitcpio.conf.d/mkinitcpiod.conf || exit
mkinitcpio -P || exit
ln -sf /usr/share/zoneinfo/$(curl -s http://ip-api.com/line?fields=timezone) /etc/localtime || exit
hwclock --systohc || exit
echo ${HOSTNAME} > /etc/hostname || exit
echo "
127.0.0.1 localhost
::1 localhost
127.0.1.1 ${HOSTNAME}.localdomain ${HOSTNAME}" >> /etc/hosts || exit
echo root:${ROOTPASSWD2} | chpasswd || exit
useradd -m -G wheel -s /bin/bash ${USERNAME} || exit
echo ${USERNAME}:${USERPASSWD2} | chpasswd || exit
echo "%wheel ALL=(ALL) ALL" | tee /etc/sudoers.d/sudoersd || exit
visudo -c /etc/sudoers.d/sudoersd || exit
CUSTOM_CONF
stage_ok
else
stage_fail
fi
if [[ -f /mnt/etc/lightdm/lightdm.conf ]]; then
cnfg
if [[ "${greeternmbr}" == "1" ]]; then
stage_prompt="GTK Greeter"
if arch-chroot /mnt <<-GTK > /dev/null 2>&1 ; then
sed -i 's|^#greeter-session=example-gtk-gnome|greeter-session=lightdm-gtk-greeter|g' /etc/lightdm/lightdm.conf || exit
GTK
stage_ok
else
stage_fail
fi
elif [[ "${greeternmbr}" == "2" ]]; then
stage_prompt="Slick Greeter"
if arch-chroot /mnt <<-SLICK > /dev/null 2>&1 ; then
sed -i 's|^#greeter-session=example-gtk-gnome|greeter-session=lightdm-slick-greeter|g' /etc/lightdm/lightdm.conf || exit
SLICK
stage_ok
else
stage_fail
fi
fi
fi
if [[ "${bootloader}" == "1" ]]; then
cnfg
stage_prompt="Systemd-boot"
if arch-chroot /mnt <<-BOOTCTL > /dev/null 2>&1 ; then
bootctl install || exit
echo "default arch.conf" > /boot/loader/loader.conf || exit
echo "
title ${entrname}
linux /vmlinuz-${kernel}
initrd /initramfs-${kernel}.img
options rw ${boot_opts}" | tee /boot/loader/entries/arch.conf || exit
systemctl enable systemd-boot-update || exit
BOOTCTL
stage_ok
else
stage_fail
fi
elif [[ "${bootloader}" == "2" ]]; then
cnfg
stage_prompt="Grub"
if arch-chroot /mnt <<-GRUB > /dev/null 2>&1 ; then
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB || exit
sed -i \
-e 's|^GRUB_CMDLINE_LINUX_DEFAULT.*|GRUB_CMDLINE_LINUX_DEFAULT="${boot_opts}"|g' \
-e "/^#GRUB_DISABLE_OS_PROBER=false/s/^#//" \
/etc/default/grub || exit
grub-mkconfig -o /boot/grub/grub.cfg || exit
GRUB
stage_ok
else
stage_fail
fi
if [[ "${fs}" == "2" ]]; then
cnfg
stage_prompt="Grub-Btrfsd"
if arch-chroot /mnt <<-GRUB_BTRFSD > /dev/null 2>&1 ; then
systemctl enable grub-btrfsd || exit
GRUB_BTRFSD
stage_ok
else
stage_fail
fi
fi
if [[ "${vgaconf}" == "y" && "${vendor}" == "Nvidia" ]]; then
cnfg
stage_prompt="Grub-Nvidia"
if arch-chroot /mnt <<-NVIDIA_GRUB > /dev/null 2>&1 ; then
sed -i "/^#GRUB_TERMINAL_OUTPUT=console/s/^#//" /etc/default/grub || exit
grub-mkconfig -o /boot/grub/grub.cfg || exit
NVIDIA_GRUB
stage_ok
else
stage_fail
fi
fi
fi
if [[ -n "${customservices}" ]]; then
cnfg
stage_prompt="Custom Service(s)"
if arch-chroot /mnt <<-CUSTOM_SERV > /dev/null 2>&1 ; then
systemctl enable ${customservices} || exit
CUSTOM_SERV
stage_ok
else
stage_fail
fi
fi
if [[ -n "${trim}" ]]; then
cnfg
stage_prompt="Trim Service"
if arch-chroot /mnt <<-TRIM > /dev/null 2>&1 ; then
systemctl enable ${trim} || exit
TRIM
stage_ok
else
stage_fail
fi
fi
if [[ -n "${vm_services}" ]]; then
cnfg
stage_prompt="VM Service(s)"
if arch-chroot /mnt <<-VM > /dev/null 2>&1 ; then
systemctl enable ${vm_services} || exit
VM
stage_ok
else
stage_fail
fi
fi
if [[ -n "${nvidia_services}" ]]; then
cnfg
stage_prompt="Nvidia Services"
if arch-chroot /mnt <<-NVIDIA_SERV > /dev/null 2>&1 ; then
systemctl enable ${nvidia_services} || exit
NVIDIA_SERV
stage_ok
else
stage_fail
fi
fi
if [[ "${vgaconf}" == "y" && "${vendor}" == "Nvidia" ]]; then
if [[ "${kernelnmbr}" == "1" ]] || [[ "${kernelnmbr}" == "2" && "${family}" == "1" ]] || [[ "${kernelnmbr}" == "2" && "${family}" == "2" && "${nvdriver}" == "2" ]]; then
cnfg
stage_prompt="Nvidia-Hook"
if arch-chroot /mnt <<-NVIDIA_HOOK > /dev/null 2>&1 ; then
mkdir -p /etc/pacman.d/hooks/ || exit
echo "
[Trigger]
Operation=Install
Operation=Upgrade
Operation=Remove
Type=Package
Target=${nvname}
Target=${kernel}
[Action]
Description=Update NVIDIA module in initcpio
Depends=mkinitcpio
When=PostTransaction
NeedsTargets
Exec=/bin/sh -c 'while read -r trg; do case $trg in linux*) exit 0; esac; done; /usr/bin/mkinitcpio -P' " | tee /etc/pacman.d/hooks/nvidia.hook || exit
NVIDIA_HOOK
stage_ok
else
stage_fail
fi
fi
fi
completion completion
fi fi
umount -R /mnt umount -R /mnt
@ -5594,7 +5510,9 @@ NVIDIA_HOOK
autopart="" autopart=""
prcnt="" prcnt=""
roottype="" roottype=""
stage_prompt='' stage_prompt=""
zram=""
zram_bootopts=""
clear clear
first_check first_check