From 294e05deec670753d528feeb6523495f642cbd5e Mon Sep 17 00:00:00 2001 From: Jane Doe Date: Sat, 8 Jun 2024 21:23:53 +0000 Subject: [PATCH] Visual prompts added/replaced If no Kernel has been selected, the 'Graphics Setup' stage will now send you to the 'Kernel & Bootloader Selection' stage first If no filesystem has been selected, the 'Graphics Setup' stage will now send you to the 'Filesystem & Swap Selection' stage first Reselecting any Kernel from 'Kernel Selection' stage now forces a re-run of the 'Graphics Setup' stage (if already run) Reselecting a filesystem from 'Filesystem Selection' stage now forces a re-run of the 'Graphics Setup' stage (if already run) Reselecting any Swap type from 'Swap Setup' stage now forces a re-run of the 'Graphics Setup' stage (if already run) If Linux Hardened Kernel is selected and Swap is concurrently selected, the installer issues a warning and defaults to 'No Swap' setting Selecting 'n' to configure single-graphics Nvidia setup defaults to 'nouveau' Selecting 'n' to configure a multi-graphics setup including Nvidia, defaults to open-source drivers If an AMD gpu & Nvidia gpu are detected and 'Nvidia-Open' drivers are selected, then the installer issues a warning and then a 'Confirmation' prompt Nvidia's 'Suspend-Hibernate-Resume' Video-Memory Preserving feature from the Proprietary Nvidia driver can be auto-configured If Nvidia's 'Suspend-Hibernate-Resume' Video-Memory Preserving feature is selected and Swap has not been set or Linux 'Hardened' Kernel has been selected, the feature will not be enabled System installation/configuration is now silent (not verbose), the installer will inform if/where errors occur and abort installation Services are explicitly activated now Code cleanup and indentation --- Amelia.sh | 935 ++++++++++++++++++++++++++++++++---------------------- 1 file changed, 547 insertions(+), 388 deletions(-) diff --git a/Amelia.sh b/Amelia.sh index 620209e..9227fe2 100644 --- a/Amelia.sh +++ b/Amelia.sh @@ -1,13 +1,12 @@ #!/bin/bash # Amelia Installer -# Version: 5.0 +# Version: 5.1 set -euo pipefail trap 's=$?; echo "$0: Error on line "$LINENO": $BASH_COMMAND"; exit $s' ERR ################################################################################################### # COLOR FUNCTIONS - redbgbl="\e[5;1;41m" #blink bg redbg="\e[1;41m" #bg red="\e[31m" @@ -89,18 +88,15 @@ NC (){ WHITEB (){ echo -e "${bwhite} $1${nc}" } - # END COLOR FUNCTIONS ################################################################################################### # PROMPT FUNCTIONS - skip (){ sleep 0.3 YELLOW " --> Skipping.. " } - reload (){ sleep 0.3 NC " @@ -108,7 +104,6 @@ reload (){ --> [${green}Reloading${nc}] " } - invalid (){ sleep 0.3 RED " @@ -116,7 +111,6 @@ invalid (){ [!] Invalid response " reload } - err_try (){ sleep 0.3 RED " @@ -124,144 +118,103 @@ err_try (){ [!] Errors occured. Please try again.. " reload } - -abort (){ - sleep 0.3 - RED " - [!] Aborting.. - - - " - exit -} - err_abort (){ sleep 0.3 RED " [!] Errors occured " - abort + failure +} +vm_skip (){ + sleep 0.3 + YELLOW " + + ### Virtual Machine detected + " + skip } +line2 (){ + printf '\n\n' +} +line3 (){ + printf '\n\n\n' +} +unmount (){ + sleep 0.3 + RED " + + + [!] Unmounting and Retrying.. " + reload + sleep 0.3 + NC " + + +${magenta}###${nc}-----------------------------------${magenta}[ ${bwhite}Unmount Filesystems${nc} ${magenta}]${nc}-----------------------------------${magenta}###${nc} + " + if umount -R /mnt > /dev/null 2>&1 ; then + sleep 0.3 + NC " + +==> [${green}Unmount OK${nc}]" + else + sleep 0.3 + RED " + + + [!] Unmounting failed " + failure + fi +} umount_abort (){ - sleep 0.3 - RED " - - - [!] Errors occured - - - - [!] Unmounting and Retrying.. " - reload - sleep 0.3 - NC " - - -${magenta}###${nc}-----------------------------------${magenta}[ ${bwhite}Unmount Filesystems${nc} ${magenta}]${nc}-----------------------------------${magenta}###${nc} - " - if umount -R /mnt > /dev/null 2>&1 ; then - sleep 0.3 - NC " - -==> [${green}Unmount OK${nc}]" - else - sleep 0.3 - RED " - - - [!] Unmounting failed " - NC " - " - abort - fi + unmount reload } - umount_manual (){ - sleep 0.3 - RED " - - - [!] Errors occured - - - - [!] Unmounting and Retrying.. " - reload - sleep 0.3 - NC " - - -${magenta}###${nc}-----------------------------------${magenta}[ ${bwhite}Unmount Filesystems${nc} ${magenta}]${nc}-----------------------------------${magenta}###${nc} - " - if umount -R /mnt > /dev/null 2>&1 ; then - sleep 0.3 - NC " - - - -==> [${green}Unmount OK${nc}]" - else - sleep 0.3 - RED " - - - [!] Unmounting failed " - abort - fi + unmount sleep 0.3 NC " --> [Switching to ${green}Manual Mode${nc}]" } - -err_swapfile (){ - sleep 0.3 - RED " - [!] Swapfile creation error " - abort -} - -err_reload (){ - sleep 0.3 - RED " - - [!] Errors occured " - reload -} - choice (){ sleep 0.3 RED " [!] Please make a choice to continue " reload } - ok (){ sleep 0.3 NC " ==> [${green}${prompt} OK${nc}] " } - stage_ok (){ sleep 0.3 NC " -==> [${green}${stage_prompt} configuration OK${nc}] - " +==> [${green}${stage_prompt} configuration OK${nc}] " sleep 2 } - stage_fail (){ sleep 0.3 RED " [!] ${stage_prompt} configuration FAILED " + failure } +completion_err (){ + sleep 0.3 + CYAN " + + + [!] Please complete '${stage_prompt}' to continue + " +} intel (){ + line2 BLUEBG " --------------------------------- " BLUEBG " ### INTEL Graphics detected ### " BLUEBG " --------------------------------- " @@ -270,8 +223,8 @@ intel (){ * ${vgacard} " } - nvidia (){ + line2 GREENBG " ---------------------------------- " GREENBG " ### NVIDIA Graphics detected ### " GREENBG " ---------------------------------- " @@ -280,8 +233,8 @@ nvidia (){ * ${vgacard} " } - amd (){ + line2 REDBG " ------------------------------- " REDBG " ### AMD Graphics detected ### " REDBG " ------------------------------- " @@ -290,42 +243,49 @@ amd (){ * ${vgacard} " } - +arch (){ + sleep 0.3 + line3 + BLUEBG "************************************************************************************************* " + BLUEBG " " + BLUEBG " ##### ARCH LINUX INSTALLATION ##### " + BLUEBG " " + BLUEBG "************************************************************************************************* " + line2 +} +cnfg (){ + line3 + YELLOWBGBL "--------------------------------------------------------------------------------------------------" + YELLOWBGBL " ### Configuring... ### " + YELLOWBGBL "--------------------------------------------------------------------------------------------------" + echo + sleep 0.3 +} completion (){ sleep 0.3 - NC " - - " - GREENBG "************************************************************************************************* " - GREENBG " " - GREENBG " ### Installation Completed ### " - GREENBG " " - GREENBG "************************************************************************************************* " - NC " - - " + line3 + GREENBGBL "************************************************************************************************* " + GREENBGBL " " + GREENBGBL " ### Installation Completed ### " + GREENBGBL " " + GREENBGBL "************************************************************************************************* " + line3 } - failure (){ sleep 0.3 - NC " - - " - REDBG "************************************************************************************************* " - REDBG " " - REDBG " ### Installation Failed ### " - REDBG " " - REDBG "************************************************************************************************* " - NC " - - " + line3 + REDBGBL "************************************************************************************************* " + REDBGBL " " + REDBGBL " ### Installation Failed ### " + REDBGBL " " + REDBGBL "************************************************************************************************* " + line3 exit } # END PROMPT FUNCTIONS ################################################################################################### # FUNCTIONS - first_check (){ if [[ "${tty}" == *"tty"* && -f /usr/share/kbd/consolefonts/ter-v18b.psf.gz && -f /usr/share/kbd/consolefonts/ter-v32b.psf.gz ]]; then @@ -335,13 +295,13 @@ first_check (){ echo fi if [[ "${run_as}" == "root" ]]; then - REDBG " ---------------------------------------- " - REDBG " ### The Installer Runs In ROOT Mode ### " - REDBG " ---------------------------------------- " + REDBGBL " ---------------------------------------- " + REDBGBL " ### The Installer Runs In ROOT Mode ### " + REDBGBL " ---------------------------------------- " else - BLUEBGBL " ---------------------------------------- " - BLUEBGBL " ### The Installer Runs In DEMO Mode ### " - BLUEBGBL " ---------------------------------------- " + YELLOWBGBL " ---------------------------------------- " + YELLOWBGBL " ### The Installer Runs In DEMO Mode ### " + YELLOWBGBL " ---------------------------------------- " fi } ################################################################################################### @@ -394,8 +354,9 @@ ${magenta}###${nc}---------------------------------${magenta}[ ${bwhite}UEFI Mod ok else RED " + [!] Not in UEFI Mode " - abort + failure fi } ################################################################################################### @@ -415,7 +376,7 @@ ${magenta}###${nc}--------------------------------${magenta}[ ${bwhite}Internet RED " [!] An active internet connection is mandatory to continue " - abort + failure fi } ################################################################################################### @@ -574,7 +535,7 @@ ${magenta}###${nc}------------------------------------${magenta}[ ${bwhite}Local ### [Hit ${nc}'l'${yellow} to list locales, then ${nc}'enter'${yellow} to search or ${nc}'q'${yellow} to quit] - ### Type only xx_XX (e.g. en_US )" + ### Exclude '.UTF_8' suffix " BLUE " @@ -587,7 +548,7 @@ Enter your Locale ${bwhite}(empty for 'en_US')${blue}: " sleep 0.3 YELLOW " - ### 'en_US.UTF-8' Locale has been selected + ### en_US.UTF-8 Locale has been selected " elif [[ "${LOCALESET}" == "l" ]]; then grep -E 'UTF-8' /usr/share/i18n/SUPPORTED | more @@ -600,7 +561,7 @@ Enter your Locale ${bwhite}(empty for 'en_US')${blue}: " sleep 0.3 YELLOW " - ### '${SETLOCALE}' Locale has been selected + ### ${SETLOCALE} Locale has been selected " fi ok @@ -634,7 +595,7 @@ Enter your keyboard layout ${bwhite}(empty for 'us')${blue}: " sleep 0.3 YELLOW " - ### 'us' Keyboard Layout has been selected + ### us Keyboard Layout has been selected " elif [[ "${SETKBD}" == "l" ]]; then localectl list-keymaps | more @@ -646,7 +607,7 @@ Enter your keyboard layout ${bwhite}(empty for 'us')${blue}: " sleep 0.3 YELLOW " - ### '${SETKBD}' Keyboard Layout has been selected + ### ${SETKBD} Keyboard Layout has been selected " loadkeys "${SETKBD}" > /dev/null 2>&1 fi @@ -913,10 +874,15 @@ Enter a number: " if [[ "${kernelnmbr}" == "3" ]]; then CYAN " - [!] Swapping is not supported + [!] Swapping is not supported [!] " fi ok + if [[ "${vga_slct}" == "yes" ]]; then + local stage_prompt="Graphics Setup" + completion_err + until dtct_vga; do : ; done + fi } ################################################################################################### ask_bootldr (){ @@ -1071,6 +1037,26 @@ Enter a number: " case "${swapmode}" in 1) + if [[ "${kernelnmbr}" == "3" ]]; then + sleep 0.3 + RED " + + + [!] Incompatible Kernel has been detected [!] " + CYAN " + [!] Swap type will default to 'None' [!] + " + sleep 3 + swapmode="3" + skip + ok + if [[ "${vga_slct}" == "yes" ]]; then + local stage_prompt="Graphics Setup" + completion_err + until dtct_vga; do : ; done + fi + return 0 + fi swaptype="swappart" sleep 0.3 YELLOW " @@ -1078,6 +1064,26 @@ Enter a number: " ### Swap Partition has been selected " ;; 2) + if [[ "${kernelnmbr}" == "3" ]]; then + sleep 0.3 + RED " + + + [!] Incompatible Kernel has been detected [!] " + CYAN " + [!] Swap type will default to 'None' [!] + " + sleep 4 + swapmode="3" + skip + ok + if [[ "${vga_slct}" == "yes" ]]; then + local stage_prompt="Graphics Setup" + completion_err + until dtct_vga; do : ; done + fi + return 0 + fi if [[ "${fs}" == "1" ]]; then swaptype="swapfile" elif [[ "${fs}" == "2" ]]; then @@ -1109,6 +1115,11 @@ Enter a number: " return 1 ;; esac ok + if [[ "${vga_slct}" == "yes" ]]; then + local stage_prompt="Graphics Setup" + completion_err + until dtct_vga; do : ; done + fi } ################################################################################################### set_swapsize (){ @@ -1126,8 +1137,7 @@ Enter Swapfile size ${bwhite}(in GiB)${blue}: " RED " [!] Please enter a value to continue " reload - NC " - " + line2 return 1 elif [[ "${swapsize}" =~ [[:digit:]] ]]; then ok @@ -1136,14 +1146,27 @@ Enter Swapfile size ${bwhite}(in GiB)${blue}: " RED " [!] Please use only digits as a value " reload - NC " - " + line2 return 1 fi } ################################################################################################### dtct_vga (){ + if [[ -z "${kernelnmbr}" ]]; then + local stage_prompt="Kernel & Bootloader Selection" + completion_err + until slct_krnl; do : ; done + until ask_bootldr; do : ; done + return 1 + fi + if [[ -z "${fs}" ]]; then + local stage_prompt="Filesystem & Swap Selection" + completion_err + until ask_fs; do : ; done + until ask_swap; do : ; done + return 1 + fi sleep 0.3 NC " @@ -1169,27 +1192,21 @@ ${magenta}###${nc}-------------------------------------${magenta}[ ${bwhite}Grap ################################################################################################### dtct_single_vga (){ - local prompt="Graphics" + local prompt="Graphics Setup" if [[ "${intelcount}" -eq "1" ]]; then vendor="Intel" sourcetype="Open-source" sleep 0.3 - NC " - " intel elif [[ "${amdcount}" -eq "1" ]]; then vendor="AMD" sourcetype="Open-source" sleep 0.3 - NC " - " amd elif [[ "${nvidiacount}" -eq "1" ]]; then vendor="Nvidia" sourcetype="Proprietary" - NC " - " nvidia elif [[ "${hypervisor}" != "none" ]]; then vendor="Virtual Machine" @@ -1209,8 +1226,7 @@ dtct_single_vga (){ vmpkgs="hyperv" vm_services="hv_fcopy_daemon hv_kvp_daemon hv_vss_daemon" ;; esac - echo - skip + vm_skip ok return 0 fi @@ -1218,13 +1234,18 @@ dtct_single_vga (){ YELLOW " ### ${sourcetype} drivers will be used " if [[ "${vendor}" == "Nvidia" ]]; then - RED " + RED " [!] Only for NV110 (Maxwell) Graphics or newer [!]" fi YELLOW " - > Configure the Graphics subsystem and enable HW acceleration ? [y/n] " + > Configure the Graphics subsystem and enable HW acceleration ? [y/n] + " + if [[ "${vendor}" == "Nvidia" ]]; then + YELLOW " + ### Selecting 'n' defaults to the Open-source 'nouveau' driver" + fi BLUE " @@ -1237,7 +1258,7 @@ Enter [y/n]: " ################################################################################################### dtct_multi_vga (){ - local prompt="Graphics" + local prompt="Graphics Setup" if [[ "${vgacount}" == "2" ]]; then vga_setup="Dual" @@ -1290,7 +1311,7 @@ ${nvidiacards} > Configure the Graphics subsystem and enable HW acceleration for : " -#.................................................................................................. + if [[ -n "${vendor1}" && -n "${vendor2}" ]]; then NC " @@ -1313,9 +1334,8 @@ Enter a number: " else vendor="none" fi - fi - if [[ -n "${vendor1}" && -n "${vendor3}" ]]; then + elif [[ -n "${vendor1}" && -n "${vendor3}" ]]; then NC " [1] Intel @@ -1337,9 +1357,8 @@ Enter a number: " else vendor="none" fi - fi - if [[ -n "${vendor2}" && -n "${vendor3}" ]]; then + elif [[ -n "${vendor2}" && -n "${vendor3}" ]]; then NC " [1] Amd @@ -1362,17 +1381,14 @@ Enter a number: " vendor="none" fi fi - - if [[ "${vendor}" == "Intel" ]]; then - sourcetype="Open-source" - vgaconf="y" - elif [[ "${vendor}" == "AMD" ]]; then + if [[ "${vendor}" == "Intel" || "${vendor}" == "AMD" ]]; then sourcetype="Open-source" vgaconf="y" elif [[ "${vendor}" == "Nvidia" ]]; then sourcetype="Proprietary" vgaconf="y" elif [[ "${vendor}" == "none" ]]; then + sourcetype="" vgaconf="n" vgapkgs="" echo @@ -1382,6 +1398,8 @@ Enter a number: " fi sleep 0.3 YELLOW " + + ### ${sourcetype} drivers will be used " vga_conf @@ -1389,7 +1407,7 @@ Enter a number: " ################################################################################################### vga_conf (){ - local prompt="Graphics" + local prompt="Graphics Setup" if [[ "${vgaconf}" == "y" ]]; then if [[ "${vendor}" == "Intel" ]]; then @@ -1448,6 +1466,7 @@ Enter a number: " ==> " family if [[ "${family}" == "1" ]]; then + sleep 0.3 NC " ==> [${green}Maxwell+ OK${nc}] @@ -1455,6 +1474,8 @@ Enter a number: " elif [[ "${family}" == "2" ]]; then sleep 0.3 YELLOW " + + > Select Nvidia driver: " NC " @@ -1468,12 +1489,48 @@ Enter a number: " read -r -p " ==> " nvdriver - if [[ "${nvdriver}" == "1" ]]; then + if [[ "${nvdriver}" == "1" ]]; then + if [[ -n "${vendor2}" ]]; then + sleep 0.3 + YELLOW " + + ### AMD Graphics have also been detected " + RED " + [!] There may be incompatibilities with the 'Nvidia-Open' driver [!]" + YELLOW " + + + > Please confirm your selection: " + NC " + + [1] 'Nvidia-Open' driver + + [2] 'Nvidia' driver " + BLUE " + + +Enter a number: " + read -r -p " +==> " nvdriver + + if [[ "${nvdriver}" == "1" || "${nvdriver}" == "2" ]]; then + sleep 0.3 + NC " + +==> [${green}Driver Confirmed OK${nc}] " + else + echo + invalid + return 1 + fi + fi + sleep 0.3 NC " ==> [${green}Turing+ OK${nc}] " elif [[ "${nvdriver}" == "2" ]]; then + sleep 0.3 NC " ==> [${green}Turing+ OK${nc}] @@ -1524,6 +1581,40 @@ Enter a number: " fi fi fi + sleep 0.3 + YELLOW " + + + > Enable Nvidia's 'Suspend-Hibernate-Resume' Video Memory Preserving feature ? [y/n] " + BLUE " + + +Enter [y/n]: " + read -r -p " +==> " nvidia_suspend + + if [[ "${nvidia_suspend}" == "n" ]]; then + skip + elif [[ "${nvidia_suspend}" == "y" && "${swapmode}" == "3" ]]; then + sleep 0.3 + RED " + + [!] Incompatible 'No Swap' Setting has been detected " + CYAN " + [!] Nvidia's Video Memory Preserving feature will NOT be enabled [!] + " + sleep 3 + nvidia_suspend="n" + skip + elif [[ "${nvidia_suspend}" == "y" ]]; then + sleep 0.3 + YELLOW " + ### Nvidia's 'Suspend-Hibernate-Resume' Video Memory Preserving feature will be enabled " + else + echo + invalid + return 1 + fi fi sleep 0.3 YELLOW " @@ -1538,6 +1629,7 @@ Enter a number: " invalid return 1 fi + vga_slct="yes" ok } ################################################################################################### @@ -1931,12 +2023,8 @@ boot_entr (){ ${magenta}###${nc}--------------------------------${magenta}[ ${bwhite}EFI Boot Entries Deletion${nc} ${magenta}]${nc}--------------------------------${magenta}###${nc} " if [[ "${hypervisor}" != "none" ]]; then - sleep 0.3 - YELLOW " - - ### Virtual Machine detected - " - skip + efi_entr_del="yes" + vm_skip ok return 0 fi @@ -1994,12 +2082,8 @@ wireless_rgd (){ ${magenta}###${nc}----------------------------${magenta}[ ${bwhite}Wireless Regulatory Domain Setup${nc} ${magenta}]${nc}----------------------------${magenta}###${nc} " if [[ "${hypervisor}" != "none" ]]; then - sleep 0.3 - YELLOW " - - ### Virtual Machine detected - " - skip + wrlss_rgd="yes" + vm_skip ok return 0 fi @@ -2020,7 +2104,7 @@ Enter your Country Code, ie:${nc} ${cyan}US ${bwhite}(empty to skip)${blue}: " echo skip elif [[ "${REGDOM}" == "l" ]]; then - more /etc/conf.d/wireless-regdom + sed 's|^#WIRELESS_REGDOM=||g' /etc/conf.d/wireless-regdom |sed 's|"||g'| more return 1 elif [[ "${REGDOM}" =~ [[:lower:]] ]]; then sleep 0.3 @@ -2037,7 +2121,7 @@ Enter your Country Code, ie:${nc} ${cyan}US ${bwhite}(empty to skip)${blue}: " sleep 0.3 YELLOW " - ### '${REGDOM}' Country Code has been selected + ### ${REGDOM} Country Code has been selected " fi ok @@ -2080,7 +2164,7 @@ Enter a number: " until instl_dsk; do : ; done if [[ -z "${fs}" ]]; then sleep 0.3 - RED " + CYAN " @@ -2112,7 +2196,10 @@ ${magenta}###${nc}------------------------------------${magenta}[ ${bwhite}Disk while [[ -n "${gpt_dsk_nmbr}" ]]; do YELLOW " - > Select a disk to manage its GPT: " + > Select a disk to manage its GPT: + + + ### [Type ${nc}'?'${yellow} for help, ${nc}'x'${yellow} for extra functionality or ${nc}'q'${yellow} to quit]" NC " ${disks}" @@ -2267,6 +2354,7 @@ Enter a disk number: " if [[ "${run_as}" != "root" ]]; then sleep 0.3 RED " + [!] Root Privileges Missing.. " reload until dsks_submn; do : ; done @@ -2283,6 +2371,7 @@ Enter a disk number: " if [[ "${parttable}" != "gpt" ]]; then sleep 0.3 RED " + [!] No GPT found on selected disk " reload until gpt_mngr; do : ; done @@ -2573,7 +2662,7 @@ instl (){ install="yes" if [[ -z "${lcl_slct}" ]]; then sleep 0.3 - RED " + CYAN " [!] Please complete 'Locale & Keyboard Layout Selection' to continue @@ -2583,94 +2672,54 @@ instl (){ fi if [[ -z "${USERNAME}" ]]; then - sleep 0.3 - RED " - - - - [!] Please complete 'User, Root User & Hostname Setup' to continue - " + local stage_prompt="User, Root User & Hostname Setup" + completion_err until user_setup; do : ; done until rootuser_setup; do : ; done until slct_hostname; do : ; done fi if [[ -z "${kernelnmbr}" ]]; then - sleep 0.3 - RED " - - - - [!] Please complete 'Kernel & Bootloader Selection' to continue - " + local stage_prompt="Kernel & Bootloader Selection" + completion_err until slct_krnl; do : ; done until ask_bootldr; do : ; done fi if [[ -z "${fs}" ]]; then - sleep 0.3 - RED " - - - - [!] Please complete 'Filesystem & Swap Selection' to continue - " + local stage_prompt="Filesystem & Swap Selection" + completion_err until ask_fs; do : ; done until ask_swap; do : ; done fi if [[ -z "${vgaconf}" ]]; then - sleep 0.3 - RED " - - - - [!] Please complete 'Graphics Setup' to continue - " + local stage_prompt="Graphics Setup" + completion_err until dtct_vga; do : ; done fi if [[ -z "${packages}" ]]; then - sleep 0.3 - RED " - - - - [!] Please complete 'Desktop Setup' to continue - " + local stage_prompt="Desktop Setup" + completion_err until slct_dsktp; do : ; done fi if [[ -z "${efi_entr_del}" ]]; then - sleep 0.3 - RED " - - - - [!] Please complete 'EFI Boot Entries Deletion' to continue - " + local stage_prompt="EFI Boot Entries Deletion" + completion_err until boot_entr; do : ; done fi if [[ -z "${wrlss_rgd}" ]]; then - sleep 0.3 - RED " - - - - [!] Please complete 'Wireless Regulatory Domain Setup' to continue - " + local stage_prompt="Wireless Regulatory Domain Setup" + completion_err until wireless_rgd; do : ; done fi if [[ "${sanity}" != "ok" ]]; then - sleep 0.3 - RED " - - - - [!] Please complete 'Installation Disk' & 'Encryption' to continue - " + local stage_prompt="Installation Disk' & 'Encryption" + completion_err until instl_dsk; do : ; done until ask_crypt; do : ; done fi @@ -2699,7 +2748,7 @@ instl (){ ################################################################################################### swappart (){ - local prompt="Swap Partition" + local stage_prompt="Swap Partition" sleep 0.3 NC " @@ -2707,11 +2756,11 @@ swappart (){ ${magenta}###${nc}----------------------------------${magenta}[ ${bwhite}Swap Partition Setup${nc} ${magenta}]${nc}----------------------------------${magenta}###${nc} " if mkswap "${swap_dev}" > /dev/null 2>&1 ; then - swapon "${swap_dev}" > /dev/null 2>&1 || err_abort - ok + swapon "${swap_dev}" > /dev/null 2>&1 || stage_fail + stage_ok else swapoff "${swap_dev}" > /dev/null 2>&1 - err_abort + stage_fail fi } ################################################################################################### @@ -3393,24 +3442,7 @@ ${magenta}###${nc}-------------------------------${magenta}[ ${bwhite}Confirm In fi chroot_conf elif [[ "${agree}" == "no" ]]; then - reload - sleep 0.3 - NC " - - -${magenta}###${nc}-----------------------------------${magenta}[ ${bwhite}Unmount Filesystems${nc} ${magenta}]${nc}-----------------------------------${magenta}###${nc} - " - if umount -R /mnt > /dev/null 2>&1 ; then - sleep 0.3 - NC " - -==> [${green}Unmount OK${nc}]" - else - sleep 0.3 - RED " - [!] Unmounting failed " - abort - fi + unmount revise else sleep 0.3 @@ -3573,9 +3605,7 @@ ${magenta}###${nc}-------------------------------------${magenta}[ ${bwhite}LUKS until luks; do : ; done fi #-------------------------------------------------------------------------------------------------- - NC " - - " + line3 if [[ -e "${swap_dev}" ]]; then if cryptsetup -y -v luksFormat --label CRYPTSWAP "${swap_dev}"; then if [[ "${rota}" == "0" ]]; then @@ -3594,9 +3624,7 @@ ${magenta}###${nc}-------------------------------------${magenta}[ ${bwhite}LUKS fi fi #-------------------------------------------------------------------------------------------------- - NC " - - " + line3 if [[ "${homecrypt}" == "yes" ]]; then if cryptsetup -y -v luksFormat --label CRYPTHOME "${home_dev}"; then if [[ "${rota}" == "0" ]]; then @@ -3709,8 +3737,7 @@ Enter country name or country code ${bwhite}(Empty for Defaults)${blue}: " reflector --list-countries | more return 1 elif [[ -n "${COUNTRY}" ]] ; then - NC " - " + line2 if reflector --verbose -c "${COUNTRY}" -l 10 -p https -f 10 --sort rate --save /etc/pacman.d/mirrorlist ; then sleep 0.3 NC " @@ -3721,7 +3748,7 @@ Enter country name or country code ${bwhite}(Empty for Defaults)${blue}: " return 1 fi fi -#-------------------------------------------------------------------------------------------------- + YELLOW " @@ -3789,9 +3816,8 @@ pacstrap_system (){ ${magenta}###${nc}-------------------------------------${magenta}[ ${bwhite}Pacstrap System${nc} ${magenta}]${nc}-------------------------------------${magenta}###${nc} - - " + cnfg if [[ "${bootloader}" == "2" ]]; then if [[ "${fs}" == "1" ]]; then bootldr_pkgs="efibootmgr grub os-prober" @@ -3800,11 +3826,11 @@ ${magenta}###${nc}-------------------------------------${magenta}[ ${bwhite}Pacs fi fi if [[ "${vendor}" == "Virtual Machine" ]]; then - basepkgs="base nano sudo vim ${bootldr_pkgs} ${fstools} ${kernel} ${microcode} ${vmpkgs} ${devel}" + basepkgs="base pkgstats nano sudo vim ${bootldr_pkgs} ${fstools} ${kernel} ${microcode} ${vmpkgs} ${devel}" elif [[ "${vendor}" == "Nvidia" ]]; then - basepkgs="base linux-firmware 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}" else - basepkgs="base linux-firmware 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}" fi case "${packages}" in @@ -3817,7 +3843,7 @@ ${magenta}###${nc}-------------------------------------${magenta}[ ${bwhite}Pacs 2) # NOTE: Custom Plasma & Systemd-boot & Optimized System: - deskpkgs="${basepkgs} alsa-firmware alsa-utils arj ark bluedevil breeze-gtk ccache cups-pdf cups-pk-helper dolphin-plugins e2fsprogs efibootmgr exfatprogs fdkaac ffmpegthumbs firefox git glibc-locales gst-libav gst-plugin-libcamera gst-plugin-msdk gst-plugin-opencv gst-plugin-pipewire gst-plugin-qmlgl gst-plugin-va gst-plugin-wpe gst-plugins-ugly gstreamer-vaapi htop icoutils ipp-usb kamera kamoso kate kcalc kde-gtk-config kdegraphics-mobipocket kdegraphics-thumbnailers kdenetwork-filesharing kdeplasma-addons kdesdk-kio kdesdk-thumbnailers kdialog keditbookmarks kget kimageformats kinit kio-admin kio-gdrive kio-zeroconf kompare konsole kscreen kvantum kwrited libappimage libfido2 libktorrent libmms libnfs libva-utils lirc lrzip lua52-socket lzop mac man-db man-pages mesa-demos mesa-utils mold nano-syntax-highlighting nss-mdns ntfs-3g okular opus-tools p7zip packagekit-qt6 pacman-contrib partitionmanager pbzip2 pdfmixtool pigz pipewire-alsa pipewire-pulse pkgstats plasma-browser-integration plasma-desktop plasma-disks plasma-firewall plasma-nm plasma-pa plasma-wayland-protocols power-profiles-daemon powerdevil powerline powerline-fonts print-manager python-pyqt6 python-reportlab qbittorrent qt6-imageformats qt6-scxml qt6-virtualkeyboard realtime-privileges reflector rng-tools sddm-kcm skanlite sof-firmware sox spectacle sshfs system-config-printer terminus-font timidity++ ttf-ubuntu-font-family unarchiver unrar unzip usb_modeswitch usbutils vdpauinfo vlc vorbis-tools vorbisgain wget xdg-desktop-portal xdg-desktop-portal-gtk xdg-desktop-portal-kde xsane zip zsh zsh-autosuggestions zsh-completions zsh-syntax-highlighting ${nrg_plc}" ;; + deskpkgs="${basepkgs} alsa-firmware alsa-utils arj ark bluedevil breeze-gtk ccache cups-pdf cups-pk-helper dolphin-plugins e2fsprogs efibootmgr exfatprogs fdkaac ffmpegthumbs firefox git glibc-locales gst-libav gst-plugin-libcamera gst-plugin-msdk gst-plugin-opencv gst-plugin-pipewire gst-plugin-qmlgl gst-plugin-va gst-plugin-wpe gst-plugins-ugly gstreamer-vaapi htop icoutils ipp-usb irqbalance kamera kamoso kate kcalc kde-gtk-config kdegraphics-mobipocket kdegraphics-thumbnailers kdenetwork-filesharing kdeplasma-addons kdesdk-kio kdesdk-thumbnailers kdialog keditbookmarks kget kimageformats kinit kio-admin kio-gdrive kio-zeroconf kompare konsole kscreen kvantum kwrited libappimage libfido2 libktorrent libmms libnfs libva-utils lirc lrzip lua52-socket lzop mac man-db man-pages mesa-demos mesa-utils mold nano-syntax-highlighting nss-mdns ntfs-3g okular opus-tools p7zip packagekit-qt6 pacman-contrib partitionmanager pbzip2 pdfmixtool pigz pipewire-alsa pipewire-pulse plasma-browser-integration plasma-desktop plasma-disks plasma-firewall plasma-nm plasma-pa plasma-wayland-protocols power-profiles-daemon powerdevil powerline powerline-fonts print-manager python-pyqt6 python-reportlab qbittorrent qt6-imageformats qt6-scxml qt6-virtualkeyboard realtime-privileges reflector rng-tools sddm-kcm skanlite sof-firmware sox spectacle sshfs system-config-printer terminus-font timidity++ ttf-ubuntu-font-family unarchiver unrar unzip usb_modeswitch usbutils vdpauinfo vlc vorbis-tools vorbisgain wget xdg-desktop-portal xdg-desktop-portal-gtk xdg-desktop-portal-kde xsane zip zsh zsh-autosuggestions zsh-completions zsh-syntax-highlighting ${nrg_plc}" ;; 3) # NOTE: Gnome Desktop: @@ -3828,7 +3854,7 @@ ${magenta}###${nc}-------------------------------------${magenta}[ ${bwhite}Pacs 4) # NOTE: Custom Gnome & Systemd-boot & Optimized System: - deskpkgs="${basepkgs} evince file-roller gdm gnome-calculator gnome-clocks gnome-console gnome-control-center gnome-disk-utility gnome-keyring gnome-menus gnome-session gnome-shell-extensions gnome-system-monitor gnome-text-editor gnome-tweaks gvfs gvfs-afc gvfs-mtp loupe malcontent nautilus networkmanager power-profiles-daemon simple-scan sushi system-config-printer xdg-desktop-portal-gnome xdg-user-dirs-gtk alsa-firmware alsa-utils ccache cups-pdf e2fsprogs efibootmgr exfatprogs fdkaac git glibc-locales gnome-browser-connector gparted gst-libav gst-plugin-libcamera gst-plugin-msdk gst-plugin-opencv gst-plugin-pipewire gst-plugin-qmlgl gst-plugin-va gst-plugin-wpe gst-plugins-ugly gstreamer-vaapi htop icoutils ipp-usb libfido2 libva-utils lrzip mac man-db man-pages meld mesa-utils mold nano-syntax-highlighting nss-mdns ntfs-3g p7zip pacman-contrib pbzip2 pdfmixtool pigz pipewire-alsa pipewire-pulse pkgstats powerline powerline-fonts qbittorrent realtime-privileges reflector rng-tools sof-firmware terminus-font ttf-ubuntu-font-family unrar unzip usb_modeswitch usbutils vdpauinfo vlc wget zip zsh zsh-autosuggestions zsh-completions zsh-syntax-highlighting ${nrg_plc}" ;; + deskpkgs="${basepkgs} evince file-roller gdm gnome-calculator gnome-clocks gnome-console gnome-control-center gnome-disk-utility gnome-keyring gnome-menus gnome-session gnome-shell-extensions gnome-system-monitor gnome-text-editor gnome-tweaks gvfs gvfs-afc gvfs-mtp loupe malcontent nautilus networkmanager power-profiles-daemon simple-scan sushi system-config-printer xdg-desktop-portal-gnome xdg-user-dirs-gtk alsa-firmware alsa-utils ccache cups-pdf e2fsprogs efibootmgr exfatprogs fdkaac git glibc-locales gnome-browser-connector gparted gst-libav gst-plugin-libcamera gst-plugin-msdk gst-plugin-opencv gst-plugin-pipewire gst-plugin-qmlgl gst-plugin-va gst-plugin-wpe gst-plugins-ugly gstreamer-vaapi htop icoutils ipp-usb irqbalance libfido2 libva-utils lrzip mac man-db man-pages meld mesa-utils mold nano-syntax-highlighting nss-mdns ntfs-3g p7zip pacman-contrib pbzip2 pdfmixtool pigz pipewire-alsa pipewire-pulse powerline powerline-fonts qbittorrent realtime-privileges reflector rng-tools sof-firmware terminus-font ttf-ubuntu-font-family unrar unzip usb_modeswitch usbutils vdpauinfo vlc wget zip zsh zsh-autosuggestions zsh-completions zsh-syntax-highlighting ${nrg_plc}" ;; 5) # NOTE: Xfce Desktop: @@ -3881,26 +3907,24 @@ ${magenta}###${nc}-------------------------------------${magenta}[ ${bwhite}Pacs deskpkgs="base linux-firmware sudo ${bootldr_pkgs} ${custompkgs} ${fstools} ${kernel} ${microcode} ${vgapkgs} ${wireless_reg} ${greeter}" fi ;; esac - - if pacstrap -K -i /mnt ${deskpkgs}; then - if [[ "${fs}" == "2" ]]; then - genfstab -t PARTUUID /mnt >> /mnt/etc/fstab > /dev/null 2>&1 || err_abort - sleep 0.3 - NC " + + if pacstrap -K -i /mnt ${deskpkgs} ; then + if [[ "${fs}" == "2" ]]; then + genfstab -t PARTUUID /mnt >> /mnt/etc/fstab > /dev/null 2>&1 || err_abort + sleep 0.3 + NC " ==> [${green}Fstab OK${nc}] " - fi + fi ok else - err_reload - sleep 5 - return 1 + failure fi } ################################################################################################### swapfile (){ - local prompt="Swapfile" + local stage_prompt="Swapfile" sleep 0.3 NC " @@ -3913,15 +3937,15 @@ SWAP cat >> /mnt/etc/fstab <<-FSTAB || err_abort /swapfile none swap defaults 0 0 FSTAB - ok + stage_ok else - err_swapfile + stage_fail fi } ################################################################################################### swapfile_btrfs (){ - local prompt="Btfrs Swapfile" + local stage_prompt="Btfrs Swapfile" sleep 0.3 NC " @@ -3934,28 +3958,25 @@ SWAP cat >> /mnt/etc/fstab <<-FSTAB || err_abort /swap/swapfile none swap defaults 0 0 FSTAB - ok + stage_ok else - err_swapfile + stage_fail fi } ################################################################################################### wireless_regdom (){ - local prompt="Wireless-Regdom" + local stage_prompt="Wireless Regdom" sleep 0.3 NC " ${magenta}###${nc}--------------------------${magenta}[ ${bwhite}Setting Up Wireless Regulatory Domain${nc} ${magenta}]${nc}--------------------------${magenta}###${nc} " - if cat >> /mnt/etc/conf.d/wireless-regdom <<-REGDOM ; then - WIRELESS_REGDOM="${REGDOM}" -REGDOM - ok + if sed -i "/^#WIRELESS_REGDOM=\"${REGDOM}\"/s/^#//" /mnt/etc/conf.d/wireless-regdom ; then + stage_ok else - err_reload - return 1 + stage_fail fi } ################################################################################################### @@ -4014,13 +4035,31 @@ ${magenta}###${nc}--------------------------------${magenta}[ ${bwhite}Chroot & mkinitcpio_mods="MODULES=(i915 ${fs_mod})" # Mkinitcpio Hooks (Encryption) mkinitcpio_hooks="HOOKS=(systemd keyboard autodetect microcode modconf kms keymap consolefont block sd-encrypt filesystems fsck)" + # Nvidia elif [[ "${vendor}" == "Nvidia" ]]; then - # Mkinitcpio Modules (Encryption) - mkinitcpio_mods="MODULES=(nvidia nvidia_modeset nvidia_uvm nvidia_drm ${fs_mod})" # Mkinitcpio Hooks (Encryption) mkinitcpio_hooks="HOOKS=(systemd keyboard autodetect microcode modconf keymap consolefont block sd-encrypt filesystems fsck)" - # Graphics Kernel Boot Options - vga_bootopts="modeset=1 " + # Preserve-Nvidia-Video-Memory after suspend/hibernate/resume + if [[ ${nvidia_suspend} == "y" ]]; then + # Mkinitcpio Modules (Encryption) [No Early Nvidia KMS] + mkinitcpio_mods="MODULES=(nvidia_modeset nvidia_uvm nvidia_drm ${fs_mod})" + # Nvidia Services + nvidia_services="nvidia-suspend nvidia-hibernate nvidia-resume" + if [[ ${fs} == "1" ]]; then + # Set Custom '/Temp' path + vga_bootopts="nvidia_drm.modeset=1 nvidia_drm.fbdev=1 nvidia.NVreg_UsePageAttributeTable=1 nvidia.NVreg_PreserveVideoMemoryAllocations=1 nvidia.NVreg_TemporaryFilePath=/var/tmp " + else + # Set Default '/Temp' path + vga_bootopts="nvidia_drm.modeset=1 nvidia_drm.fbdev=1 nvidia.NVreg_UsePageAttributeTable=1 nvidia.NVreg_PreserveVideoMemoryAllocations=1 " + fi + # No Preserve-Nvidia-Video-Memory after suspend/hibernate/resume + else + # Mkinitcpio Modules (Encryption) [Early Nvidia KMS] + mkinitcpio_mods="MODULES=(nvidia nvidia_modeset nvidia_uvm nvidia_drm ${fs_mod})" + # Graphics Kernel Boot Options + vga_bootopts="nvidia_drm.modeset=1 nvidia_drm.fbdev=1 nvidia.NVreg_UsePageAttributeTable=1 " + fi + # Amd elif [[ "${vendor}" == "AMD" ]]; then # Mkinitcpio Modules (Encryption) mkinitcpio_mods="MODULES=(amdgpu radeon ${fs_mod})" @@ -4092,12 +4131,28 @@ ${magenta}###${nc}--------------------------------${magenta}[ ${bwhite}Chroot & mkinitcpio_hooks="HOOKS=(systemd autodetect microcode modconf kms keyboard keymap consolefont block filesystems fsck)" # Nvidia elif [[ "${vendor}" == "Nvidia" ]]; then - # Mkinitcpio Modules - mkinitcpio_mods="MODULES=(nvidia nvidia_modeset nvidia_uvm nvidia_drm)" # Mkinitcpio Hooks mkinitcpio_hooks="HOOKS=(systemd autodetect microcode modconf keyboard keymap consolefont block filesystems fsck)" - # Graphics Kernel Boot Options - vga_bootopts="modeset=1 " + # Preserve-Nvidia-Video-Memory after suspend/hibernate/resume + if [[ ${nvidia_suspend} == "y" ]]; then + # Mkinitcpio Modules [No Early Nvidia KMS] + mkinitcpio_mods="MODULES=(nvidia_modeset nvidia_uvm nvidia_drm)" + # Nvidia Services + nvidia_services="nvidia-suspend nvidia-hibernate nvidia-resume" + if [[ ${fs} == "1" ]]; then + # Set Custom '/Temp' path + vga_bootopts="nvidia_drm.modeset=1 nvidia_drm.fbdev=1 nvidia.NVreg_UsePageAttributeTable=1 nvidia.NVreg_PreserveVideoMemoryAllocations=1 nvidia.NVreg_TemporaryFilePath=/var/tmp " + else + # Set Default '/Temp' path + vga_bootopts="nvidia_drm.modeset=1 nvidia_drm.fbdev=1 nvidia.NVreg_UsePageAttributeTable=1 nvidia.NVreg_PreserveVideoMemoryAllocations=1 " + fi + # NO Preserve-Nvidia-Video-Memory after suspend/hibernate/resume + else + # Mkinitcpio Modules [Early Nvidia KMS] + mkinitcpio_mods="MODULES=(nvidia nvidia_modeset nvidia_uvm nvidia_drm)" + # Graphics Kernel Boot Options + vga_bootopts="nvidia_drm.modeset=1 nvidia_drm.fbdev=1 nvidia.NVreg_UsePageAttributeTable=1 " + fi # Amd elif [[ "${vendor}" == "AMD" ]]; then # Mkinitcpio Modules @@ -4138,8 +4193,9 @@ ${magenta}###${nc}--------------------------------${magenta}[ ${bwhite}Chroot & # NOTE: All Vanilla Desktops Basic Configuration: if [[ "${packages}" =~ ^(1|3|5|6|7|8|9|10|11)$ ]]; then + cnfg stage_prompt="Basic System" - if arch-chroot /mnt <<-VANILLA_CONF ; then + if arch-chroot /mnt <<-VANILLA_CONF > /dev/null 2>&1 ; then sed -i "/^#${SETLOCALE}/s/^#//" /etc/locale.gen || exit locale-gen || exit echo LANG=${SETLOCALE} > /etc/locale.conf || exit @@ -4159,53 +4215,50 @@ ${magenta}###${nc}--------------------------------${magenta}[ ${bwhite}Chroot & 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 + echo "%wheel ALL=(ALL) ALL" | tee /etc/sudoers.d/sudoersd || exit visudo -c /etc/sudoers.d/sudoersd || exit VANILLA_CONF stage_ok else stage_fail - failure fi if [[ -f /mnt/etc/lightdm/lightdm.conf ]]; then + cnfg if [[ "${packages}" == "7" ]]; then stage_prompt="Deepin Greeter" - if arch-chroot /mnt <<-DEEPIN ; then + 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 else stage_fail - failure fi elif [[ "${packages}" == "8" ]]; then stage_prompt="GTK Greeter" - if arch-chroot /mnt <<-GTK ; then + 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 - failure fi else stage_prompt="Slick Greeter" - if arch-chroot /mnt <<-SLICK ; then + 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 - failure fi fi fi if [[ "${bootloader}" == "1" ]]; then + cnfg stage_prompt="Systemd-boot" - if arch-chroot /mnt <<-BOOTCTL ; then + if arch-chroot /mnt <<-BOOTCTL > /dev/null 2>&1 ; then bootctl install --graceful || exit echo "default arch.conf" > /boot/loader/loader.conf || exit echo " @@ -4213,61 +4266,131 @@ SLICK linux /vmlinuz-${kernel} initrd /initramfs-${kernel}.img options rw ${boot_opts}" | tee /boot/loader/entries/arch.conf || exit - systemctl enable systemd-boot-update ${bluetooth} ${displaymanager} ${network} ${trim} ${vm_services} || exit + systemctl enable systemd-boot-update || exit BOOTCTL stage_ok else stage_fail - failure fi elif [[ "${bootloader}" == "2" ]]; then + cnfg stage_prompt="Grub" - if arch-chroot /mnt <<-GRUB ; then + 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 - systemctl enable ${bluetooth} ${displaymanager} ${network} ${trim} ${vm_services} || exit GRUB stage_ok else stage_fail - failure fi - if [[ "${bootloader}" == "2" && "${fs}" == "2" ]]; then + if [[ "${fs}" == "2" ]]; then + cnfg stage_prompt="Grub-Btrfsd" - if arch-chroot /mnt <<-GRUBBTRFSD ; then + if arch-chroot /mnt <<-GRUB_BTRFSD > /dev/null 2>&1 ; then systemctl enable grub-btrfsd || exit -GRUBBTRFSD +GRUB_BTRFSD stage_ok else stage_fail - failure fi fi if [[ "${vgaconf}" == "y" && "${vendor}" == "Nvidia" ]]; then + cnfg stage_prompt="Grub-Nvidia" - if arch-chroot /mnt <<-NVIDIAGRUB ; then + 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 -NVIDIAGRUB +NVIDIA_GRUB stage_ok else stage_fail - failure fi fi fi + if [[ -n "${bluetooth}" ]]; then + cnfg + stage_prompt="Bluetooth Service" + if arch-chroot /mnt <<-BLUETOOTH > /dev/null 2>&1 ; then + systemctl enable ${bluetooth} || exit +BLUETOOTH + stage_ok + else + stage_fail + fi + fi + + if [[ -n "${displaymanager}" ]]; then + cnfg + stage_prompt="Display Manager Service" + if arch-chroot /mnt <<-DM_SERVICE > /dev/null 2>&1 ; then + systemctl enable ${displaymanager} || exit +DM_SERVICE + stage_ok + else + stage_fail + fi + fi + + if [[ -n "${network}" ]]; then + cnfg + stage_prompt="Network Manager Service" + if arch-chroot /mnt <<-NETWORK > /dev/null 2>&1 ; then + systemctl enable ${network} || exit +NETWORK + 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 <<-NVIDIAHOOK ; then - mkdir -p /etc/pacman.d/hooks/ > /dev/null 2>&1 || exit + if arch-chroot /mnt <<-NVIDIA_HOOK > /dev/null 2>&1 ; then + mkdir -p /etc/pacman.d/hooks/ || exit echo " [Trigger] Operation=Install @@ -4283,11 +4406,10 @@ NVIDIAGRUB 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 +NVIDIA_HOOK stage_ok else stage_fail - failure fi fi fi @@ -4297,7 +4419,8 @@ NVIDIAHOOK # NOTE: Plasma / Gnome & Systemd-boot Optimized-System Configuration: if [[ "${packages}" == "2" ]] || [[ "${packages}" == "4" ]]; then - stage_prompt="System" + stage_prompt="Custom System" + cnfg if [[ "${packages}" == "2" ]]; then displaymanager="sddm" @@ -4311,7 +4434,7 @@ NVIDIAHOOK NRG fi - if arch-chroot /mnt <<-OPTIMIZED_CONF ; then + if arch-chroot /mnt <<-OPTIMIZED_CONF > /dev/null 2>&1 ; then sed -i "/^#${SETLOCALE}/s/^#//" /etc/locale.gen || exit locale-gen || exit echo LANG=${SETLOCALE} > /etc/locale.conf || exit @@ -4446,19 +4569,19 @@ NRG Defaults editor=/usr/bin/nano %wheel ALL=(ALL) ALL" | tee /etc/sudoers.d/sudoersd || exit visudo -c /etc/sudoers.d/sudoersd || exit - systemctl enable avahi-daemon bluetooth cups ipp-usb NetworkManager rngd systemd-boot-update ${displaymanager} ${trim} ${vm_services} || exit + systemctl enable avahi-daemon bluetooth cups ipp-usb NetworkManager rngd systemd-boot-update irqbalance ${displaymanager} ${trim} ${vm_services} ${nvidia_services} || exit OPTIMIZED_CONF stage_ok else stage_fail - failure 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 <<-NVIDIAHOOK ; then - mkdir -p /etc/pacman.d/hooks/ > /dev/null 2>&1 || exit + if arch-chroot /mnt <<-NVIDIAHOOK > /dev/null 2>&1 ; then + mkdir -p /etc/pacman.d/hooks/ || exit echo " [Trigger] Operation=Install @@ -4478,7 +4601,6 @@ NVIDIAHOOK stage_ok else stage_fail - failure fi fi fi @@ -4488,8 +4610,9 @@ NVIDIAHOOK # NOTE: Custom System Configuration (Add any extra configuration below): if [[ "${packages}" == "12" ]]; then + cnfg stage_prompt="Basic System" - if arch-chroot /mnt <<-CUSTOM_CONF ; then + 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 @@ -4509,43 +4632,41 @@ NVIDIAHOOK 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 + 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 - failure fi if [[ -f /mnt/etc/lightdm/lightdm.conf ]]; then + cnfg if [[ "${greeternmbr}" == "1" ]]; then stage_prompt="GTK Greeter" - if arch-chroot /mnt <<-GTK ; then + 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 - failure fi elif [[ "${greeternmbr}" == "2" ]]; then stage_prompt="Slick Greeter" - if arch-chroot /mnt <<-SLICK ; then + 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 - failure fi fi fi if [[ "${bootloader}" == "1" ]]; then + cnfg stage_prompt="Systemd-boot" - if arch-chroot /mnt <<-BOOTCTL ; then + if arch-chroot /mnt <<-BOOTCTL > /dev/null 2>&1 ; then bootctl install --graceful || exit echo "default arch.conf" > /boot/loader/loader.conf || exit echo " @@ -4553,16 +4674,16 @@ SLICK linux /vmlinuz-${kernel} initrd /initramfs-${kernel}.img options rw ${boot_opts}" | tee /boot/loader/entries/arch.conf || exit - systemctl enable systemd-boot-update ${customservices} ${trim} ${vm_services} || exit + systemctl enable systemd-boot-update || exit BOOTCTL stage_ok else stage_fail - failure fi elif [[ "${bootloader}" == "2" ]]; then + cnfg stage_prompt="Grub" - if arch-chroot /mnt <<-GRUB ; then + 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' \ @@ -4573,52 +4694,88 @@ GRUB stage_ok else stage_fail - failure fi - if [[ -n "${customservices}" || -n "${trim}" || -n "${vm_services}" ]]; then - stage_prompt="Services" - if arch-chroot /mnt <<-SERVICES ; then - systemctl enable ${customservices} ${trim} ${vm_services} || exit -SERVICES - stage_ok - else - stage_fail - failure - fi - fi - - if [[ "${bootloader}" == "2" && "${fs}" == "2" ]]; then + if [[ "${fs}" == "2" ]]; then + cnfg stage_prompt="Grub-Btrfsd" - if arch-chroot /mnt <<-GRUBBTRFSD ; then + if arch-chroot /mnt <<-GRUB_BTRFSD > /dev/null 2>&1 ; then systemctl enable grub-btrfsd || exit -GRUBBTRFSD +GRUB_BTRFSD stage_ok else stage_fail - failure fi fi if [[ "${vgaconf}" == "y" && "${vendor}" == "Nvidia" ]]; then + cnfg stage_prompt="Grub-Nvidia" - if arch-chroot /mnt <<-NVIDIAGRUB ; then + 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 -NVIDIAGRUB +NVIDIA_GRUB stage_ok else stage_fail - failure 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 <<-NVIDIAHOOK ; then - mkdir -p /etc/pacman.d/hooks/ > /dev/null 2>&1 || exit + if arch-chroot /mnt <<-NVIDIA_HOOK > /dev/null 2>&1 ; then + mkdir -p /etc/pacman.d/hooks/ || exit echo " [Trigger] Operation=Install @@ -4634,11 +4791,10 @@ NVIDIAGRUB 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 +NVIDIA_HOOK stage_ok else stage_fail - failure fi fi fi @@ -4691,13 +4847,15 @@ NVIDIAHOOK bootmode="" trg="" s="" + bootloader="" + vga_slct="" + nvidia_services="" + nvidia_suspend="" clear first_check sleep 1 - NC " - - " + line3 CYANBG "************************************************************************************************* " CYANBG " " CYANBG " ### Amelia Installer ### " @@ -4715,8 +4873,9 @@ NVIDIAHOOK ${bwhite}Press any key to start${nc} " read -r -s -n 1 clear + arch uefi_check connection_check upd_clock dtct_microcode - until main_menu; do : ; done + main_menu