From 1d0517e1b90003651c84f6f0d8c688c6f4addc38 Mon Sep 17 00:00:00 2001 From: Jane Doe Date: Sun, 29 Mar 2026 01:10:51 +0200 Subject: [PATCH] Change: Major TUI code optimization --- Amelia.sh | 5399 +++++++++++++---------------------------------------- 1 file changed, 1295 insertions(+), 4104 deletions(-) diff --git a/Amelia.sh b/Amelia.sh index 39056aa..501fc7d 100644 --- a/Amelia.sh +++ b/Amelia.sh @@ -1,476 +1,312 @@ #!/bin/bash - # Amelia installer for Archlinux - # Version: 1.3.0 - # Source: https://gitlab.com/prism7/archery - # Contact: leenooks7@gmail.com +# Amelia installer for Archlinux +# Version: 1.4.0 +# Source: https://gitlab.com/prism7/archery set -euo pipefail -################################################################################################### -# COLOR FUNCTIONS -nc="\e[0m" -red="\e[31m" -cyan="\e[36m" -blue="\e[94m" -green="\e[32m" -redl="\e[1;31m" -yellow="\e[33m" -cyanl="\e[1;36m" -redbg="\e[1;41m" -magenta="\e[35m" -bwhite="\e[0;97m" -cyanbg="\e[1;46m" -bluebg="\e[1;44m" -greenl="\e[1;32m" -greenbg="\e[1;42m" -yellowl="\e[1;33m" -magental="\e[1;35m" -magentabg="\e[1;45m" -MAGENTABG() { echo -e "${magentabg} $1${nc}" ;} -YELLOWL() { echo -e "${yellowl} $1${nc}" ;} -GREENBG() { echo -e "${greenbg} $1${nc}" ;} -MAGENTA() { echo -e "${magenta} $1${nc}" ;} -YELLOW() { echo -e "${yellow} $1${nc}" ;} -BLUEBG() { echo -e "${bluebg} $1${nc}" ;} -CYANBG() { echo -e "${cyanbg} $1${nc}" ;} -WHITEB() { echo -e "${bwhite} $1${nc}" ;} -GREEN() { echo -e "${green} $1${nc}" ;} -REDBG() { echo -e "${redbg} $1${nc}" ;} -BLUE() { echo -e "${blue} $1${nc}" ;} -CYAN() { echo -e "${cyan} $1${nc}" ;} -RED() { echo -e "${red} $1${nc}" ;} -NC() { echo -e "${nc} $1${nc}" ;} -# END COLOR FUNCTIONS -################################################################################################### -# PROMPT FUNCTIONS -skip() { - sleep 0.2 - YELLOWL " - --> Skipping.. - " -} -reload() { +# TUI FUNCTIONS +vm() { inf "${yellowl}Virtual Machine ${nc}detected\n";} +ok() { sleep 0.2; NC "\n\n==> [${green}${prompt} OK${nc}]";} +NC() { echo -e "${nc} $1${nc}" ;} +y_n() { err "Please type 'y' or 'n' to continue.."; reload;} +RED() { echo -e "${red} $1${nc}" ;} +skip() { sleep 0.2; YELLOWL "\n\n --> Skipping..";} +BLUE() { echo -e "${blue} $1${nc}" ;} +CYAN() { echo -e "${cyan} $1${nc}" ;} +GREEN() { echo -e "${green} $1${nc}" ;} +REDBG() { echo -e "${redbg} $1${nc}" ;} +reload() { sleep 0.2; NC "\n\n --> [${green}Reloading${nc}]";} +choice() { err "Please make a choice to continue.."; reload;} +yes_no() { err "Please type 'yes' or 'no' to continue.."; reload;} +YELLOW() { echo -e "${yellow} $1${nc}" ;} +BLUEBG() { echo -e "${bluebg} $1${nc}" ;} +CYANBG() { echo -e "${cyanbg} $1${nc}" ;} +WHITEB() { echo -e "${bwhite} $1${nc}" ;} +invalid() { err "Invalid Response"; reload;} +err_try() { err "Errors occured. Please try again.."; reload;} +YELLOWL() { echo -e "${yellowl} $1${nc}" ;} +GREENBG() { echo -e "${greenbg} $1${nc}" ;} +MAGENTA() { echo -e "${magenta} $1${nc}" ;} +stage_ok() { sleep 0.2; GREEN "\n >> ${nc}${stage_prompt} ${green}OK"; sleep 0.3;} +keypress() { NC "\n\n\n ${bwhite}Press any key to continue\n\n"; read -r -s -n 1;} +err_abort() { err "Errors occured. Aborting.."; failure;} +do_umount() { unmount; reload;} +MAGENTABG() { echo -e "${magentabg} $1${nc}";} +umount_manual() { unmount; inf "Switching to ${yellowl}Manual Mode";} +err() { + local msg="$1" + local middle="${red}### ${nc}${msg}${red} ###${nc}" + local clean_middle + clean_middle="$(echo -e "$middle" | sed 's/\x1b\[[0-9;]*m//g')" + local visible_length="${#clean_middle}" + local dash_line + dash_line="$(printf '%*s' "$visible_length" '' | tr ' ' '-')" + local top_bottom="${red}${dash_line}${nc}" sleep 0.2 - NC " - - --> [${green}Reloading${nc}] " -} -alternatives() { + printf "\n" + printf "%b\n" " $top_bottom" + printf "%b\n" " $middle" + printf "%b\n" " $top_bottom";} +msg() { + local msg="$1" + local middle="${green}### ${nc}${msg}${green} ###" + local clean_middle + clean_middle="$(echo -e "$middle" | sed 's/\x1b\[[0-9;]*m//g')" + local visible_length="${#clean_middle}" + local dash_line + dash_line="$(printf '%*s' "$visible_length" '' | tr ' ' '-')" + local top_bottom="${green}${dash_line}${nc}" sleep 0.2 - NC " - - --> [${green}Providing alternatives..${nc}] " + printf "\n" + printf "%b\n" " $top_bottom" + printf "%b\n" " $middle" + printf "%b\n" " $top_bottom" } -deskname() { +inf() { + local msg="$1" + local string="${cyan}>> ${nc}${msg}${nc}" sleep 0.2 - YELLOW " - - ### ${desktopname} has been selected - " + printf "\n\n" + printf "%b\n" " $string" } -vm() { - sleep 0.2 - CYAN " - - >> ${yellowl}Virtual Machine ${nc}detected - " +ask() { + local msg="$1" + local string="${yellow}> ${msg}${yellow}:" + printf "\n\n" + printf "%b\n" " $string" } -invalid() { - sleep 0.2 - RED " - -------------------------- - ### ${nc}Invalid Response ${red}### - --------------------------" - reload +get() { + local msg="$1" + local string="${blue}${msg}${blue}:${nc}" + printf "\n\n" + printf "%b\n" "$string" + printf "\n" } -err_try() { +ack() { + local msg="$1" + local string="${yellow}### ${msg}" sleep 0.2 - RED " - -------------------------------------------- - ### ${nc}Errors occured. Please try again.. ${red}### - --------------------------------------------" - reload -} -err_abort() { - sleep 0.2 - RED " - ------------------------ - ### ${nc}Errors occured ${red}### - ------------------------" - failure + printf "\n\n" + printf "%b\n" " $string" } reboot() { - if [[ "${luks_encrypt}" == "ok" ]]; then - sleep 0.2 - CYAN " - - >> ${nc}The system will now ${yellowl}reboot ${nc}for all changes to take effect - - - - " - sleep 5 - systemctl reboot + if [[ "${encrypt}" == "yes" ]]; then + if [[ "${luks_encrypt}" == "ok" ]]; then + inf "The system will now ${yellowl}reboot ${nc}for all changes to take effect\n\n" + sleep 3 + systemctl reboot + else + inf "A reboot is ${yellowl}mandatory ${nc}after performing LUKS encryption\n\n" + sleep 3 + systemctl reboot + fi fi } -force_reboot() { +title() { + local core="$*" + local left_sym="###" + local right_sym="###" + local bracket_open="[ " + local bracket_close=" ]" + local left_sym_len=${#left_sym} + local right_sym_len=${#right_sym} + local bracket_open_len=${#bracket_open} + local bracket_close_len=${#bracket_close} + local magenta_len=${#magenta} + local bwhite_len=${#bwhite} + local nc_len=${#nc} + local decor_len=$(( left_sym_len + right_sym_len + bracket_open_len + bracket_close_len + magenta_len + nc_len + bwhite_len * 2 )) + local total_len=126 + local core_len=${#core} + local available=$(( total_len - decor_len - core_len )) + local half=$(( available / 2 )) + local core_padding="" + if (( available % 2 != 0 )); then + if [[ "$core" == *" "* ]]; then + local mid_index=$(( core_len / 2 )) + while [[ "${core:$mid_index:1}" != " " && $mid_index -gt 0 ]]; do + (( mid_index-- )) + done + core="${core:0:$mid_index} ${core:$mid_index}" + else + core_padding=" " + fi + fi + dashes_left=$(printf '%*s' "$half" '' | tr ' ' '-') + dashes_right=$(printf '%*s' "$half" '' | tr ' ' '-') + local core_adjusted="${magenta}${bracket_open}${bwhite}${core}${magenta}${bracket_close}${core_padding}" + local output="${magenta}${left_sym}${nc}${dashes_left}${core_adjusted}${nc}${dashes_right}${magenta}${right_sym}" sleep 0.2 - CYAN " - - >> ${nc}A reboot is ${yellowl}mandatory ${nc}after performing LUKS encryption - - - - " - sleep 5 - systemctl reboot -} -line2() { - printf '\n\n' -} -line3() { - printf '\n\n\n' + NC "\n\n\n$output\n" } unmount() { - sleep 0.2 - line2 - NC " - --------------------------- - ### ${yellowl}Unmount and Retry ${nc}### - --------------------------- - " + inf "${yellowl}Unmount ${nc}and Retry" reload - sleep 0.2 - NC " - - -${magenta}###${nc}-----------------------------------${magenta}[ ${bwhite}Unmount Filesystems${nc} ${magenta}]${nc}-----------------------------------${magenta}### - " + title "Unmount Filesystems" if umount -R /mnt > "${void}" 2>&1 ; then - sleep 0.2 - NC " - - -------------------- - ### ${green}Unmount OK ${nc}### - --------------------" + msg "Unmount OK" else - sleep 0.2 - RED " - - --------------------------- - ### ${nc}Unmounting Failed ${red}### - ---------------------------" + err "Unmounting Failed" failure fi } -do_umount() { - unmount - reload -} -umount_manual() { - unmount - sleep 0.2 - NC " - - --> [Switching to ${green}Manual Mode${nc}]" -} -choice() { - sleep 0.2 - RED " - -------------------------------------------- - ### ${nc}Please make a choice to continue.. ${red}### - --------------------------------------------" - reload -} -y_n() { - sleep 0.2 - RED " - ---------------------------------------------- - ### ${nc}Please type ${yellow}'y' ${nc}or ${yellow}'n' ${nc}to continue.. ${red}### - ----------------------------------------------" - reload -} -yes_no() { - sleep 0.2 - RED " - ------------------------------------------------- - ### ${nc}Please type ${yellow}'yes' ${nc}or ${yellow}'no' ${nc}to continue.. ${red}### - -------------------------------------------------" - reload -} -ok() { - sleep 0.2 - NC " - -==> [${green}${prompt} OK${nc}] " -} -stage_ok() { - sleep 0.2 - GREEN " - >> ${nc}${stage_prompt} ${green}OK " - sleep 0.3 -} stage_fail() { sleep 0.2 - RED " - - >> ${bwhite}${stage_prompt} ${nc}${red}FAILED${cyan} - - - >> ${nc}Check ${yellowl}Amelia.log ${nc}for errors - - " + RED "\n\n >> ${bwhite}${stage_prompt} ${nc}has ${red}FAILED${cyan}\n\n >> ${nc}Check ${yellowl}Amelia.log ${nc}for errors\n\n" failure } completion_err() { + printf "\n\n" if [[ -e /usr/bin/pv ]]; then - sleep 0.2 - CYAN " - - - - >> ${nc}Please complete ${bwhite}'${stage_prompt}' ${nc}to continue - " | pv -qL 70 + inf "Please complete ${yellowl}'${stage_prompt}' ${nc}to continue\n" | pv -qL 70 else - sleep 0.2 - CYAN " - - - - >> ${nc}Please complete ${bwhite}'${stage_prompt}' ${nc}to continue - " + inf "Please complete ${yellowl}'${stage_prompt}' ${nc}to continue\n" fi } -term_offer() { - sleep 0.2 - YELLOW " - - ### NOTE: ${desktopname} desktop lacks a native Terminal emulator by design - - - ### You can use linux console (ctrl+alt+F'n') for shell access - - - - - > Install ${nc}'gnome-terminal' ${yellow}for convenience ? [Y/n] " - BLUE " - - -Enter [Y/n]: " - read -r -p " -==> " terminal - - terminal="${terminal:-y}" - terminal="${terminal,,}" - - case "${terminal}" in - y) - sleep 0.2 - NC " - -==> [${green}Terminal OK${nc}] " ;; - n) - skip ;; - *) - invalid - until term_offer; do : ; done ;; - esac -} -keypress() { - NC " - - - ${bwhite}Press any key to continue${nc} - - - " - read -r -s -n 1 -} amd() { - line2 + printf "\n\n" + sleep 0.2 REDBG " ------------------------------- " REDBG " ### AMD Graphics detected ### " REDBG " ------------------------------- " - NC " - - - * ${gfxcard} - - " + NC "\n\n\n * ${gfxcard}\n\n" } intel() { - line2 + printf "\n\n" + sleep 0.2 BLUEBG " --------------------------------- " BLUEBG " ### INTEL Graphics detected ### " BLUEBG " --------------------------------- " - NC " - - - * ${gfxcard} - - " + NC "\n\n\n * ${gfxcard}\n\n" } nvidia() { - line2 + printf "\n\n" + sleep 0.2 GREENBG " ---------------------------------- " GREENBG " ### NVIDIA Graphics detected ### " GREENBG " ---------------------------------- " - NC " - - - * ${gfxcard} - - " + NC "\n\n\n * ${gfxcard}\n\n" } -arch() { +delete() { + sleep 0.2 + printf "\n\n" + REDBG " ------------------------------------------------------------ " + REDBG " [!] WARNING: All data on selected disk will be destroyed [!] " + REDBG " ------------------------------------------------------------ " +} +amelia() { + sleep 0.2 + CYANBG "************************************************************************************************* " + CYANBG " " + CYANBG " ### Amelia Installer ### " + CYANBG " " + CYANBG "************************************************************************************************* " +} +banner() { sleep 0.2 echo BLUEBG "************************************************************************************************* " BLUEBG " " - BLUEBG " ##### Archlinux Installation ##### " + BLUEBG " ### Archlinux Installation ### " BLUEBG " " BLUEBG "************************************************************************************************* " - line2 + printf "\n\n" } installing() { sleep 0.2 - line3 + printf "\n\n\n" MAGENTABG "------------------------------------------------------------------------------------------------- " MAGENTABG " ### Installing System ### " MAGENTABG "------------------------------------------------------------------------------------------------- " - line3 + printf "\n" } cnfg() { sleep 0.2 - line3 + printf "\n\n\n" MAGENTABG "------------------------------------------------------------------------------------------------- " MAGENTABG " ### Configuring System ### " MAGENTABG "------------------------------------------------------------------------------------------------- " - NC " - - - ... Please Wait ... " - line3 + NC "\n\n\n ... Please Wait ...\n\n\n" } completion() { sleep 0.2 - line3 - line2 + printf "\n\n\n\n\n" GREENBG "************************************************************************************************* " GREENBG " " GREENBG " ### Installation Completed ### " GREENBG " " GREENBG "************************************************************************************************* " - line3 + printf "\n\n\n" } failure() { sleep 0.2 - line3 + printf "\n\n\n" REDBG "************************************************************************************************* " REDBG " " REDBG " ### Installation Aborted ### " REDBG " " REDBG "************************************************************************************************* " - line3 + printf "\n\n\n" umount -R /mnt > "${void}" 2>&1 - if [[ "${luks_root}" == "ok" || "${luks_swap}" == "ok" || "${luks_home}" == "ok" ]] && [[ "${installation}" != "ok" ]]; then - force_reboot - fi + if [[ "${luks_root}" == "ok" || "${luks_swap}" == "ok" || "${luks_home}" == "ok" ]] && [[ "${installation}" != "ok" ]]; then + reboot + fi exit } -alt_session_support() { +filesystem_overview() { + sleep 0.2 + CYAN "\n\n###${nc}---------------------------------------------${cyan}[ ${bwhite}FILESYSTEM OVERVIEW ${nc}${cyan}]${nc}---------------------------------------------${cyan}###\n\n" + lsblk -f|GREP_COLORS='mt=01;36' grep -E --color=always 'vfat|$'|GREP_COLORS='mt=01;32' grep -E --color=always 'ext4|$'|GREP_COLORS='mt=01;35' grep -E --color=always 'btrfs|$'|GREP_COLORS='mt=01;31' grep -E --color=always 'ntfs|$'|GREP_COLORS='mt=01;33' grep -E --color=always 'swap|$' + CYAN "\n\n###${nc}-----------------------------------------------------------------------------------------------------------------${cyan}###\n" sleep 0.2 - YELLOW " - ### NOTE: ${desktopname} desktop defaults to a(n) ${session} session - - - - > Install ${nc}${alt_session} ${yellow}session support ? [N/y] " - BLUE " - - -Enter [N/y]: " - read -r -p " -==> " session_support - - session_support="${session_support:-n}" - session_support="${session_support,,}" - - case "${session_support}" in - y) - sleep 0.2 - NC " - -==> [${green}${alt_session} support OK${nc}] " ;; - n) - skip ;; - *) - invalid - until alt_session_support; do : ; done ;; - esac } -# END PROMPT FUNCTIONS -################################################################################################### +disk_overview() { + sleep 0.2 + CYAN "\n###${nc}------------------------------------------------${cyan}[ ${bwhite}DISK OVERVIEW ${nc}${cyan}]${nc}------------------------------------------------${cyan}###\n\n" + fdisk -l "${instl_drive}" | grep -E --color=no 'Dev|dev' |GREP_COLORS='mt=01;36' grep -E --color=always 'EFI System|$'|GREP_COLORS='mt=01;32' grep -E --color=always 'Linux root|$'|GREP_COLORS='mt=01;35' grep -E --color=always 'Linux home|$'|GREP_COLORS='mt=01;33' grep -E --color=always 'Linux swap|$'|GREP_COLORS='mt=01;31' grep -E --color=always 'Linux extended boot|$' + CYAN "\n\n###${nc}-----------------------------------------------------------------------------------------------------------------${cyan}###" +} +multi_info() { + sleep 0.2 + CYAN "\n >> ${nc}Multiple ${color}${type} ${nc}Partitions have been detected\n\n" + disk_overview + NC "\n ${color}${type} Partitions:${nc}\n\n ${dashline}\n${multi_type}\n ${dashline}\n" + YELLOW "\n ### Only the ${nc}1st ${type} ${yellow}partition on a selected disk can be ${nc}auto-assigned ${yellow}as a valid partition${cyan}\n\n\n >> ${nc}Partition ${yellowl}${type_comply} ${nc}is auto-assigned as such and will be ${action}\n" +} +# END TUI FUNCTIONS # SYSTEM FUNCTIONS mode_check() { - if [[ "${run_as}" == "root" ]]; then - sleep 0.2 - YELLOWL " - - - > ${nc}Running in ${red}ROOT ${nc}mode ${yellowl}< " + usermode="> ${nc}Running in ${red}ROOT ${nc}mode ${yellowl}<" else - sleep 0.2 - YELLOWL " - - - > ${nc}Running in ${blue}DEMO ${nc}mode ${yellowl}< " + usermode="> ${nc}Running in ${blue}DEMO ${nc}mode ${yellowl}<" fi + sleep 0.2 + YELLOWL "\n\n\n\n ${usermode}\n\n\n\n\n\n" } -################################################################################################### -set_font() { - +check_fonts() { if [[ -f /usr/share/kbd/consolefonts/ter-v18b.psf.gz && -f /usr/share/kbd/consolefonts/ter-v32b.psf.gz ]]; then if [[ "${tty}" == *"tty"* && "${run_as}" == "root" ]]; then until slct_font; do : ; done else if [[ -e /usr/bin/pv ]]; then MAGENTABG " 'Terminus Font' detected ==> Log in as 'root' in a tty & re-run to enable " | pv -qL 70 - echo else MAGENTABG " 'Terminus Font' detected ==> Log in as 'root' in a tty & re-run to enable " - echo fi + echo fi fi } -################################################################################################### slct_font() { - - NC " - - -${magenta}###${nc}-------------------------------------${magenta}[ ${bwhite}Font Selection${nc} ${magenta}]${nc}--------------------------------------${magenta}### - " - YELLOW " - - > Select a Font: " - NC " - - [1] Terminus Font - - [2] HiDPI Terminus Font " - BLUE " - - -Enter a number: " - read -r -p " -==> " fontselect - echo - + local prompt="Font Selection" + title "${prompt}" + ask "Select a Font" + NC "\n\n [1] Terminus Font\n\n [2] HiDPI Terminus Font" + get "Enter a number" + read -r -p "==> " fontselect case "${fontselect}" in 1) setfont ter-v18b ;; @@ -480,22 +316,14 @@ Enter a number: " invalid return 1 ;; esac - local prompt="Fonts" ok - sleep 0.7 + sleep 0.5 clear } -################################################################################################### uefi_check() { - bitness="$(cat /sys/firmware/efi/fw_platform_size)" local prompt="UEFI ${bitness}-bit Mode" - sleep 0.2 - NC " - - -${magenta}###${nc}---------------------------------${magenta}[ ${bwhite}UEFI Mode Verification${nc} ${magenta}]${nc}---------------------------------${magenta}### - " + title "UEFI Mode Verification" if [[ "${bitness}" == "64" ]]; then uefimode="x86_64-efi" efiname="BOOTX64" @@ -505,57 +333,32 @@ ${magenta}###${nc}---------------------------------${magenta}[ ${bwhite}UEFI Mod efiname="BOOTIA32" ok else - RED " - -------------------------- - ### ${nc}Not in UEFI Mode ${red}### - --------------------------" + err "Not in UEFI Mode" failure fi } -################################################################################################### connection_check() { - - local prompt="Internet Connection" - sleep 0.2 - NC " - - -${magenta}###${nc}--------------------------------${magenta}[ ${bwhite}Internet Connection Check${nc} ${magenta}]${nc}--------------------------------${magenta}### - " + local prompt="Internet Connection Check" + title "${prompt}" if ping -c 3 www.google.com > "${void}" 2>&1; then ok else - RED " - - - --------------------------------------------------------- - ### ${nc}An internet connection could not be established ${red}### - --------------------------------------------------------- - " + printf "\n\n" + err "An internet connection could not be established" + printf "\n\n" failure fi } -################################################################################################### upd_clock() { - - local prompt="System Clock" - sleep 0.2 - NC " - - -${magenta}###${nc}-----------------------------------${magenta}[ ${bwhite}System Clock Update${nc} ${magenta}]${nc}-----------------------------------${magenta}### - - - " + local prompt="System Clock Update" + title "${prompt}" + printf "\n\n" sleep 0.2 timedatectl [[ "${run_as}" == "root" ]] && timedatectl set-ntp true - echo ok } -################################################################################################### dtct_hyper() { - hypervisor="$(systemd-detect-virt)" case "${hypervisor}" in kvm) @@ -571,28 +374,19 @@ dtct_hyper() { vm_services="hv_kvp_daemon hv_vss_daemon" ;; esac } -################################################################################################### machine_dtct() { - until dtct_hyper; do : ; done local prompt="Machine Detection" - sleep 0.2 - NC " - - -${magenta}###${nc}------------------------------------${magenta}[ ${bwhite}Machine Detection${nc} ${magenta}]${nc}------------------------------------${magenta}### - " + title "${prompt}" CPU="$(grep -E 'vendor_id' /proc/cpuinfo)" hardw_model="$(hostnamectl | grep -E "Hardware Model:" | sed 's| Hardware Model: ||')" hardw_model_vend="$(hostnamectl | grep -E "Hardware Model:" | sed 's| Hardware Model: ||' | awk "{print \$1}")" hardw_vendor="$(hostnamectl | grep -E "Hardware Vendor" | awk "{print \$3}")" machine="$(hostnamectl | grep -Em 1 "Chassis" | awk "{print \$2}")" - if [[ "${hypervisor}" != "none" ]]; then vm vendor="Virtual Machine" fi - if [[ "${CPU}" == *"GenuineIntel"* ]]; then microcode="intel-ucode" nrg_plc="x86_energy_perf_policy" @@ -601,70 +395,25 @@ ${magenta}###${nc}------------------------------------${magenta}[ ${bwhite}Machi microcode="amd-ucode" cpu_name="AMD" fi - if [[ "${hardw_model_vend}" == "${hardw_vendor}" ]]; then - sleep 0.2 - YELLOW " - - ### This system is a(n): ${hardw_model} ${machine} - - - - ### The ${cpu_name} cpu microcode will be installed - " + inf "This system is a(n): ${yellowl}${hardw_model} ${bwhite}${machine}" else - sleep 0.2 - YELLOW " - - ### This system is a(n): ${hardw_model} ${hardw_vendor} ${machine} - - - - ### The ${cpu_name} cpu microcode will be installed - " + inf "This system is a(n): ${yellowl}${hardw_model} ${hardw_vendor} ${bwhite}${machine}" fi + ack "The ${cpu_name} cpu microcode will be installed" ok } -################################################################################################### main_menu() { - - sleep 0.2 - NC " - - -${magenta}###${nc}----------------------------------------${magenta}[ ${bwhite}Main Menu${nc} ${magenta}]${nc}----------------------------------------${magenta}### - " - YELLOW " - - > Make a selection: " + title "Main Menu" + ask "Make a selection" if [[ -e /usr/bin/pv ]]; then - CYAN " - - >> ${nc}Select ${bwhite}[4] ${nc}for ${yellowl}Auto-Navigation ${nc}Mode " | pv -qL 70 - echo + inf "Select ${bwhite}[4] ${nc}for ${yellowl}Auto-Navigation ${nc}Mode" | pv -qL 70 else - CYAN " - - >> ${nc}Select ${bwhite}[4] ${nc}for ${yellowl}Auto-Navigation ${nc}Mode " - echo + inf "Select ${bwhite}[4] ${nc}for ${yellowl}Auto-Navigation ${nc}Mode" fi - NC " - - [1] Personalization - - [2] System Configuration - - [3] Disk Management - - [4] Start Installation " - BLUE " - - -Enter a number: " - read -r -p " -==> " menu - echo - + NC "\n\n [1] Personalization\n\n [2] System Configuration\n\n [3] Disk Management\n\n [4] Start Installation" + get "Enter a number" + read -r -p "==> " menu case "${menu}" in 1) until persnl_submn; do : ; done ;; @@ -675,11 +424,7 @@ Enter a number: " 4) instl ;; "") - sleep 0.2 - RED " - --------------------------------- - ### ${nc}Please select a Submenu ${red}### - ---------------------------------" + err "Please select a Submenu" reload return 1 ;; *) @@ -687,35 +432,12 @@ Enter a number: " return 1 ;; esac } -################################################################################################### persnl_submn() { - - sleep 0.2 - NC " - - -${magenta}###${nc}-------------------------------------${magenta}[ ${bwhite}Personalization${nc} ${magenta}]${nc}-------------------------------------${magenta}### - " - YELLOW " - - > Select a Submenu: " - NC " - - [1] Locale & Keyboard Layout Setup - - [2] User, Root User & Hostname Setup - - [3] Shell Selection - - [ ] Return to Main Menu " - BLUE " - - -Enter a number: " - read -r -p " -==> " persmenu - echo - + title "Personalization" + ask "Select a Submenu" + NC "\n\n [1] Locale & Keyboard Layout Setup\n\n [2] User, Root User & Hostname Setup\n\n [3] Shell Selection\n\n [ ] Return to Main Menu" + get "Enter a number" + read -r -p "==> " persmenu case "${persmenu}" in 1) until slct_locale; do : ; done @@ -736,42 +458,17 @@ Enter a number: " return 1 ;; esac } -################################################################################################### slct_locale() { - local prompt="Locale Selection" - sleep 0.2 - NC " - - -${magenta}###${nc}------------------------------------${magenta}[ ${bwhite}Locale Selection${nc} ${magenta}]${nc}------------------------------------${magenta}### - " - YELLOW " - - > Select your Locale - - - - ### [Enter ${nc}'l'${yellow} to list locales, then ${nc}'enter'${yellow} to search or ${nc}'q'${yellow} to quit] " - CYAN " - - >> ${nc}Exclude ${yellowl}'.UTF_8' ${nc}suffix - " - BLUE " - - -Enter your Locale ${bwhite}(empty for 'en_US')${blue}: " - read -r -p " -==> " LOCALESET - echo - + title "${prompt}" + ask "Select your Locale" + ack "[Enter ${nc}'l'${yellow} to list locales, then ${nc}'enter'${yellow} to search or ${nc}'q'${yellow} to quit]" + inf "Exclude ${yellowl}'.UTF_8' ${nc}suffix" + get "Enter your Locale ${bwhite}(empty for 'en_US')" + read -r -p "==> " LOCALESET if [[ -z "${LOCALESET}" ]]; then SETLOCALE="en_US.UTF-8" - sleep 0.2 - YELLOW " - - ### en_US.UTF-8 Locale has been selected - " + ack "en_US.UTF-8 Locale has been selected" elif [[ "${LOCALESET}" == "l" ]]; then grep -E 'UTF-8' /usr/share/i18n/SUPPORTED | less return 1 @@ -780,63 +477,29 @@ Enter your Locale ${bwhite}(empty for 'en_US')${blue}: " return 1 else SETLOCALE="${LOCALESET}.UTF-8" - sleep 0.2 - YELLOW " - - ### ${SETLOCALE} Locale has been selected - " + ack "${SETLOCALE} Locale has been selected" fi ok lcl_slct="yes" } -################################################################################################### slct_kbd() { - local prompt="Keyboard Layout Selection" local stage_prompt="Setting Keyboard Layout" - sleep 0.2 - NC " - - -${magenta}###${nc}--------------------------------${magenta}[ ${bwhite}Keyboard Layout Selection${nc} ${magenta}]${nc}--------------------------------${magenta}### - " + title "${prompt}" if [[ "${tty}" == *"pts"* ]]; then SETKBD="us" - sleep 0.2 - RED " - - ------------------------------------------- - ### ${nc}No 'tty' (Linux console) detected ${red}### - -------------------------------------------" - YELLOW " - - ### Default Keyboard Layout ('us') selected - " + inf "No 'tty' ${yellowl}(Linux console) ${nc}detected" + ack "Default Keyboard Layout ('us') selected" ok return 0 fi - YELLOW " - - > Select your Keyboard Layout - - - - ### [Enter ${nc}'l'${yellow} to list layouts, then ${nc}'enter'${yellow} to search or ${nc}'q'${yellow} to quit] " - BLUE " - - -Enter your keyboard layout ${bwhite}(empty for 'us')${blue}: " - read -r -p " -==> " SETKBD - echo - + ask "Select your Keyboard Layout" + ack "[Enter ${nc}'l'${yellow} to list layouts, then ${nc}'enter'${yellow} to search or ${nc}'q'${yellow} to quit]" + get "Enter your keyboard layout ${bwhite}(empty for 'us')" + read -r -p "==> " SETKBD if [[ -z "${SETKBD}" ]]; then SETKBD="us" - sleep 0.2 - YELLOW " - - ### 'us' Keyboard Layout has been selected - " + ack "'us' Keyboard Layout has been selected" elif [[ "${SETKBD}" == "l" ]]; then localectl list-keymaps | less return 1 @@ -844,194 +507,85 @@ Enter your keyboard layout ${bwhite}(empty for 'us')${blue}: " invalid return 1 else - sleep 0.2 - YELLOW " - - ### ${SETKBD} Keyboard Layout has been selected - " + ack "${SETKBD} Keyboard Layout has been selected" loadkeys "${SETKBD}" > "${void}" 2> "${log}" || stage_fail fi ok } -################################################################################################### user_setup() { - local prompt="User Setup" - sleep 0.2 - NC " - - -${magenta}###${nc}---------------------------------------${magenta}[ ${bwhite}User Setup${nc} ${magenta}]${nc}---------------------------------------${magenta}### - " - BLUE " - -Enter a username: " - read -r -p " -==> " USERNAME - echo - + title "${prompt}" + get "Enter a username" + read -r -p "==> " USERNAME USERNAME="${USERNAME,,}" - if [[ -z "${USERNAME}" ]]; then - sleep 0.2 - RED " - --------------------------------------------- - ### ${nc}Please enter a username to continue ${red}### - ---------------------------------------------" + err "Please enter a username to continue" reload return 1 elif [[ "${USERNAME}" =~ ^[a-z_]([a-z0-9_-]{0,31}|[a-z0-9_-]{0,30}\$)$ ]]; then - - BLUE " -Enter a password for${nc} ${cyan}${USERNAME}${blue}: " - read -r -p " -==> " USERPASSWD - echo - + get "Enter a password for${nc} ${cyan}${USERNAME}" + read -r -p "==> " USERPASSWD if [[ -z "${USERPASSWD}" ]]; then - sleep 0.2 - RED " - --------------------------------------------- - ### ${nc}Please enter a password to continue ${red}### - ---------------------------------------------" + err "Please enter a password to continue" reload return 1 fi - - BLUE " -Re-enter${nc} ${cyan}${USERNAME}'s ${blue}password: " - read -r -p " -==> " USERPASSWD2 - echo - + get "Re-enter${nc} ${cyan}${USERNAME}'s ${blue}password" + read -r -p "==> " USERPASSWD2 if [[ "${USERPASSWD}" != "${USERPASSWD2}" ]]; then - sleep 0.2 - RED " - --------------------------------------------------- - ### ${nc}Passwords don't match. Please try again.. ${red}### - ---------------------------------------------------" + err "Passwords don't match. Please try again.." reload return 1 fi else - sleep 0.2 - RED " - --------------------------------------------------- - ### ${nc}Please enter a valid username to continue ${red}### - ---------------------------------------------------" + err "Please enter a valid username to continue" reload return 1 fi ok } -################################################################################################### rootuser_setup() { - local prompt="Root User Setup" - sleep 0.2 - NC " - - -${magenta}###${nc}-------------------------------------${magenta}[ ${bwhite}Root User Setup${nc} ${magenta}]${nc}-------------------------------------${magenta}### - " - BLUE " - -Enter a password for the${nc}${cyan} Root ${blue}user: " - read -r -p " -==> " ROOTPASSWD - echo - + title "${prompt}" + get "Enter a password for the${nc}${cyan} Root ${blue}user" + read -r -p "==> " ROOTPASSWD if [[ -z "${ROOTPASSWD}" ]]; then - sleep 0.2 - RED " - --------------------------------------------------------------- - ### ${nc}Please enter a password for the Root user to continue ${red}### - ---------------------------------------------------------------" + err "Please enter a password for the Root user to continue" reload return 1 fi - BLUE " - -Re-enter${nc} ${cyan}Root ${blue}user's password: " - read -r -p " -==> " ROOTPASSWD2 - echo - + get "Re-enter${nc} ${cyan}Root ${blue}user's password" + read -r -p "==> " ROOTPASSWD2 if [[ "${ROOTPASSWD}" != "${ROOTPASSWD2}" ]]; then - sleep 0.2 - RED " - --------------------------------------------------- - ### ${nc}Passwords don't match. Please try again.. ${red}### - ---------------------------------------------------" + err "Passwords don't match. Please try again.." reload return 1 fi ok } -################################################################################################### slct_hostname() { - local prompt="Hostname Setup" - sleep 0.2 - NC " - - -${magenta}###${nc}-------------------------------------${magenta}[ ${bwhite}Hostname Setup${nc} ${magenta}]${nc}-------------------------------------${magenta}### - " - BLUE " - -Enter a hostname: " - read -r -p " -==> " HOSTNAME - echo - + title "${prompt}" + get "Enter a hostname" + read -r -p "==> " HOSTNAME if [[ -z "${HOSTNAME}" ]]; then - sleep 0.2 - RED " - --------------------------------------------- - ### ${nc}Please enter a hostname to continue ${red}### - ---------------------------------------------" + err "Please enter a hostname to continue" reload return 1 elif [[ "${HOSTNAME}" =~ [[:upper:]] ]]; then - sleep 0.2 - RED " - ---------------------------------------------------- - ### ${nc}Lowercase is preferred. Please try again.. ${red}### - ----------------------------------------------------" + err "Lowercase is preferred. Please try again.." reload return 1 fi ok } -################################################################################################### slct_shell() { - local prompt="Shell Selection" - sleep 0.2 - NC " - - -${magenta}###${nc}-------------------------------------${magenta}[ ${bwhite}Shell Selection${nc} ${magenta}]${nc}-------------------------------------${magenta}### - " - YELLOW " - - > Select a Shell: " - NC " - - [1] Bash - - [2] Zsh - - [3] Fish " - BLUE " - - -Enter a number: " - read -r -p " -==> " shellnmbr - echo - + title "${prompt}" + ask "Select a Shell" + NC "\n\n [1] Bash\n\n [2] Zsh\n\n [3] Fish" + get "Enter a number" + read -r -p "==> " shellnmbr case "${shellnmbr}" in 1) shell="" @@ -1049,60 +603,22 @@ Enter a number: " shellname2="Fish" shell_pkgs="powerline powerline-fonts which" ;; "") - sleep 0.2 - RED " - ------------------------------- - ### ${nc}Please select a Shell ${red}### - -------------------------------" + err "Please select a Shell" reload return 1 ;; *) invalid return 1 ;; esac - - sleep 0.2 - YELLOW " - - ### The ${shellname2} shell has been selected - " + ack "The ${shellname2} shell has been selected" ok } -################################################################################################### sys_submn() { - - sleep 0.2 - NC " - - -${magenta}###${nc}----------------------------------${magenta}[ ${bwhite}System Configuration${nc} ${magenta}]${nc}----------------------------------${magenta}### - " - YELLOW " - - > Select a Submenu: " - NC " - - [1] Kernel, Secureboot Signing, Bootloader & ESP Mountpoint - - [2] Filesystem & Swap Setup - - [3] Graphics Setup - - [4] Desktop Setup - - [5] EFI Boot Entries Deletion - - [6] Optimizations - - [ ] Return to Main Menu " - BLUE " - - -Enter a number: " - read -r -p " -==> " sysmenu - echo - + title "System Configuration" + ask "Select a Submenu" + NC "\n\n [1] Kernel, Secureboot Signing, Bootloader & ESP Mountpoint\n\n [2] Filesystem & Swap Setup\n\n [3] Graphics Setup\n\n [4] Desktop Setup\n\n [5] EFI Boot Entries Deletion\n\n [6] Extended Options\n\n [ ] Return to Main Menu" + get "Enter a number" + read -r -p "==> " sysmenu case "${sysmenu}" in 1) until slct_krnl; do : ; done @@ -1124,7 +640,7 @@ Enter a number: " until boot_entr; do : ; done return 1 ;; 6) - until optm_submn; do : ; done + until ext_opt_submn; do : ; done return 1 ;; "") until main_menu; do : ; done ;; @@ -1133,36 +649,13 @@ Enter a number: " return 1 ;; esac } -################################################################################################### slct_krnl() { - - local prompt="Kernel" - sleep 0.2 - NC " - - -${magenta}###${nc}------------------------------------${magenta}[ ${bwhite}Kernel Selection${nc} ${magenta}]${nc}------------------------------------${magenta}### - " - YELLOW " - - > Select a Kernel: " - NC " - - [1] Linux - - [2] Linux LTS - - [3] Linux Hardened - - [4] Linux Zen " - BLUE " - - -Enter a number: " - read -r -p " -==> " kernelnmbr - echo - + local prompt="Kernel Selection" + title "${prompt}" + ask "Select a Kernel" + NC "\n\n [1] Linux\n\n [2] Linux LTS\n\n [3] Linux Hardened\n\n [4] Linux Zen" + get "Enter a number" + read -r -p "==> " kernelnmbr case "${kernelnmbr}" in 1) kernel="linux" @@ -1171,57 +664,30 @@ Enter a number: " kernel="linux-lts" kernelname="Linux LTS" ;; 3) - CYAN " - >> ${nc}System Hibernation is ${yellowl}not supported ${nc}by this kernel - " + inf "${yellowl}INFO: ${nc}System Hibernation is ${bwhite}not supported ${nc}by this kernel" kernel="linux-hardened" kernelname="Linux Hardened" ;; 4) kernel="linux-zen" kernelname="Linux Zen" ;; "") - sleep 0.2 - RED " - -------------------------------- - ### ${nc}Please select a Kernel ${red}### - --------------------------------" + err "Please select a Kernel" reload return 1 ;; *) invalid return 1 ;; esac - - sleep 0.2 - YELLOW " - - ### The ${kernelname} kernel has been selected - " + ack "The ${kernelname} kernel has been selected" ok } -################################################################################################### ask_sign() { - - sleep 0.2 - NC " - - -${magenta}###${nc}-----------------------------------${magenta}[ ${bwhite}Secureboot Signing${nc} ${magenta}]${nc}-----------------------------------${magenta}### - " - YELLOW " - - > Sign UKI(s), Kernel & binaries for use with Secure Boot ? [y/N]" - BLUE " - - -Enter [y/N]: " - read -r -p " -==> " sb_sign - - echo + title "Secureboot Signing" + ask "Sign UKI(s), Kernel & binaries for use with Secure Boot ? [y/N]" + get "Enter [y/N]" + read -r -p "==> " sb_sign sb_sign="${sb_sign:-n}" sb_sign="${sb_sign,,}" - if [[ "${sb_sign}" == "y" ]]; then local prompt="Secure Boot 'Setup' Mode Verification" validpkgs+=(sbctl) @@ -1229,38 +695,16 @@ Enter [y/N]: " if [[ "${SB_Status}" == "(setup)" ]]; then ok else - sleep 0.2 - RED " - ----------------------------------------- - ### ${nc}Secure Boot Not in ${yellowl}'Setup' ${nc}Mode ${red}### - ----------------------------------------- - - - " + err "Secure Boot Not in ${yellowl}'Setup' ${nc}Mode" + printf "\n\n" failure fi - sleep 0.2 - YELLOW " - - - ### 'Secure Boot Signing' has been selected - " - sleep 0.2 - YELLOW " - - - > Create an additional bootloader Rescue entry (for troubleshooting) ? [Y/n]" - BLUE " - - -Enter [Y/n]: " - read -r -p " -==> " setrescue - - echo + ack "Secure Boot Signing' has been selected" + ask "Create an additional bootloader Rescue entry (for troubleshooting) ? [Y/n]" + get "Enter [Y/n]" + read -r -p "==> " setrescue setrescue="${setrescue:-y}" setrescue="${setrescue,,}" - if [[ "${setrescue}" == "y" ]]; then local prompt="Rescue Entry set" ok @@ -1279,77 +723,31 @@ Enter [Y/n]: " local prompt="Secure Boot Signing setup" ok } -################################################################################################### slct_bootldr() { - local prompt="Bootloader Selection" - sleep 0.2 - NC " - - -${magenta}###${nc}----------------------------------${magenta}[ ${bwhite}Bootloader Selection${nc} ${magenta}]${nc}----------------------------------${magenta}### - " - YELLOW " - - > Select a Bootloader: " - NC " - - [1] Systemd-boot - - [2] Grub " - BLUE " - - -Enter a number: " - read -r -p " -==> " bootloader - echo - + title "${prompt}" + ask "Select a Bootloader" + NC "\n\n [1] Systemd-boot\n\n [2] Grub" + get "Enter a number" + read -r -p "==> " bootloader case "${bootloader}" in 1) uki="y" ukify="systemd-ukify" - sleep 0.2 - YELLOW " - - ### Systemd-boot has been selected - " ;; + ack "Systemd-boot has been selected" ;; 2) uki="n" - sleep 0.2 - YELLOW " - - > Select a Boot Path to install to: " - NC " - - [1] Standard Path - - [2] Fallback Path -- for Removable Devices (recommended) " - BLUE " - - -Enter a number: " - read -r -p " -==> " path - echo - + ask "Select a Boot Path to install to" + NC "\n\n [1] Standard Path\n\n [2] Fallback Path -- for Removable Devices (recommended)" + get "Enter a number" + read -r -p "==> " path case "${path}" in 1) - YELLOW " - - ### Grub (Standard Boot Path) has been selected - " ;; + ack "Grub (Standard Boot Path) has been selected" ;; 2) - YELLOW " - - ### Grub (Fallback Boot Path) has been selected - " ;; + ack "Grub (Fallback Boot Path) has been selected" ;; "") - sleep 0.2 - RED " - ----------------------------------- - ### ${nc}Please select a Boot Path ${red}### - -----------------------------------" + err "Please select a Boot Path" reload return 1 ;; *) @@ -1357,11 +755,7 @@ Enter a number: " return 1 ;; esac ;; "") - sleep 0.2 - RED " - ------------------------------------ - ### ${nc}Please select a Bootloader ${red}### - ------------------------------------" + err "Please select a Bootloader" reload return 1 ;; *) @@ -1370,55 +764,24 @@ Enter a number: " esac ok } -################################################################################################### slct_espmnt() { - - local prompt="ESP Mountpoint" - sleep 0.2 - NC " - - -${magenta}###${nc}--------------------------------${magenta}[ ${bwhite}ESP Mountpoint Selection${nc} ${magenta}]${nc}--------------------------------${magenta}### - " - YELLOW " - - > Select a Mountpoint for the ESP: " - NC " - - [1] /mnt/efi - - [2] /mnt/boot " - BLUE " - - -Enter a number: " - read -r -p " -==> " espmnt - echo - + local prompt="ESP Mountpoint Selection" + title "${prompt}" + ask "Select a Mountpoint for the ESP" + NC "\n\n [1] /mnt/efi\n\n [2] /mnt/boot" + get "Enter a number" + read -r -p "==> " espmnt case "${espmnt}" in 1) esp_mount="/mnt/efi" btldr_esp_mount="/efi" - sleep 0.2 - YELLOW " - - ### '/mnt/efi' mountpoint has been selected - " ;; + ack "'/mnt/efi' mountpoint has been selected" ;; 2) esp_mount="/mnt/boot" btldr_esp_mount="/boot" - sleep 0.2 - YELLOW " - - ### '/mnt/boot' mountpoint has been selected - " ;; + ack "'/mnt/boot' mountpoint has been selected" ;; "") - sleep 0.2 - RED " - ------------------------------------ - ### ${nc}Please select a Mountpoint ${red}### - ------------------------------------" + err "Please select a Mountpoint" reload return 1 ;; *) @@ -1430,87 +793,38 @@ Enter a number: " until sanity_check; do : ; done fi } -################################################################################################### slct_fs() { - - local prompt="Filesystem Setup" - sleep 0.2 - NC " - - -${magenta}###${nc}----------------------------------${magenta}[ ${bwhite}Filesystem Selection${nc} ${magenta}]${nc}----------------------------------${magenta}### - " - YELLOW " - - > Select Filesystem to be used: " - NC " - - [1] Ext4 - - [2] Btrfs " - BLUE " - - -Enter a number: " - read -r -p " -==> " fs - echo - + local prompt="Filesystem Selection" + title "${prompt}" + ask "Select Filesystem to be used" + NC "\n\n [1] Ext4\n\n [2] Btrfs" + get "Enter a number" + read -r -p "==> " fs case "${fs}" in 1) fsname="Ext4" fs_mod="ext4" fstools="e2fsprogs" roottype="/Root" - sleep 0.2 - YELLOW " - - ### NOTE: Keeping User Data on a separate /Home partition is supported - - - - > Make use of a dedicated /Home partition ? [y/N] " - BLUE " - - -Enter [y/N]: " - read -r -p " -==> " sep_home - - echo + inf "${yellowl}INFO: ${nc}Keeping User Data on a ${bwhite}separate ${nc}/Home partition is supported" + ask "Make use of a dedicated /Home partition ? [y/N]" + get "Enter [y/N]" + read -r -p "==> " sep_home sep_home="${sep_home:-n}" sep_home="${sep_home,,}" - case "${sep_home}" in y) - sleep 0.2 - YELLOW " - - > Make a selection: " - NC " - - [1] Create a /Home partition - - [2] Utilize a previously used unencrypted /Home partition " - BLUE " - - -Enter a number: " - read -r -p " -==> " hometype - echo + ask "Make a selection" + NC "\n\n [1] Create a /Home partition\n\n [2] Utilize a previously used unencrypted /Home partition" + get "Enter a number" + read -r -p "==> " hometype case "${hometype}" in 1) - sleep 0.2 - YELLOW " - - ### A /Home Partition will be created " ;; + ack "A /Home Partition will be created" ;; 2) - sleep 0.2 - YELLOW " - - ### An existing /Home Partition will be used " ;; - *) invalid + ack "An existing /Home Partition will be used" ;; + *) + invalid return 1 ;; esac ;; n) @@ -1519,44 +833,23 @@ Enter a number: " invalid return 1 ;; esac - sleep 0.2 - YELLOW " - - ### ${fsname} has been selected - " ;; + ack "${fsname} has been selected" ;; 2) fsname="Btrfs" fs_mod="btrfs" fstools="btrfs-progs" roottype="/@" btrfs_bootopts="rootflags=subvol=@" - sleep 0.2 - YELLOW " - - ### ${fsname} has been selected " - sleep 0.2 - YELLOW " - - - > Label your Btrfs snapshots directory: " - BLUE " - - -Enter a name: " - read -r -p " -==> " snapname - echo - + ack "${fsname} has been selected" + ask "Label your Btrfs snapshots directory" + get "Enter a name" + read -r -p "==> " snapname if [[ -z "${snapname}" ]]; then invalid return 1 fi ;; "") - sleep 0.2 - RED " - ------------------------------------ - ### ${nc}Please select a Filesystem ${red}### - ------------------------------------" + err "Please select a Filesystem" reload return 1 ;; *) @@ -1565,69 +858,31 @@ Enter a name: " esac ok } -################################################################################################### slct_swap() { - - local prompt="Swap Setup" - sleep 0.2 - NC " - - -${magenta}###${nc}-------------------------------------${magenta}[ ${bwhite}Swap Selection${nc} ${magenta}]${nc}-------------------------------------${magenta}### - " - YELLOW " - - > Select Swap type: " - NC " - - [1] Swap Partition - - [2] Swapfile - - [3] Zram Swap " - BLUE " - - -Enter a number ${bwhite}(empty to skip)${blue}: " - read -r -p " -==> " swapmode - echo - + local prompt="Swap Selection" + title "${prompt}" + ask "Select Swap type" + NC "\n\n [1] Swap Partition\n\n [2] Swapfile\n\n [3] Zram Swap" + get "Enter a number ${bwhite}(empty to skip)" + read -r -p "==> " swapmode case "${swapmode}" in 1) swaptype="swappart" - sleep 0.2 - YELLOW " - - ### Swap Partition has been selected - " ;; + ack "Swap Partition has been selected" ;; 2) if [[ "${fs}" == "1" ]]; then swaptype="swapfile" elif [[ "${fs}" == "2" ]]; then swaptype="swapfile_btrfs" fi - sleep 0.2 - YELLOW " - - ### Swapfile has been selected - - " + ack "Swapfile has been selected" until set_swapsize; do : ; done ;; 3) - CYAN " - >> ${nc}Hibernating to Swap on Zram is ${yellowl}not supported${nc} " + inf "Hibernating to Swap on Zram is ${yellowl}not supported" zram="zram-generator" - YELLOW " - - ### Zram Swap has been selected - " ;; + ack "Zram Swap has been selected" ;; "") - sleep 0.2 - YELLOW " - - ### No Swap will be used - " + ack "No Swap will be used" skip ;; *) invalid @@ -1635,58 +890,31 @@ Enter a number ${bwhite}(empty to skip)${blue}: " esac ok } -################################################################################################### set_swapsize() { - local prompt="Swapsize" - YELLOW " - ### Set Swap size (integers only eg. 1,4,8,16,34) - " - BLUE " - -Enter Swap size ${bwhite}(in GB)${blue}: " - read -r -p " -==> " swapsize - echo - + inf "Set Swap ${yellowl}size ${nc}(integers only eg. 1,4,8,16,34)" + get "Enter Swap size ${bwhite}(in GB)" + read -r -p "==> " swapsize if [[ -z "${swapsize}" ]]; then - sleep 0.2 - RED " - ------------------------------------------ - ### ${nc}Please enter a value to continue ${red}### - ------------------------------------------" + err "Please enter a value to continue" reload - line2 return 1 elif [[ "${swapsize}" == [[:digit:]] ]]; then ok else - sleep 0.2 - RED " - --------------------------------------------- - ### ${nc}Please use only integers as a value ${red}### - ---------------------------------------------" + err "Please use only integers as a value" reload - line2 return 1 fi } -################################################################################################### dtct_gfx() { - gfx_slct="yes" - if [[ "${vendor}" == "Virtual Machine" ]]; then vm skip return 0 fi - sleep 0.2 - NC " - - -${magenta}###${nc}-------------------------------------${magenta}[ ${bwhite}Graphics Setup${nc} ${magenta}]${nc}-------------------------------------${magenta}### - " + title "Graphics Setup" gfxcount="$(lspci | grep -E -c 'VGA|Display|3D')" gfxcard="$(lspci | grep -E 'VGA|Display|3D' | sed 's/^.*: //g')" intelcount="$(lspci | grep -E 'VGA|Display|3D' | grep -E -c 'Intel Corporation')" @@ -1695,50 +923,32 @@ ${magenta}###${nc}-------------------------------------${magenta}[ ${bwhite}Grap amdcards="$(lspci | grep -E 'VGA|Display|3D' | grep -E 'Advanced Micro Devices' | sed 's/.*\[AMD\/ATI\] //g' | cat --number | sed 's/.[0-9]//')" nvidiacount="$(lspci | grep -E 'VGA|Display|3D' | grep -E -c 'NVIDIA Corporation')" nvidiacards="$(lspci | grep -E 'VGA|Display|3D' | grep -E 'NVIDIA Corporation'| sed 's/.*Corporation //g' | cat --number | sed 's/.[0-9]//')" - if [[ "${gfxcount}" == "1" ]]; then dtct_single_gfx else dtct_multi_gfx fi } -################################################################################################### dtct_single_gfx() { - if [[ "${intelcount}" -eq "1" ]]; then vendor="Intel" sourcetype="Open-source" - sleep 0.2 intel elif [[ "${amdcount}" -eq "1" ]]; then vendor="AMD" sourcetype="Open-source" - sleep 0.2 amd elif [[ "${nvidiacount}" -eq "1" ]]; then vendor="Nvidia" nvidia sleep 0.2 CYAN " - ### ${yellowl}Turing ${bwhite}(NV160/TUxxx) ${nc}Graphics or newer are officialy supported ${cyan} - - ### ${yellowl}Maxwell ${bwhite}(NV110/GMxxx) ${nc}through ${yellowl}Volta ${bwhite}(NV140/GVxxx) ${nc}Graphics are unofficialy supported ${yellowl}[AUR] ${nc}${cyan} - - - ### ${nc}Selecting ${yellowl}(n)o ${nc}defaults to the ${bwhite}open-source ${yellowl}'nouveau' ${nc}driver " - YELLOW " - - > Install proprietary Nvidia drivers ? [Y/n] " - BLUE " - - -Enter [Y/n]: " - read -r -p " -==> " nvidiaprop - + ### ${yellowl}Turing ${bwhite}(NV160/TUxxx) ${nc}Graphics or newer are officialy supported ${cyan}\n\n ### ${yellowl}Maxwell ${bwhite}(NV110/GMxxx) ${nc}through ${yellowl}Volta ${bwhite}(NV140/GVxxx) ${nc}Graphics are unofficialy supported ${yellowl}[AUR] ${nc}${cyan}\n\n\n ### ${nc}Selecting ${yellowl}(n)o ${nc}defaults to the ${bwhite}open-source ${yellowl}'nouveau' ${nc}driver" + ask "Install proprietary Nvidia drivers ? [Y/n]" + get "Enter [Y/n]" + read -r -p "==> " nvidiaprop nvidiaprop="${nvidiaprop:-y}" nvidiaprop="${nvidiaprop,,}" - if [[ "${nvidiaprop}" == "y" ]]; then sourcetype="Proprietary" elif [[ "${nvidiaprop}" == "n" ]]; then @@ -1751,68 +961,35 @@ Enter [Y/n]: " fi gfx_conf } -################################################################################################### dtct_multi_gfx() { - sleep 0.2 - YELLOW " - - ### Multi Graphics Setup detected, consisting of: " - NC " - ____________________________________________________________________" - + YELLOW "\n\n ### Multi Graphics Setup detected, consisting of:" + NC "\n ____________________________________________________________________" if [[ "${intelcount}" -ge "1" ]]; then echo BLUEBG " ------------------------------- " BLUEBG " [${intelcount}] Intel Graphics device(s) " BLUEBG " ------------------------------- " - NC " -${intelcards} - - ____________________________________________________________________" + NC "\n${intelcards}\n\n ____________________________________________________________________" fi - if [[ "${amdcount}" -ge "1" ]]; then echo REDBG " ------------------------------- " REDBG " [${amdcount}] AMD Graphics device(s) " REDBG " ------------------------------- " - NC " -${amdcards} - - ____________________________________________________________________" + NC "\n${amdcards}\n\n ____________________________________________________________________" fi - if [[ "${nvidiacount}" -ge "1" ]]; then echo GREENBG " ------------------------------- " GREENBG " [${nvidiacount}] Nvidia Graphics device(s) " GREENBG " ------------------------------- " - NC " -${nvidiacards} - - - ${cyan}### ${yellowl}Turing ${bwhite}(NV160/TUxxx) ${nc}Graphics or newer are officialy supported ${cyan} - - ### ${yellowl}Maxwell ${bwhite}(NV110/GMxxx) ${nc}through ${yellowl}Volta ${bwhite}(NV140/GVxxx) ${nc}Graphics are unofficialy supported ${yellowl}[AUR] ${nc}${cyan} - - - ### ${nc}Selecting ${yellowl}(n)o ${nc}defaults to the ${bwhite}open-source ${yellowl}'nouveau' ${nc}driver - ________________________________________________________________" - - YELLOW " - - > Install proprietary Nvidia drivers ? [Y/n] " - BLUE " - - -Enter [Y/n]: " - read -r -p " -==> " nvidiaprop - + NC "\n${nvidiacards}\n\n\n ${cyan}### ${yellowl}Turing ${bwhite}(NV160/TUxxx) ${nc}Graphics or newer are officialy supported ${cyan}\n\n ### ${yellowl}Maxwell ${bwhite}(NV110/GMxxx) ${nc}through ${yellowl}Volta ${bwhite}(NV140/GVxxx) ${nc}Graphics are unofficialy supported ${yellowl}[AUR] ${nc}${cyan}\n\n\n ### ${nc}Selecting ${yellowl}(n)o ${nc}defaults to the ${bwhite}open-source ${yellowl}'nouveau' ${nc}driver\n ________________________________________________________________" + ask "Install proprietary Nvidia drivers ? [Y/n]" + get "Enter [Y/n]" + read -r -p "==> " nvidiaprop nvidiaprop="${nvidiaprop:-y}" nvidiaprop="${nvidiaprop,,}" - if [[ "${nvidiaprop}" == "n" ]]; then skip elif [[ ! "${nvidiaprop}" =~ ^(y|n)$ ]]; then @@ -1820,138 +997,77 @@ Enter [Y/n]: " return 1 fi fi - multivendors=() multisourcetype=() - - if [[ "${intelcount}" -ge "1" ]]; then - multivendors+=(Intel) + if [[ "${intelcount}" -ge "1" ]]; then + multivendors+=(Intel) + multisourcetype+=(Open-source) + fi + if [[ "${amdcount}" -ge "1" ]]; then + multivendors+=(AMD) + multisourcetype+=(Open-source) + fi + if [[ "${nvidiacount}" -ge "1" ]]; then + multivendors+=(Nvidia) + if [[ "${nvidiaprop}" == "y" ]]; then + multisourcetype+=(Proprietary) + else multisourcetype+=(Open-source) fi - if [[ "${amdcount}" -ge "1" ]]; then - multivendors+=(AMD) - multisourcetype+=(Open-source) - fi - if [[ "${nvidiacount}" -ge "1" ]]; then - multivendors+=(Nvidia) - if [[ "${nvidiaprop}" == "y" ]]; then - multisourcetype+=(Proprietary) - else - multisourcetype+=(Open-source) - fi - fi - + fi vendors="${multivendors[*]}" sourcetype="${multisourcetype[*]}" - - if [[ "${sourcetype}" =~ "Open-source" && "${sourcetype}" =~ "Proprietary" ]]; then - sourcetype="Open-source & Proprietary" - elif [[ "${sourcetype}" =~ "Open-source" ]]; then - sourcetype="Open-source" - elif [[ "${sourcetype}" =~ "Proprietary" ]]; then - sourcetype="Proprietary" - fi + if [[ "${sourcetype}" =~ "Open-source" && "${sourcetype}" =~ "Proprietary" ]]; then + sourcetype="Open-source & Proprietary" + elif [[ "${sourcetype}" =~ "Open-source" ]]; then + sourcetype="Open-source" + elif [[ "${sourcetype}" =~ "Proprietary" ]]; then + sourcetype="Proprietary" + fi gfx_conf } -################################################################################################### gfx_conf() { - - sleep 0.2 - YELLOW " - - - ### ${sourcetype} drivers will be used - " - + inf "${yellowl}${sourcetype} ${nc}drivers will be used" if [[ "${vendor}" == "AMD" || "${vendors}" =~ "AMD" ]]; then - sleep 0.2 - YELLOW " - - > Enable 'amdgpu' driver support for: " - NC " - - [1] 'Southern Islands' Graphics - - [2] 'Sea Islands' Graphics " - BLUE " - - -Enter a number ${bwhite}(empty to skip)${blue}: " - read -r -p " -==> " islands - + ask "Enable 'amdgpu' driver support for" + NC "\n\n [1] 'Southern Islands' Graphics\n\n [2] 'Sea Islands' Graphics" + get "Enter a number ${bwhite}(empty to skip)" + read -r -p "==> " islands case "${islands}" in 1) - sleep 0.2 - NC " - -==> [${green}Southern Islands OK${nc}] - - " ;; + local prompt="Southern Islands" + ok ;; 2) - sleep 0.2 - NC " - -==> [${green}Sea Islands OK${nc}] - - " ;; + local prompt="Sea Islands" + ok ;; "") - skip - echo ;; + skip ;; *) invalid return 1 ;; esac fi - - if [[ "${nvidiaprop}" == "y" ]]; then sleep 0.2 - YELLOW " - > Select Nvidia driver: " - NC " - - [1] Nvidia-open ${yellowl}Turing ${bwhite}(NV160/TUxxx) ${nc}Graphics or newer - - [2] Nvidia-580xx-dkms [AUR] ${yellowl}Maxwell ${bwhite}(NV110/GMxxx) ${nc}through ${yellowl}Volta ${bwhite}(NV140/GVxxx) ${nc}Graphics " - BLUE " - - -Enter a number: " - read -r -p " -==> " family - + ask "Select Nvidia driver" + NC "\n\n [1] Nvidia-open ${yellowl}Turing ${bwhite}(NV160/TUxxx) ${nc}Graphics or newer\n\n [2] Nvidia-580xx-dkms [AUR] ${yellowl}Maxwell ${bwhite}(NV110/GMxxx) ${nc}through ${yellowl}Volta ${bwhite}(NV140/GVxxx) ${nc}Graphics" + get "Enter a number" + read -r -p "==> " family case "${family}" in - 1) # Turing+ Family - sleep 0.2 - NC " - -==> [${green}Turing+ OK${nc}] - " ;; - 2) # Maxwell-Volta Family - sleep 0.2 - NC " - -==> [${green}Maxwell -> Volta OK${nc}] - " + 1) + local prompt="Turing+" + ok ;; + 2) + local prompt="Maxwell -> Volta" + ok local prompt="GSP Firmware Disabled" - sleep 0.2 - YELLOW " - - > Disable 'GSP' firmware ? [y/n] " - BLUE " - - -Enter [y/n]: " - read -r -p " -==> " nogsp - + ask "Disable 'GSP' firmware ? [y/n]" + get "Enter [y/n]" + read -r -p "==> " nogsp if [[ "${nogsp}" == "n" ]]; then skip - echo elif [[ "${nogsp}" == "y" ]]; then ok - echo else y_n return 1 @@ -1963,96 +1079,53 @@ Enter [y/n]: " invalid return 1 ;; esac - local prompt="Low Latency Display Interrupts enabled" - sleep 0.2 - YELLOW " - - > Enable Low Latency Display Interrupts (experimental) ? [Y/n] " - BLUE " - - -Enter [Y/n]: " - read -r -p " -==> " lowlat - + ask "Enable Low Latency Display Interrupts (experimental) ? [Y/n]" + get "Enter [Y/n]" + read -r -p "==> " lowlat lowlat="${lowlat:-y}" lowlat="${lowlat,,}" - if [[ "${lowlat}" == "n" ]]; then skip - echo elif [[ "${lowlat}" == "y" ]]; then ok - echo else y_n return 1 fi fi - sleep 0.2 - YELLOW " - - ### Graphics will be automatically configured - " + ack "Graphics will be automatically configured" local prompt="Graphics Setup" ok - if [[ "${install}" == "yes" ]]; then keypress - fi } -################################################################################################### gfxpkgs_set() { - - # Graphics packages gfxpkgs=() - - # Intel Graphics if [[ "${vendor}" == "Intel" || "${vendors}" =~ "Intel" ]]; then - # /etc/sysctl.d/99-sysctld.conf perf_stream="dev.i915.perf_stream_paranoid = 0" gfxpkgs+=(igsc intel-compute-runtime intel-media-driver intel-media-sdk libva-intel-driver libva-utils libvpl opencl-headers vpl-gpu-rt vkd3d vulkan-intel vulkan-mesa-layers) fi - - # AMD Graphics if [[ "${vendor}" == "AMD" || "${vendors}" =~ "AMD" ]]; then gfxpkgs+=(libva-mesa-driver mesa-utils opencl-headers rocm-opencl-runtime vkd3d vulkan-mesa-layers vulkan-radeon) fi - - # Nvidia Graphics if [[ "${nvidiaprop}" == "y" ]]; then - # Swap partition|swapfile|zram-swap = yes if [[ "${swapmode}" =~ ^(1|2|3)$ ]]; then sleep 0.2 - NC " - ----------------------------------------------------------------${cyan} - ### ${yellowl}INFO: ${nc}When Hibernating ${cyan}### - - ### ${nc}Nvidia's ${yellowl}'Preserve-Video-Memory-After-Suspend' ${nc}feature ${cyan}### - - ### ${nc}is incompatible with ${yellowl}'Early KMS' ${nc}use ${cyan}###${nc} - ----------------------------------------------------------------" + NC "\n ----------------------------------------------------------------\n ${cyan}### ${yellowl}INFO: ${nc}When Hibernating ${cyan}###\n\n ### ${nc}Nvidia's ${yellowl}'Preserve-Video-Memory-After-Suspend' ${nc}feature ${cyan}###\n\n ### ${nc}is incompatible with ${yellowl}'Early KMS' ${nc}use ${cyan}###${nc}\n ----------------------------------------------------------------" keypress fi - gfxpkgs=(libva-mesa-driver libva-nvidia-driver libvdpau-va-gl vkd3d) - - # Turing+ GPUs if [[ "${family}" == "1" ]]; then gfxpkgs+=(nvidia-settings nvidia-utils opencl-nvidia opencl-headers) - # Linux Kernel if [[ "${kernelnmbr}" == "1" ]]; then nvname="nvidia-open" gfxpkgs+=(nvidia-open) - # Linux LTS Kernel elif [[ "${kernelnmbr}" == "2" ]]; then nvname="nvidia-open-lts" gfxpkgs+=(nvidia-open-lts) - # Other Kernels else gfxpkgs+=(nvidia-open-dkms) fi - # Maxwell -> Volta GPUs elif [[ "${family}" == "2" ]]; then nvidia_aur="y" fi @@ -2060,38 +1133,12 @@ gfxpkgs_set() { gfxpkgs+=(libva-mesa-driver vulkan-nouveau) fi } -################################################################################################### dsktp_setup() { - - sleep 0.2 - NC " - - -${magenta}###${nc}--------------------------------------${magenta}[ ${bwhite}Desktop Setup${nc} ${magenta}]${nc}--------------------------------------${magenta}### - " - sleep 0.2 - YELLOW " - - - > Make a selection: " - NC " - - [1] Desktop Selection - - [2] Arch 'base-devel' Meta-package - - [3] Web browser Selection - - [4] Printer & Scanner Support - - [ ] Return to System Configuration " - BLUE " - - -Enter a number: " - read -r -p " -==> " desk_setup - + title "Desktop Setup" + ask "Make a selection" + NC "\n\n [1] Desktop Selection\n\n [2] Arch 'base-devel' Meta-package\n\n [3] Web browser Selection\n\n [4] Printer & Scanner Support\n\n [ ] Return to System Configuration" + get "Enter a number" + read -r -p "==> " desk_setup case "${desk_setup}" in 1) until dsktp_slct; do : ; done @@ -2112,122 +1159,114 @@ Enter a number: " return 1 ;; esac } -################################################################################################### +term_offer() { + inf "${desktopname} desktop lacks a ${yellowl}native ${nc}terminal emulator by design" + ask "Install ${nc}'gnome-terminal' ${yellow}for convenience ? [Y/n]" + get "Enter [Y/n]" + read -r -p "==> " terminal + terminal="${terminal:-y}" + terminal="${terminal,,}" + case "${terminal}" in + y) + local prompt="Terminal" + ok ;; + n) + skip ;; + *) + invalid + until term_offer; do : ; done ;; + esac +} +alt_session_support() { + inf "${desktopname} desktop defaults to a(n) ${yellowl}${session} ${nc}session" + ask "Install ${nc}${alt_session} ${yellow}session support ? [N/y]" + get "Enter [N/y]" + read -r -p "==> " session_support + session_support="${session_support:-n}" + session_support="${session_support,,}" + case "${session_support}" in + y) + local prompt="${alt_session} support" + ok ;; + n) + skip ;; + *) + invalid + until alt_session_support; do : ; done ;; + esac +} dsktp_slct() { - - sleep 0.2 - NC " - -${magenta}###${nc}------------------------------------${magenta}[ ${bwhite}Desktop Selection${nc} ${magenta}]${nc}------------------------------------${magenta}### - " + title "Desktop Selection" deskpkgs="" custompkgs="" terminal="" local prompt="Desktop Selection" - sleep 0.2 - YELLOW " - - - > Make a selection: " - NC " - - [1] Plasma - - [2] Plasma Lite - - [3] Gnome - - [4] Gnome Lite - - [5] Xfce - - [6] Cinnamon - - [7] Deepin - - [8] Budgie - - [9] Lxqt - - [10] Mate - - [11] Basic Arch Linux (No GUI) - - [12] Custom Arch Linux - - [13] Cosmic - - [14] Pantheon " - BLUE " - - -Enter a number: " - read -r -p " -==> " desktop - echo - + ask "Make a selection" + NC "\n\n [1] Plasma\n\n [2] Plasma Lite\n\n [3] Gnome\n\n [4] Gnome Lite\n\n [5] Xfce\n\n [6] Cinnamon\n\n [7] Deepin\n\n [8] Budgie\n\n [9] Lxqt\n\n [10] Mate\n\n [11] Basic Arch Linux (No GUI)\n\n [12] Custom Arch Linux\n\n [13] Cosmic\n\n [14] Pantheon" + get "Enter a number" + read -r -p "==> " desktop case "${desktop}" in 1) desktopname="Plasma" - deskname + ack "${desktopname} has been selected" session="Wayland" alt_session="X11" alt_session_support alt_session_pack="plasma-x11-session" ;; 2) desktopname="Plasma Lite" - deskname + ack "${desktopname} has been selected" session="Wayland" alt_session="X11" alt_session_support alt_session_pack="plasma-x11-session" ;; 3) desktopname="Gnome" - deskname ;; + ack "${desktopname} has been selected" ;; 4) desktopname="Gnome Lite" - deskname ;; + ack "${desktopname} has been selected" ;; 5) desktopname="Xfce" - deskname + ack "${desktopname} has been selected" session="X11" alt_session="Wayland (experimental)" alt_session_support alt_session_pack="labwc";; 6) desktopname="Cinnamon" - deskname + ack "${desktopname} has been selected" term_offer ;; 7) desktopname="Deepin" - deskname ;; + ack "${desktopname} has been selected" ;; 8) desktopname="Budgie" - deskname + ack "${desktopname} has been selected" term_offer ;; 9) desktopname="Lxqt" - deskname + ack "${desktopname} has been selected" session="X11" alt_session="Wayland (experimental)" alt_session_support alt_session_pack="labwc lxqt-wayland-session waylock" ;; 10) desktopname="Mate" - deskname ;; + ack "${desktopname} has been selected" ;; 11) desktopname="Basic Arch Linux" - deskname ;; + ack "${desktopname} has been selected" ;; 12) desktopname="Custom Arch Linux" until cust_sys; do :; done return 0 ;; 13) desktopname="Cosmic" - deskname ;; + ack "${desktopname} has been selected" ;; 14) desktopname="Pantheon" - deskname ;; + ack "${desktopname} has been selected" ;; "") choice keypress @@ -2238,7 +1277,6 @@ Enter a number: " return 1 ;; esac ok - if [[ -n "${web}" && "${desktop}" =~ ^(11|12)$ ]]; then until web_browser; do : ; done fi @@ -2246,227 +1284,68 @@ Enter a number: " until print_scan; do : ; done fi } -################################################################################################### cust_sys() { - local prompt="Custom Arch Linux" until add_pkgs; do : ; done until add_services; do : ; done - echo ok } -################################################################################################### add_pkgs() { - - local prompt="Add Packages" - sleep 0.2 - NC " - - -${magenta}###${nc}------------------------------------${magenta}[ ${bwhite}Add Your Packages${nc} ${magenta}]${nc}------------------------------------${magenta}### - " - YELLOW " - - ### 'base', 'linux-firmware' (if on bare-metal), 'sudo' & your current choices are already included " - BLUE " - - -Enter any additional packages ${bwhite}(space-seperated)${blue}: " - read -r -p " -==> " custompkgs - + local prompt="Adding Packages" + title "Add Your Packages" + inf "${bwhite}'base'${nc}, ${bwhite}'linux-firmware' ${nc}(if on bare-metal), ${bwhite}'sudo' ${nc}& your ${bwhite}current ${nc}choices are already ${yellowl}included${nc}\n" + get "Enter any additional packages ${bwhite}(space-seperated)" + read -r -p "==> " custompkgs if [[ -z "${custompkgs}" ]]; then - sleep 0.2 - RED " - --------------------------------------------- - ### ${nc}Please enter package(s) to continue ${red}### - ---------------------------------------------" + err "Please enter package(s) to continue" reload return 1 - elif [[ "${custompkgs}" =~ "lightdm" ]]; then - sleep 0.2 - NC " - - - -${magenta}###${nc}--------------------------------${magenta}[ ${bwhite}LightDM Greeter Selection${nc} ${magenta}]${nc}--------------------------------${magenta}### - " - YELLOW " - - > Select a Greeter: " - NC " - - [1] Gtk - - [2] Slick - - [3] Deepin - - [4] Pantheon " - BLUE " - - -Enter a number: " - read -r -p " -==> " greeternmbr - - case "${greeternmbr}" in - 1) - greeter="lightdm-gtk-greeter" - sleep 0.2 - NC " - -==> [${green}Lightdm Gtk Greeter OK${nc}] " ;; - 2) - greeter="lightdm-slick-greeter" - sleep 0.2 - NC " - -==> [${green}Lightdm Slick Greeter OK${nc}] " ;; - 3) - greeter="lightdm-deepin-greeter" - sleep 0.2 - NC " - -==> [${green}Lightdm Deepin Greeter OK${nc}] " ;; - 4) - greeter="lightdm-pantheon-greeter" - sleep 0.2 - NC " - -==> [${green}Lightdm Pantheon Greeter OK${nc}] " ;; - "") - choice - return 1 ;; - *) - invalid - return 1 ;; - esac - ok else ok fi } -################################################################################################### add_services() { - - local prompt="Add Services" - sleep 0.2 - NC " - - -${magenta}###${nc}------------------------------------${magenta}[ ${bwhite}Add Your Services${nc} ${magenta}]${nc}------------------------------------${magenta}### - " - YELLOW " - - ### Empty to skip " - BLUE " - - -Enter services to be enabled ${bwhite}(space-seperated)${blue}: " - read -r -p " -==> " customservices - + local prompt="Adding Services" + title "Add Your Services" + ack "Empty to skip" + get "Enter services to be enabled ${bwhite}(space-seperated)" + read -r -p "==> " customservices if [[ -z "${customservices}" ]]; then skip else ok fi } -################################################################################################### base_devel() { - - sleep 0.2 - NC " - - -${magenta}###${nc}--------------------------------${magenta}[ ${bwhite}'base-devel' Meta-package${nc} ${magenta}]${nc}--------------------------------${magenta}### - " - local prompt="'base-devel'" - sleep 0.2 - YELLOW " - - - ### NOTE: The 'base' meta-package does not include the tools needed for building packages - - - - > Install 'base-devel' meta-package ? [y/N] " - BLUE " - - -Enter [y/N]: " - read -r -p " -==> " dev - - echo + local prompt="'base-devel' Meta-Package" + title "${prompt}" + inf "${yellowl}INFO: ${nc}The ${bwhite}'base' ${nc}meta-package does not include the ${bwhite}tools ${nc}needed for building packages" + ask "Install 'base-devel' meta-package ? [y/N]" + get "Enter [y/N]" + read -r -p "==> " dev dev="${dev:-n}" dev="${dev,,}" - - case "${dev}" in - y) - devel="base-devel" - validpkgs+=(base-devel) - YELLOW " - - ### The 'base-devel' meta-package will be installed - " ;; - n) - skip ;; - *) - invalid - return 1 ;; - esac + case "${dev}" in + y) + devel="base-devel" + validpkgs+=(base-devel) + ack "The 'base-devel' meta-package will be installed" ;; + n) + skip ;; + *) + invalid + return 1 ;; + esac ok } -################################################################################################### web_browser() { - - sleep 0.2 - NC " - - -${magenta}###${nc}----------------------------------${magenta}[ ${bwhite}Web browser Selection${nc} ${magenta}]${nc}----------------------------------${magenta}### - " - + title "Web Browser Selection" if [[ ! "${desktop}" =~ ^(11|12)$ && -n "${desktop}" ]]; then local prompt="Web Browser" - sleep 0.2 - YELLOW " - - - ### Web Browser support is available - - - - > Select Web Browser to install " - NC " - - [1] Firefox - - [2] Chromium - - [3] Vivaldi - - [4] Brave Browser - - [5] Microsoft Edge - - [6] Zen Browser - - [7] Opera - - [8] Google Chrome - - [9] Helium Browser " - BLUE " - - -Enter a number ${bwhite}(empty to skip)${blue}: " - read -r -p " -==> " web - - echo + ask "Select Web Browser to install" + NC "\n\n [1] Firefox\n\n [2] Chromium\n\n [3] Vivaldi\n\n [4] Brave Browser\n\n [5] Microsoft Edge\n\n [6] Zen Browser\n\n [7] Opera\n\n [8] Google Chrome\n\n [9] Helium Browser" + get "Enter a number ${bwhite}(empty to skip)" + read -r -p "==> " web case "${web}" in 1) web_pkg="firefox" @@ -2513,24 +1392,14 @@ Enter a number ${bwhite}(empty to skip)${blue}: " invalid return 1 ;; esac - if [[ "${web}" =~ ^(4|5|6|7|8|9)$ && -z "${devel}" ]]; then validpkgs+=(base-devel) fi else - sleep 0.2 - RED " - - ----------------------------------------- - ### ${nc}Incompatible Selection detected ${red}### - -----------------------------------------" - sleep 0.2 - YELLOW " - - ### Basic Arch Linux / Custom Arch Linux detected or No Desktop selected yet - - ### No Browser selected - " + echo + err "Incompatible selection detected" + inf "${yellowl}Basic ${nc}Arch Linux / ${yellowl}Custom ${nc}Arch Linux detected or ${yellowl}No Desktop ${nc}selected yet" + ack "No Browser selected" web_pkg="" web_aur="" web_name="" @@ -2538,55 +1407,30 @@ Enter a number ${bwhite}(empty to skip)${blue}: " skip keypress fi - if [[ "${web}" =~ ^(1|2|3|4|5|6|7|8|9)$ ]]; then local prompt="${web_name}" web_slct="yes" ok fi } -################################################################################################### print_scan() { - - sleep 0.2 - NC " - - -${magenta}###${nc}--------------------------------${magenta}[ ${bwhite}Printer & Scanner Support${nc} ${magenta}]${nc}--------------------------------${magenta}### - " - local prompt="Printer & Scanner Support" + local prompt="Printer & Scanner Support" + title "${prompt}" if [[ "${vendor}" != "Virtual Machine" ]]; then if [[ ! "${desktop}" =~ ^(11|12)$ && -n "${desktop}" ]]; then - sleep 0.2 - YELLOW " - - - ### Printer & Scanner support is available - - - - > Enable Printer & Scanner support ? [y/N] " - BLUE " - - -Enter [y/N]: " - read -r -p " -==> " printer - - echo + ask "Enable Printer & Scanner support ? [y/N]" + get "Enter [y/N]" + read -r -p "==> " printer printer="${printer:-n}" printer="${printer,,}" - case "${printer}" in y) collect_print_pkgs=(bluez-cups cups-pdf cups-browsed cups-pk-helper foomatic-db-gutenprint-ppds gutenprint ipp-usb libusb nss-mdns sane-airscan system-config-printer xdg-utils colord) - if [[ "${desktop}" == "2" ]]; then collect_print_pkgs+=(print-manager skanlite) elif [[ "${desktop}" == "4" ]]; then collect_print_pkgs+=(simple-scan) fi - print_pkgs="${collect_print_pkgs[*]}" ;; n) print_pkgs="" @@ -2597,86 +1441,50 @@ Enter [y/N]: " esac ok else - sleep 0.2 - RED " - ----------------------------------------- - ### ${nc}Incompatible Selection detected ${red}### - -----------------------------------------" - sleep 0.2 - YELLOW " - - ### Basic Arch Linux / Custom Arch Linux detected or No Desktop selected yet - - ### Printer/Scanner support not enabled - " + echo + err "Incompatible selection detected" + inf "${yellowl}Basic ${nc}Arch Linux / ${yellowl}Custom ${nc}Arch Linux detected or ${yellowl}No Desktop ${nc}selected yet" + ack "Printer/Scanner support not enabled" print_pkgs="" skip ok keypress fi else - echo - vm print_pkgs="" + vm skip ok fi } -################################################################################################### boot_entr() { - if [[ "${vendor}" == "Virtual Machine" ]]; then efi_entr_del="yes" vm skip return 0 fi - local prompt="Boot Entries" - sleep 0.2 - NC " - - -${magenta}###${nc}--------------------------------${magenta}[ ${bwhite}EFI Boot Entries Deletion${nc} ${magenta}]${nc}--------------------------------${magenta}### - " - YELLOW " - - > Select an EFI Boot Entry to Delete ${red}[!] (CAUTION) [!] - - - " - sleep 0.2 + title "EFI Boot Entries Deletion" + ask "Select an EFI Boot Entry to Delete ${red}[!] (CAUTION) [!]${nc} " + printf "\n\n\n" + NC "" efibootmgr --unicode entrnmbr="$(efibootmgr --unicode | grep -E 'BootOrder' | awk "{print \$2}")" boot_entry=" " - while [[ -n "${boot_entry}" ]]; do - BLUE " - - -Enter a Boot Entry number for Deletion ${bwhite}(empty to skip)${blue}: - -${cyan}Entries: ${yellowl}${entrnmbr} " - read -r -p " -==> " boot_entry - echo - + get "Enter a Boot Entry number for Deletion ${bwhite}(empty to skip)" + CYAN "\nBoot Entries: ${yellowl}${entrnmbr}\n" + read -r -p "==> " boot_entry if [[ -n "${boot_entry}" ]]; then if [[ "${run_as}" != "root" ]]; then - sleep 0.2 - RED " - ----------------------------------- - ### ${nc}Root Privileges Missing.. ${red}### - ----------------------------------- - " + err "Root Privileges Missing.." reload until sys_submn; do : ; done fi if efibootmgr -b "${boot_entry}" -B --unicode; then - sleep 0.2 - NC " - -==> [${green}Entry ${boot_entry} Deleted${nc}] " + local prompt="Entry ${boot_entry} Deleted" + ok else err_try return 1 @@ -2688,51 +1496,13 @@ ${cyan}Entries: ${yellowl}${entrnmbr} " done efi_entr_del="yes" } -################################################################################################### -optm_submn() { - - sleep 0.2 - NC " - - -${magenta}###${nc}--------------------------------------${magenta}[ ${bwhite}Optimizations${nc} ${magenta}]${nc}--------------------------------------${magenta}### - " - sleep 0.2 - YELLOW " - - - > Make a selection: " - NC " - - [1] Custom Kernel Parameters - - [2] System Watchdogs - - [3] General System Optimizations - - [4] Wireless Regulatory Domain - - [5] Systemd-oomd - - [6] Irqbalance - - [7] Thermald - - [8] Rng-tools - - [9] Rtkit - - [10] Tlp - - [ ] Return to System Configuration " - BLUE " - - -Enter a number: " - read -r -p " -==> " set_optm - - case "${set_optm}" in +ext_opt_submn() { + title "Extended Options" + ask "Make a selection" + NC "\n\n [1] Custom Kernel Parameters\n\n [2] System Watchdogs\n\n [3] General System Optimizations\n\n [4] Wireless Regulatory Domain\n\n [5] Systemd-oomd\n\n [6] Irqbalance\n\n [7] Thermald\n\n [8] Rng-tools\n\n [9] Rtkit\n\n [10] Tlp\n\n [ ] Return to System Configuration" + get "Enter a number" + read -r -p "==> " set_ext_opt + case "${set_ext_opt}" in 1) until cust_kern_param; do : ; done return 1 ;; @@ -2740,7 +1510,7 @@ Enter a number: " until sys_watchdog; do : ; done return 1 ;; 3) - until gen_optm; do : ; done + until sysoptm; do : ; done return 1 ;; 4) until ask_wireless_regdom; do : ; done @@ -2770,95 +1540,48 @@ Enter a number: " return 1 ;; esac } -################################################################################################### -ask_optm() { - - local prompt="Optimizations" - sleep 0.2 - YELLOW " - - - > Display available Optimizations ? [y/N]" - BLUE " - - -Enter [y/N]: " - read -r -p " -==> " askoptm - - echo - askoptm="${askoptm:-n}" - askoptm="${askoptm,,}" - - if [[ "${askoptm}" == "n" ]]; then +display_ext_opt() { + local prompt="Extended Options" + ask "Display Extended Options ? [y/N]" + get "Enter [y/N]" + read -r -p "==> " show_extopts + show_extopts="${show_extopts:-n}" + show_extopts="${show_extopts,,}" + if [[ "${show_extopts}" == "n" ]]; then skip ok - elif [[ "${askoptm}" == "y" ]]; then + elif [[ "${show_extopts}" == "y" ]]; then return 0 else invalid return 1 fi } -################################################################################################### cust_kern_param() { - - sleep 0.2 local prompt="Custom Kernel Parameters" - NC " - - -${magenta}###${nc}--------------------------------${magenta}[ ${bwhite}Custom Kernel Parameters${nc} ${magenta}]${nc}--------------------------------${magenta}### - " - sleep 0.2 - YELLOW " - - - ### Custom Kernel Parameters can be set at boot time - - - - > Enter your own additional Kernel Parameters to be added to the Kernel Cmdline ? [y/N] " - BLUE " - - -Enter [y/N]: " - read -r -p " -==> " ask_param - - echo + title "${prompt}" + inf "${yellowl}Custom ${nc}Kernel parameters can be set at ${bwhite}boot ${nc}time" + ask "Enter your own additional Kernel parameters to be added to the Kernel cmdline ? [y/N]" + get "Enter [y/N]" + read -r -p "==> " ask_param ask_param="${ask_param:-n}" ask_param="${ask_param,,}" - - case "${ask_param}" in - y) - until add_prmtrs; do : ; done ;; - n) - skip - ok ;; - *) - invalid - return 1 ;; - esac + case "${ask_param}" in + y) + until add_prmtrs; do : ; done ;; + n) + skip + ok ;; + *) + invalid + return 1 ;; + esac } -################################################################################################### add_prmtrs() { - local prompt="Custom Kernel Parameters" - YELLOW " - - - ### Add Your Kernel Parameters - - - ### Empty to skip " - BLUE " - - -Enter your own Kernel parameters to be set at boot ${bwhite}(space-seperated)${blue}: " - read -r -p " -==> " cust_bootopts - + ask "Add Your Kernel parameters ${nc}(Empty to skip)" + get "Enter your own Kernel parameters to be set at boot ${bwhite}(space-seperated)" + read -r -p "==> " cust_bootopts if [[ -z "${cust_bootopts}" ]]; then skip ok @@ -2866,147 +1589,64 @@ Enter your own Kernel parameters to be set at boot ${bwhite}(space-seperated)${b ok fi } -################################################################################################### sys_watchdog() { - - sleep 0.2 local prompt="System Watchdogs" - NC " - - -${magenta}###${nc}------------------------------------${magenta}[ ${bwhite}System Watchdogs${nc} ${magenta}]${nc}------------------------------------${magenta}### - " - sleep 0.2 - YELLOW " - - - ### A watchdog is a hardware or software component that keeps track of a system's performance - - ### and intervenes if it notices any strange behaviour or malfunctions - - - ### [Applicable for non mission-critical platforms such as desktops & laptops] - - - - > Disable Watchdogs in the installed system ? [y/N] " - BLUE " - - -Enter [y/N]: " - read -r -p " -==> " kill_watchdog - - echo + title "${prompt}" + CYAN "\n\n ### ${nc}A watchdog is a hardware or software component that keeps track of a system's performance${cyan}\n\n ### ${nc}and intervenes if it notices any strange behaviour or malfunctions" + ask "Disable Watchdogs in the installed system ? [y/N]" + get "Enter [y/N]" + read -r -p "==> " kill_watchdog kill_watchdog="${kill_watchdog:-n}" kill_watchdog="${kill_watchdog,,}" - - case "${kill_watchdog}" in - y) - YELLOW " - - ### Watchdogs will be disabled - " ;; - n) - skip ;; - *) - invalid - return 1 ;; - esac + case "${kill_watchdog}" in + y) + ack "Watchdogs will be disabled" ;; + n) + skip ;; + *) + invalid + return 1 ;; + esac ok } -################################################################################################### -gen_optm() { - - sleep 0.2 +sysoptm() { local prompt="System Optimizations" - NC " - - -${magenta}###${nc}----------------------------------${magenta}[ ${bwhite}General Optimizations${nc} ${magenta}]${nc}----------------------------------${magenta}### - " - sleep 0.2 - YELLOW " - - - ### General System Optimizations are available - - - ### Type ${nc}'v' ${yellow}to view a summary - - - - > Enable System Optimizations ? [v/y/N] " - BLUE " - - -Enter [v/y/N]: " - read -r -p " -==> " genoptm - - echo - genoptm="${genoptm:-n}" - genoptm="${genoptm,,}" - - case "${genoptm}" in - y) - validpkgs+=("ccache" "ntfs-3g" "pbzip2" "pigz") - YELLOW " - - ### System Optimizations will be set - " ;; - n) - skip ;; - v) - view_optm - return 1 ;; - *) - invalid - return 1 ;; - esac + title "${prompt}" + CYAN "\n\n ### ${nc}System Optimizations are available${cyan}\n\n ### ${nc}Type ${yellowl}'v' ${nc}to view a summary" + ask "Enable System Optimizations ? [v/y/N]" + get "Enter [v/y/N]" + read -r -p "==> " sys_optm + sys_optm="${sys_optm:-n}" + sys_optm="${sys_optm,,}" + case "${sys_optm}" in + y) + validpkgs+=("ccache" "ntfs-3g" "pbzip2" "pigz") + ack "System Optimizations will be set" ;; + n) + skip ;; + v) + view_optm + return 1 ;; + *) + invalid + return 1 ;; + esac ok } -################################################################################################### ask_wireless_regdom() { - if [[ "${vendor}" == "Virtual Machine" ]]; then vm skip return 0 fi - local prompt="Wireless Regdom Setup" - sleep 0.2 - NC " - - -${magenta}###${nc}----------------------------${magenta}[ ${bwhite}Wireless Regulatory Domain Setup${nc} ${magenta}]${nc}----------------------------${magenta}### - " - - YELLOW " - - - ### The regulatory domain is used to reconfigure wireless drivers, to make sure that wireless - - ### hardware usage complies with local laws set by the FCC, ETSI and other organizations - - - - > Select your Country Code (e.g. US) - - - - ### [Enter ${nc}'l'${yellow} to list country codes, then ${nc}'enter'${yellow} to search or ${nc}'q'${yellow} to quit] " - BLUE " - - -Enter your Country Code, ie:${nc} ${cyan}US ${bwhite}(empty to skip)${blue}: " - read -r -p " -==> " REGDOM - - echo + title "Wireless Regulatory Domain Setup" + CYAN "\n\n ### ${nc}The regulatory domain is used to reconfigure wireless drivers, to make sure that wireless${cyan}\n\n ### ${nc}hardware usage complies with local laws set by the FCC, ETSI and other organizations" + ask "Select your Country Code (e.g. US)" + ack "[Enter ${nc}'l'${yellow} to list country codes, then ${nc}'enter'${yellow} to search or ${nc}'q'${yellow} to quit]" + get "Enter your Country Code ${bwhite}(empty to skip)" + read -r -p "==> " REGDOM REGDOM="${REGDOM^^}" - if [[ -z "${REGDOM}" ]]; then skip elif [[ "${REGDOM}" == "L" ]]; then @@ -3017,54 +1657,22 @@ Enter your Country Code, ie:${nc} ${cyan}US ${bwhite}(empty to skip)${blue}: " return 1 else wireless_reg="wireless-regdb" - sleep 0.2 - YELLOW " - - ### ${REGDOM} Country Code has been selected - " + ack "${REGDOM} Country Code has been selected" fi ok } -################################################################################################### systemd_oomd() { - local prompt="Systemd-oomd Setup" - sleep 0.2 - NC " - - -${magenta}###${nc}-----------------------------------${magenta}[ ${bwhite}Systemd-oomd Setup${nc} ${magenta}]${nc}-----------------------------------${magenta}### - " - sleep 0.2 - YELLOW " - - - ### A system service that uses cgroups-v2 and pressure stall information (PSI) - - ### to monitor system and take corrective action before an 'OOM' occurs in the kernel space - - - - > Enable 'systemd-oomd' ? [y/N] " - CYAN " - - >> ${nc}Swapping enabled is ${yellowl}highly recommended ${nc}for optimal performance " - BLUE " - - -Enter [y/N]: " - read -r -p " -==> " oomd - - echo + title "${prompt}" + CYAN "\n\n ### ${nc}A system service that uses cgroups-v2 and pressure stall information (PSI)\n\n${cyan} ### ${nc}to monitor system and take corrective action before an 'OOM' occurs in the kernel space" + ask "Enable 'systemd-oomd' ? [y/N]" + inf "Swapping enabled is ${yellowl}highly recommended ${nc}for optimal performance" + get "Enter [y/N]" + read -r -p "==> " oomd oomd="${oomd:-n}" oomd="${oomd,,}" - if [[ "${oomd}" == "y" ]]; then - YELLOW " - - ### 'Systemd-oomd' service will be enabled - " + ack "'Systemd-oomd' service will be enabled" elif [[ "${oomd}" == "n" ]]; then skip else @@ -3073,44 +1681,18 @@ Enter [y/N]: " fi ok } -################################################################################################### irqbalance() { - local prompt="Irqbalance Setup" - sleep 0.2 - NC " - - -${magenta}###${nc}------------------------------------${magenta}[ ${bwhite}Irqbalance Setup${nc} ${magenta}]${nc}------------------------------------${magenta}### - " - sleep 0.2 - YELLOW " - - - ### Distributes hardware interrupts across processors on a multiprocessor system - - ### in order to increase performance - - - - > Install & enable 'irqbalance' ? [y/N] " - BLUE " - - -Enter [y/N]: " - read -r -p " -==> " irqbalance - - echo + title "${prompt}" + CYAN "\n\n ### ${nc}Distributes hardware interrupts across processors on a multiprocessor system${cyan}\n\n ### ${nc}in order to increase performance" + ask "Install & enable 'irqbalance' ? [y/N]" + get "Enter [y/N]" + read -r -p "==> " irqbalance irqbalance="${irqbalance:-n}" irqbalance="${irqbalance,,}" - if [[ "${irqbalance}" == "y" ]]; then validpkgs+=(irqbalance) - YELLOW " - - ### 'irqbalance' service will be enabled - " + ack "'irqbalance' service will be enabled" elif [[ "${irqbalance}" == "n" ]]; then skip else @@ -3119,44 +1701,18 @@ Enter [y/N]: " fi ok } -################################################################################################### thermald() { - local prompt="Thermald Setup" - sleep 0.2 - NC " - - -${magenta}###${nc}-------------------------------------${magenta}[ ${bwhite}Thermald Setup${nc} ${magenta}]${nc}-------------------------------------${magenta}### - " - sleep 0.2 - YELLOW " - - - ### A Linux daemon used to prevent the overheating of platforms - - ### This daemon monitors temperature and applies compensation using available cooling methods - - - - > Install & enable 'thermald' ? [y/N] " - BLUE " - - -Enter [y/N]: " - read -r -p " -==> " thermald - - echo + title "${prompt}" + CYAN "\n\n ### ${nc}A Linux daemon used to prevent the overheating of ${yellowl}Intel ${nc}platforms\n\n${cyan} ### ${nc}This daemon monitors temperature and applies compensation using available cooling methods" + ask "Install & enable 'thermald' ? [y/N]" + get "Enter [y/N]: " + read -r -p "==> " thermald thermald="${thermald:-n}" thermald="${thermald,,}" - if [[ "${thermald}" == "y" ]]; then validpkgs+=(thermald) - YELLOW " - - ### 'thermald' service will be enabled - " + ack "'thermald' service will be enabled" elif [[ "${thermald}" == "n" ]]; then skip else @@ -3165,44 +1721,18 @@ Enter [y/N]: " fi ok } -################################################################################################### rngd() { - local prompt="Rng-tools Setup" - sleep 0.2 - NC " - - -${magenta}###${nc}-------------------------------------${magenta}[ ${bwhite}Rng-tools Setup${nc} ${magenta}]${nc}-------------------------------------${magenta}### - " - sleep 0.2 - YELLOW " - - - ### The rngd daemon is capable of using both environmental noise - - ### and hardware random number generators for extracting entropy - - - - > Install & enable 'rngd' ? [y/N] " - BLUE " - - -Enter [y/N]: " - read -r -p " -==> " rngd - - echo + title "${prompt}" + CYAN "\n\n ### ${nc}The rngd daemon is capable of using both environmental noise\n\n${cyan} ### ${nc}and hardware random number generators for extracting entropy" + ask "Install & enable 'rngd' ? [y/N] " + get "Enter [y/N]" + read -r -p "==> " rngd rngd="${rngd:-n}" rngd="${rngd,,}" - if [[ "${rngd}" == "y" ]]; then validpkgs+=(rng-tools) - YELLOW " - - ### 'rngd' service will be enabled - " + ack "'rngd' service will be enabled" elif [[ "${rngd}" == "n" ]]; then skip else @@ -3211,44 +1741,19 @@ Enter [y/N]: " fi ok } -################################################################################################### rtkit() { - local prompt="Rtkit Setup" - sleep 0.2 - NC " - - -${magenta}###${nc}---------------------------------------${magenta}[ ${bwhite}Rtkit Setup${nc} ${magenta}]${nc}---------------------------------------${magenta}### - " - sleep 0.2 - YELLOW " - - - ### RealtimeKit is a D-Bus system service that changes the scheduling policy - - ### of user processes/threads to SCHED_RR, [Realtime Scheduling Mode on request] - - - - > Install & enable 'rtkit' ? [y/N] " - BLUE " - - -Enter [y/N]: " + title "${prompt}" + CYAN "\n\n ### ${nc}RealtimeKit is a D-Bus system service that changes the scheduling policy\n\n${cyan} ### ${nc}of user processes/threads to SCHED_RR, [Realtime Scheduling Mode on request]" + ask "Install & enable 'rtkit' ? [y/N]" + get "Enter [y/N]" read -r -p " ==> " rtkit - - echo rtkit="${rtkit:-n}" rtkit="${rtkit,,}" - if [[ "${rtkit}" == "y" ]]; then validpkgs+=("realtime-privileges" "rtkit") - YELLOW " - - ### 'rtkit' service will be enabled - " + ack "'rtkit' service will be enabled" elif [[ "${rtkit}" == "n" ]]; then skip else @@ -3257,44 +1762,18 @@ Enter [y/N]: " fi ok } -################################################################################################### tlp() { - local prompt="Tlp Setup" - sleep 0.2 - NC " - - -${magenta}###${nc}----------------------------------------${magenta}[ ${bwhite}Tlp Setup${nc} ${magenta}]${nc}----------------------------------------${magenta}### - " - sleep 0.2 - YELLOW " - - - ### Tlp is a laptop battery power saving utility for Linux - - ### working out-of-the-box & easy to further configure - - - - > Install & enable 'tlp' ? [y/N] " - BLUE " - - -Enter [y/N]: " - read -r -p " -==> " tlp - - echo + title "${prompt}" + CYAN "\n\n ### ${nc}Tlp is a laptop battery power saving utility for Linux\n\n${cyan} ### ${nc}working out-of-the-box & easy to further configure" + ask "Install & enable 'tlp' ? [y/N]" + get "Enter [y/N]" + read -r -p "==> " tlp tlp="${tlp:-n}" tlp="${tlp,,}" - if [[ "${tlp}" == "y" ]]; then validpkgs+=(tlp) - YELLOW " - - ### 'tlp' service will be enabled - " + ack "'tlp' service will be enabled" elif [[ "${tlp}" == "n" ]]; then skip else @@ -3303,33 +1782,12 @@ Enter [y/N]: " fi ok } -################################################################################################### dsks_submn() { - - sleep 0.2 - NC " - - -${magenta}###${nc}-------------------------------------${magenta}[ ${bwhite}Disk Management${nc} ${magenta}]${nc}-------------------------------------${magenta}### - " - YELLOW " - - > Select a Submenu: " - NC " - - [1] GPT Manager - - [2] Partition Manager - - [ ] Return to Main Menu " - BLUE " - - -Enter a number: " - read -r -p " -==> " diskmenu - echo - + title "Disk Management" + ask "Select a Submenu" + NC "\n\n [1] GPT Manager\n\n [2] Partition Manager\n\n [ ] Return to Main Menu" + get "Enter a number" + read -r -p "==> " diskmenu case "${diskmenu}" in 1) until gpt_mngr; do : ; done ;; @@ -3342,36 +1800,16 @@ Enter a number: " return 1 ;; esac } -################################################################################################### gpt_mngr() { - local prompt="GPT Manager" - sleep 0.2 - NC " - - -${magenta}###${nc}---------------------------------------${magenta}[ ${bwhite}GPT Manager${nc} ${magenta}]${nc}---------------------------------------${magenta}### - " + title "${prompt}" gpt_dsk_nmbr=" " - while [[ -n "${gpt_dsk_nmbr}" ]]; do - if [[ -z "${instl_drive}" ]]; then - YELLOW " - - > Select a disk to manage its GPT: " - NC " - - -${disks}" - BLUE " - - -Enter a disk number ${bwhite}(empty to skip)${blue}: " - read -r -p " -==> " gpt_dsk_nmbr - echo - + ask "Select a disk to manage its GPT" + NC "\n\n${disks}" + get "Enter a disk number ${bwhite}(empty to skip)" + read -r -p "==> " gpt_dsk_nmbr if [[ -n "${gpt_dsk_nmbr}" ]]; then gptdrive="$(echo "${disks}" | awk "\$1 == ${gpt_dsk_nmbr} {print \$2}")" else @@ -3386,56 +1824,25 @@ Enter a disk number ${bwhite}(empty to skip)${blue}: " fi fi fi - if [[ -n "${instl_drive}" ]]; then gptdrive="${instl_drive}" fi - if [[ -e "${gptdrive}" ]]; then parttable="$(fdisk -l "${gptdrive}" 2> "${void}" | grep '^Disklabel type' | awk "{print \$3}")" - if [[ "${parttable}" == "gpt" ]]; then - sleep 0.2 - NC " - --------------------- - ### ${green}Disk GPT OK ${nc}### - ---------------------" - elif [[ "${parttable}" != "gpt" && -z "${install}" ]]; then - sleep 0.2 - RED " - ------------------------------------------ - ### ${nc}No GPT detected on selected disk ${red}### - ------------------------------------------" - fi if [[ "${run_as}" != "root" ]]; then - sleep 0.2 - RED " - - ----------------------------------- - ### ${nc}Root Privileges Missing.. ${red}### - ----------------------------------- - " + err "Root Privileges Missing.." reload until dsks_submn; do : ; done fi - - YELLOW " - - > Make a Selection: " - NC " - - [1] Create new GPT on selected disk [Destroy any existing GPT/MBR structures] - - [2] Use the 'gdisk' program interactively [Expert Mode] - - [ ] Return to Previous Menu " - BLUE " - - -Enter a number: " - read -r -p " -==> " gptslct - echo - + if [[ "${parttable}" == "gpt" ]]; then + msg "Disk GPT OK" + elif [[ "${parttable}" != "gpt" && -z "${install}" ]]; then + err "No GPT detected on selected disk" + fi + ask "Make a Selection" + NC "\n\n [1] Create new GPT on selected disk [Destroy any existing GPT/MBR structures]\n\n [2] Use the 'gdisk' program interactively [Expert Mode]\n\n [ ] Return to Previous Menu" + get "Enter a number" + read -r -p "==> " gptslct if [[ "${gptslct}" == "1" ]]; then sgdisk -Z "${gptdrive}" > "${void}" && sgdisk -o "${gptdrive}" > "${void}" && @@ -3444,11 +1851,8 @@ Enter a number: " multibooting="n" nowarning="y" gptok="yes" - sleep 0.2 - NC " - -==> [${green}GPT OK${nc}] " - + local prompt="GPT" + ok if [[ "${install}" == "yes" ]]; then until instl_dsk; do : ; done return 0 @@ -3458,34 +1862,21 @@ Enter a number: " fi else gptok="no" - sleep 0.2 - RED " - ------------------------------------------ - ### ${nc}No GPT detected on selected disk ${red}### - ------------------------------------------" + err "No GPT detected on selected disk" reload return 1 fi elif [[ "${gptslct}" == "2" ]]; then - YELLOW " - - ### Type ${nc}'?'${yellow} for help, ${nc}'x'${yellow} for extra functionality or ${nc}'q'${yellow} to quit " - NC " - - -______________________________________________ - " + ack "Type ${nc}'?'${yellow} for help, ${nc}'x'${yellow} for extra functionality or ${nc}'q'${yellow} to quit" + NC "\n_______________________________________________\n" gdisk "${gptdrive}" parttable="$(fdisk -l "${gptdrive}" 2> "${void}" | grep '^Disklabel type' | awk "{print \$3}")" if [[ "${parttable}" == "gpt" ]]; then multibooting="n" nowarning="y" gptok="yes" - sleep 0.2 - NC " - -==> [${green}GPT OK${nc}] " - + local prompt="GPT" + ok if [[ "${install}" == "yes" ]]; then until instl_dsk; do : ; done return 0 @@ -3495,13 +1886,7 @@ ______________________________________________ fi else gptok="no" - sleep 0.2 - RED " - - - ------------------------------------------ - ### ${nc}No GPT detected on selected disk ${red}### - ------------------------------------------" + err "No GPT detected on selected disk" reload return 1 fi @@ -3510,7 +1895,7 @@ ______________________________________________ gptabort="yes" skip ok - line2 + printf "\n\n" until instl_dsk; do : ; done return 0 elif [[ -z "${instl_drive}" ]]; then @@ -3527,52 +1912,20 @@ ______________________________________________ fi done } -################################################################################################### ask_multibooting() { - [[ "${multibooting}" == "n" ]] && return 0 - local prompt="MultiBoot Status" - sleep 0.2 - NC " - -${magenta}###${nc}------------------------------------${magenta}[ ${bwhite}MultiBoot Status${nc} ${magenta}]${nc}------------------------------------${magenta}### - " - YELLOW " - - - > Are you Dual/Multi-Booting with other OS's ? [y/n] " - YELLOW " - - - ### If ${bwhite}[y]${nc}es ${yellow}then:${cyan} - - - >> ${nc}Your ${yellowl}EFI ${nc}System Partition (ESP) will stay ${yellowl}intact${nc}${cyan} - - >> ${nc}Only ${yellowl}Manual ${nc}Disk Partitioning will be available for ${yellowl}Disk Management - " - BLUE " - - -Enter [y/n]: " - read -r -p " -==> " multibooting - + title "${prompt}" + ask "Are you ${nc}Dual${yellow}/${nc}Multi-Booting ${yellow}with other OS's ? [y/n]" + CYAN "\n\n * ${nc}If ${yellowl}[y]${nc}es, then:${cyan}\n\n >> ${nc}Your ${yellowl}EFI ${nc}System Partition (ESP) will stay ${yellowl}intact${nc}${cyan}\n\n >> ${nc}Only ${yellowl}Manual ${nc}Disk Partitioning will be available for ${yellowl}Disk Management" + get "Enter [y/n]" + read -r -p "==> " multibooting multibooting="${multibooting,,}" - case "${multibooting}" in y) - sleep 0.2 - YELLOW " - - ### Dual/Multi-Boot selected - " ;; - n) sleep 0.2 - YELLOW " - - ### No Dual/Multi-Boot - " ;; + ack "Dual/Multi-Boot selected" ;; + n) + ack "No Dual/Multi-Boot" ;; "") y_n return 1 ;; @@ -3582,46 +1935,23 @@ Enter [y/n]: " esac ok } -################################################################################################### part_mngr() { - - if [[ "${multibooting}" == "y" ]]; then - until manual_part; do : ; done - return 0 - fi - - sleep 0.2 - NC " - - -${magenta}###${nc}------------------------------------${magenta}[ ${bwhite}Partition Manager${nc} ${magenta}]${nc}------------------------------------${magenta}### - " - YELLOW " - - > Select a Mode: " - NC " - - [1] Automatic Partitioning - - [2] Manual Partitioning " - BLUE " - - -Enter a number: " - read -r -p " -==> " part_mode - + if [[ "${multibooting}" == "y" ]]; then + until manual_part; do : ; done + return 0 + fi + title "Partition Manager" + ask "Select a Mode" + NC "\n\n [1] Automatic Partitioning\n\n [2] Manual Partitioning" + get "Enter a number" + read -r -p "==> " part_mode case "${part_mode}" in 1) until auto_part; do : ; done ;; 2) until manual_part; do : ; done ;; "") - sleep 0.2 - RED " - ------------------------------ - ### ${nc}Please select a Mode ${red}### - ------------------------------" + err "Please select a Mode" reload return 1 ;; *) @@ -3629,62 +1959,35 @@ Enter a number: " return 1 ;; esac } -################################################################################################### auto_part() { - - sleep 0.2 - NC " - - -${magenta}###${nc}---------------------------------${magenta}[ ${bwhite}Automatic Partitioning${nc} ${magenta}]${nc}---------------------------------${magenta}### - " + title "Automatic Partitioning" if [[ -e "${instl_drive}" ]]; then if [[ -z "${nowarning}" ]]; then - sleep 0.2 - line2 - REDBG " ------------------------------------------------------------ " - REDBG " [!] WARNING: All data on selected disk will be destroyed [!] " - REDBG " ------------------------------------------------------------ " - line2 + delete + fi + if [[ "${run_as}" != "root" ]]; then + err "Root Privileges Missing.." + reload + until main_menu; do : ; done + return 0 fi sgdsk_nmbr="${instl_dsk_nmbr}" sgdrive="$(echo "${disks}" | awk "\$1 == ${sgdsk_nmbr} {print \$2}")" capacity="$(fdisk -l "${sgdrive}" | grep -E 'bytes' | grep -E 'Disk' | awk "{print \$5}")" cap_gib="$((capacity/1024000000))" rootsize="$((capacity*25/100/1024000000))" - if [[ "${run_as}" != "root" ]]; then - sleep 0.2 - RED " - ----------------------------------- - ### ${nc}Root Privileges Missing.. ${red}### - ----------------------------------- - " - reload - until main_menu; do : ; done - return 0 - fi - sleep 0.2 - CYAN " - - >> ${nc}Apply ${yellowl}'Smart Partitioning' ${nc}on disk ${bwhite}'${instl_drive}'${nc} ? ${cyan}[Y/n] " - BLUE " - - -Enter [Y/n]: " - read -r -p " -==> " smartpart - - echo + inf "${nc}Apply ${yellowl}'Smart Partitioning' ${nc}on disk ${bwhite}'${instl_drive}'${nc} ? ${cyan}[Y/n]" + get "Enter [Y/n]" + read -r -p "==> " smartpart smartpart="${smartpart:-y}" smartpart="${smartpart,,}" - if [[ "${smartpart}" == "y" ]]; then until smart_presets; do : ; done until set_partsize; do : ; done until partitioner; do : ; done return 0 elif [[ "${smartpart}" == "n" ]]; then - alternatives + inf "Providing ${yellowl}alternatives${nc}.." until manual_presets; do : ; done until set_partsize; do : ; done until partitioner; do : ; done @@ -3694,37 +1997,22 @@ Enter [Y/n]: " return 1 fi else - YELLOW " - > Select a disk for Auto-Partitioning: " - NC " - - -${disks}" - BLUE " - - -Enter a disk number ${bwhite}(empty to skip)${blue}: " - read -r -p " -==> " sgdsk_nmbr - echo - + ask "Select a disk for Auto-Partitioning" + NC "\n\n${disks}" + get "Enter a disk number ${bwhite}(empty to skip)" + read -r -p "==> " sgdsk_nmbr if [[ -n "${sgdsk_nmbr}" ]]; then + if [[ "${run_as}" != "root" ]]; then + err "Root Privileges Missing.." + reload + until dsks_submn; do : ; done + return 0 + fi sgdrive="$(echo "${disks}" | awk "\$1 == ${sgdsk_nmbr} {print \$2}")" if [[ -e "${sgdrive}" ]]; then capacity="$(fdisk -l "${sgdrive}" | grep -E 'bytes' | grep -E 'Disk' | awk "{print \$5}")" cap_gib="$((capacity/1024000000))" rootsize="$((capacity*25/100/1024000000))" - if [[ "${run_as}" != "root" ]]; then - sleep 0.2 - RED " - ----------------------------------- - ### ${nc}Root Privileges Missing.. ${red}### - ----------------------------------- - " - reload - until dsks_submn; do : ; done - return 0 - fi until manual_presets; do : ; done until set_partsize; do : ; done until partitioner; do : ; done @@ -3738,15 +2026,12 @@ Enter a disk number ${bwhite}(empty to skip)${blue}: " ok fi fi - if [[ -z "${sanity}" ]]; then until dsks_submn; do : ; done return 0 fi } -################################################################################################### smart_presets() { - if [[ "${fs}" == "1" ]] ; then if [[ "${sep_home}" == "y" && "${swapmode}" == "1" ]]; then preset="4" @@ -3765,54 +2050,22 @@ smart_presets() { fi fi } -################################################################################################### manual_presets() { - preset="" - sleep 0.2 - NC " - -${magenta}###${nc}------------------------------------${magenta}[ ${bwhite}Preset Selection${nc} ${magenta}]${nc}------------------------------------${magenta}### - " + title "Preset Selection" if [[ -z "${nowarning}" ]]; then - sleep 0.2 - line2 - REDBG " ------------------------------------------------------------ " - REDBG " [!] WARNING: All data on selected disk will be destroyed [!] " - REDBG " ------------------------------------------------------------ " - line2 + delete fi - YELLOW " - - > Select a Partition Layout Preset: " - NC " - - ${cyan}* Ext4${nc} compatible Layout - - ${magenta}* Btrfs${nc} compatible Layout - - - - [1] Create ESP & /Root (${cyan}Ext4${nc},${magenta}Btrfs${nc}) - - [2] Create ESP, /Root & /Swap (${cyan}Ext4${nc},${magenta}Btrfs${nc}) - - [3] Create ESP, /Root & /Home (${cyan}Ext4${nc}) - - [4] Create ESP, /Root, /Home & /Swap (${cyan}Ext4${nc}) " - BLUE " - - -Enter a Preset number ${bwhite}(empty to skip)${blue}: " - read -r -p " -==> " preset - echo - + ask "Select a Partition Layout Preset" + NC "\n\n ${cyan}* Ext4${nc} compatible layout\n\n ${magenta}* Btrfs${nc} compatible layout" + NC "\n\n [1] Create ESP & /Root (${cyan}Ext4${nc},${magenta}Btrfs${nc})\n\n [2] Create ESP, /Root & /Swap (${cyan}Ext4${nc},${magenta}Btrfs${nc})\n\n [3] Create ESP, /Root & /Home (${cyan}Ext4${nc})\n\n [4] Create ESP, /Root, /Home & /Swap (${cyan}Ext4${nc})" + get "Enter a Preset number ${bwhite}(empty to skip)" + read -r -p "==> " preset if [[ "${preset}" =~ ^(1|2|3|4)$ ]]; then presetpart="y" return 0 elif [[ -z "${preset}" && "${partok}" == "n" ]]; then - alternatives + inf "Providing ${yellowl}alternatives${nc}.." manual_part return 0 elif [[ -z "${preset}" ]]; then @@ -3823,60 +2076,25 @@ Enter a Preset number ${bwhite}(empty to skip)${blue}: " return 1 fi } -################################################################################################### set_partsize() { - [[ "${partok}" == "y" ]] && return 0 - if [[ "${preset}" =~ ^(3|4)$ ]]; then sleep 0.2 - YELLOW " - - - ### Total detected capacity of disk ${nc}${sgdrive} ${yellow}is ${nc}${cap_gib} GiB${yellow} - - - ### ${nc}Default ${yellow}Root partition's size is set to aprox. ${nc}25%${yellow} of total disk capacity - - ### Root partition's ${nc}current ${yellow}size will be ${nc}[${rootsize} GiB]${yellow} - - - > Adjust Root Partition's size (by setting a custom ${nc}% ${yellow}value) ? " - BLUE " - - -Enter ${nc}% ${blue}value ${nc}eg. 40 ${bwhite}(empty to skip)${blue}: " - read -r -p " -==> " prcnt - echo - + CYAN "\n\n\n ### ${nc}Total detected capacity of disk ${yellowl}${sgdrive} ${nc}is ${bwhite}${cap_gib} ${nc}GiB${cyan}\n\n\n ### ${bwhite}Default ${nc}Root partition's size is set to aprox. ${yellowl}25%${nc} of total disk capacity${cyan}\n\n ### ${nc}Root partition's ${bwhite}current ${nc}size will be ${yellowl}[${rootsize} GiB]${nc}" + ask "Adjust Root Partition's size (by setting a custom ${nc}% ${yellow}value) ?" + get "Enter ${nc}% ${blue}value ${nc}eg. 40 ${bwhite}(empty to skip)" + read -r -p "==> " prcnt if [[ "${prcnt}" =~ [[:alpha:]] ]]; then - sleep 0.2 - RED " - ------------------------------------------- - ### ${nc}Please use only digits as a value ${red}### - -------------------------------------------" + err "Please use only digits as a value" reload return 1 elif [[ -z "${prcnt}" ]]; then - sleep 0.2 - YELLOW " - - ### Default Root Partition's size selected ${nc}[${rootsize} GiB] - " + ack "Default Root Partition's size selected ${nc}[${rootsize} GiB]" elif [[ "${prcnt}" -gt "0" && "${prcnt}" -lt "100" ]]; then rootsize="$((capacity*"${prcnt}"/100/1024000000))" - sleep 0.2 - YELLOW " - - ### Custom Root Partition's size selected ${nc}[${rootsize} GiB] - " + ack "Custom Root Partition's size selected ${nc}[${rootsize} GiB]" elif [[ "${prcnt}" == "100" ]]; then - sleep 0.2 - RED " - ----------------------------------------------------- - ### ${yellow}WARNING: ${nc}No space left for other partitions ${red}### - -----------------------------------------------------" + err "${yellow}WARNING: ${nc}No space left for other partitions.." reload return 1 else @@ -3885,26 +2103,21 @@ Enter ${nc}% ${blue}value ${nc}eg. 40 ${bwhite}(empty to skip)${blue}: " fi fi } -################################################################################################### partitioner() { - [[ "${partok}" == "y" ]] && return 0 - if [[ -z "${preset}" && "${install}" == "yes" ]]; then until sanity_check; do : ; done - return 0 + return 0 elif [[ -z "${preset}" ]]; then local prompt="Partition Manager" ok return 0 fi - if [[ "${smartpart}" == "y" ]]; then local prompt="Disk ${sgdrive} Smart-Partitioned" elif [[ "${presetpart}" == "y" ]]; then local prompt="Disk ${sgdrive} Preset-Partitioned" fi - local stage_prompt="Partitioning Drive" wipefs -afq "${sgdrive}" > "${void}" 2> "${log}" || stage_fail if [[ "${gptok}" != "yes" ]]; then @@ -3912,7 +2125,6 @@ partitioner() { sgdisk -o "${sgdrive}" > "${void}" 2> "${log}" || stage_fail gptok="yes" fi - if [[ "${preset}" == "1" ]]; then sgdisk -I -n1:0:+1024M -t1:ef00 -c1:ESP "${sgdrive}" > "${void}" 2> "${log}" || stage_fail sgdisk -I -n2:0:0 -t2:8304 -c2:ROOT "${sgdrive}" > "${void}" 2> "${log}" || stage_fail @@ -3942,58 +2154,28 @@ partitioner() { ok fi } -################################################################################################### manual_part() { - - sleep 0.2 - NC " - - -${magenta}###${nc}-----------------------------------${magenta}[ ${bwhite}Manual Partitioning${nc} ${magenta}]${nc}-----------------------------------${magenta}### - " + title "Manual Partitioning" cgdsk_nmbr=" " while [[ -n "${cgdsk_nmbr}" ]]; do - line2 + printf "\n\n" NC " Supported Partition Types & Mountpoints: " - line3 - RED " Linux Root x86-64 Partition ${nc} [ GUID Code: 8304 ] ${red}Mountpoint: ${nc}/ " - echo - BLUE " EFI System Partition ${nc} [ GUID Code: ef00 ] ${blue}Mountpoint: ${nc}/efi or /boot " - echo - GREEN " Linux Home Partition ${nc} [ GUID Code: 8302 ] ${green}Mountpoint: ${nc}/home " - echo - YELLOW " Linux Swap Partition ${nc} [ GUID Code: 8200 ] ${yellow}Mountpoint: ${nc}/swap " - echo - MAGENTA " Linux Extended Boot Partition ${nc} [ GUID Code: ea00 ] ${magenta}Mountpoint: ${nc}/boot " - YELLOW " - - - - > Select a disk to Manage: " - NC " - - -${disks}" - BLUE " - - -Enter a disk number ${bwhite}(empty to skip)${blue}: " - read -r -p " -==> " cgdsk_nmbr - + printf "\n\n\n" + RED " Linux Root x86-64 Partition ${nc} [ GUID Code: 8304 ] ${red}Mountpoint: ${nc}/\n" + BLUE " EFI System Partition ${nc} [ GUID Code: ef00 ] ${blue}Mountpoint: ${nc}/efi or /boot\n" + GREEN " Linux Home Partition ${nc} [ GUID Code: 8302 ] ${green}Mountpoint: ${nc}/home\n" + YELLOW " Linux Swap Partition ${nc} [ GUID Code: 8200 ] ${yellow}Mountpoint: ${nc}/swap\n" + MAGENTA " Linux Extended Boot Partition ${nc} [ GUID Code: ea00 ] ${magenta}Mountpoint: ${nc}/boot\n" + ask "Select a disk to Manage" + NC "\n\n${disks}" + get "Enter a disk number ${bwhite}(empty to skip)" + read -r -p "==> " cgdsk_nmbr if [[ -n "${cgdsk_nmbr}" ]]; then cgdrive="$(echo "${disks}" | awk "\$1 == ${cgdsk_nmbr} {print \$2}")" if [[ -e "${cgdrive}" ]]; then local prompt="Disk ${cgdrive}" if [[ "${run_as}" != "root" ]]; then - sleep 0.2 - RED " - - - ----------------------------------- - ### ${nc}Root Privileges Missing.. ${red}### - ----------------------------------- - " + err "Root Privileges Missing.." reload until dsks_submn; do : ; done fi @@ -4009,7 +2191,6 @@ Enter a disk number ${bwhite}(empty to skip)${blue}: " skip local prompt="Partition Manager" ok - if [[ -z "${sanity}" ]]; then until dsks_submn; do : ; done return 0 @@ -4020,41 +2201,19 @@ Enter a disk number ${bwhite}(empty to skip)${blue}: " fi done } -################################################################################################### instl_dsk() { - if [[ ! -e "${instl_drive}" ]]; then - sleep 0.2 - NC " - - -${magenta}###${nc}-------------------------------${magenta}[ ${bwhite}Installation Disk Selection${nc} ${magenta}]${nc}-------------------------------${magenta}### - " - YELLOW " - - > Select a disk to Install to: " - NC " - -${disks}" - BLUE " - - -Enter a disk number: " - read -r -p " -==> " instl_dsk_nmbr - echo + title "Installation Disk Selection" + ask "Select a disk to Install to" + NC "\n\n${disks}" + get "Enter a disk number" + read -r -p "==> " instl_dsk_nmbr fi - if [[ -n "${instl_dsk_nmbr}" ]]; then instl_drive="$(echo "${disks}" | awk "\$1 == ${instl_dsk_nmbr} {print \$2}")" if [[ -e "${instl_drive}" ]]; then if [[ "${run_as}" != "root" ]]; then - sleep 0.2 - RED " - ----------------------------------- - ### ${nc}Root Privileges Missing.. ${red}### - ----------------------------------- - " + err "Root Privileges Missing.." reload until main_menu; do : ; done return 0 @@ -4069,25 +2228,16 @@ Enter a disk number: " fi parttable="$(fdisk -l "${instl_drive}" | grep '^Disklabel type' | awk "{print \$3}")" if [[ "${parttable}" != "gpt" && -n "${gptabort}" ]]; then - sleep 0.2 - RED " - --------------------------------------- - ### ${nc}Please create GPT to continue ${red}### - ---------------------------------------" + err "Please create GPT to continue" reload until gpt_mngr; do : ; done return 0 elif [[ "${parttable}" != "gpt" ]]; then - sleep 0.2 - RED " - ------------------------------------------ - ### ${nc}No GPT detected on selected disk ${red}### - ------------------------------------------" + err "No GPT detected on selected disk" reload until gpt_mngr; do : ; done return 0 fi - if [[ -z "${multibooting}" ]]; then until ask_multibooting; do : ; done fi @@ -4098,18 +2248,12 @@ Enter a disk number: " return 1 fi else - sleep 0.2 - RED " - ----------------------------------------- - ### ${nc}Please select ${yellow}Installation ${nc}Disk ${red}### - -----------------------------------------" + err "Please select Installation Disk" reload return 1 fi } -################################################################################################### sanity_check() { - rootcount="$(fdisk -l "${instl_drive}" | grep -E -c 'root' | awk "{print \$1}")" root_dev="$(fdisk -l "${instl_drive}" | grep -E 'root' | awk "{print \$1}")" multi_root="$(fdisk -l "${instl_drive}" | grep -E 'root' | awk "{print \$1}" | cat --number)" @@ -4135,52 +2279,23 @@ sanity_check() { xbootprt="" homeprt="" swapprt="" - sleep 0.2 - NC " - -${magenta}###${nc}--------------------------------------${magenta}[ ${bwhite}Sanity Check${nc} ${magenta}]${nc}--------------------------------------${magenta}### - " + title "Sanity Check" [[ "${rootcount}" == "1" || "${espcount}" == "1" || "${xbootcount}" == "1" || "${homecount}" == "1" || "${swapcount}" == "1" ]] && echo - + # ATTENTION: MULTI-ROOT if [[ "${rootcount}" -gt "1" ]]; then - local stage_prompt="Selecting Partition" - sleep 0.2 - CYAN " - >> ${nc}Multiple ${greenl}Linux x86-64 /Root ${nc}Partitions have been detected - " - sleep 0.2 - CYAN " -###${nc}------------------------------------------------${cyan}[ ${bwhite}DISK OVERVIEW ${nc}${cyan}]${nc}------------------------------------------------${cyan}### - - " - fdisk -l "${instl_drive}" | grep -E --color=no 'Dev|dev' |GREP_COLORS='mt=01;36' grep -E --color=always 'EFI System|$'|GREP_COLORS='mt=01;32' grep -E --color=always 'Linux root|$'|GREP_COLORS='mt=01;35' grep -E --color=always 'Linux home|$'|GREP_COLORS='mt=01;33' grep -E --color=always 'Linux swap|$'|GREP_COLORS='mt=01;31' grep -E --color=always 'Linux extended boot|$' - CYAN " - -###${nc}-----------------------------------------------------------------------------------------------------------------${cyan}### " - NC " - ${greenl}Linux x86-64 /Root Partitions:${nc} - - ------------------------------ -${multi_root} - ------------------------------ - " - YELLOW " - - ### Only the ${nc}1st Linux x86-64 /Root ${yellow}partition on a selected disk can be ${nc}auto-assigned ${yellow}as a valid /Root partition${cyan} - - - >> ${nc}Partition ${yellowl}${root_comply} ${nc}is auto-assigned as such and will be ${red}[!] ${nc}FORMATTED ${red}[!] - " - BLUE " - - - > Proceed ? [Y/n]" - read -r -p " -==> " autoroot - + local color="${greenl}" + local type="Linux x86-64 /Root" + local multi_type="${multi_root}" + local type_comply="${root_comply}" + local length="${#root_dev}" + dashes="$(printf '%*s' "$length" '' | tr ' ' '-')" + local dashline="${nc}${dashes}" + action="${red}[!] ${bwhite}FORMATTED ${nc}${red}[!]" + multi_info + get "Proceed ? [Y/n]" + read -r -p "==> " autoroot autoroot="${autoroot:-y}" autoroot="${autoroot,,}" - if [[ "${autoroot}" == "y" ]]; then root_dev="${root_comply}" multiroot_bootopts="root=PARTUUID=$(blkid -s PARTUUID -o value "${root_dev}")" @@ -4192,52 +2307,25 @@ ${multi_root} return 1 fi fi -#------------------------------------------------------------------------------------------------------------------------------------------------------------------- + # ATTENTION: MULTI-ESP if [[ "${espcount}" -gt "1" ]]; then - local stage_prompt="Selecting Partition" - sleep 0.2 - CYAN " - >> ${nc}Multiple ${cyanl}EFI System ${nc}Partitions have been detected - " - sleep 0.2 - CYAN " -###${nc}------------------------------------------------${cyan}[ ${bwhite}DISK OVERVIEW ${nc}${cyan}]${nc}------------------------------------------------${cyan}### - - " - fdisk -l "${instl_drive}" | grep -E --color=no 'Dev|dev' |GREP_COLORS='mt=01;36' grep -E --color=always 'EFI System|$'|GREP_COLORS='mt=01;32' grep -E --color=always 'Linux root|$'|GREP_COLORS='mt=01;35' grep -E --color=always 'Linux home|$'|GREP_COLORS='mt=01;33' grep -E --color=always 'Linux swap|$'|GREP_COLORS='mt=01;31' grep -E --color=always 'Linux extended boot|$' - CYAN " - -###${nc}-----------------------------------------------------------------------------------------------------------------${cyan}### " - NC " - ${cyanl}Linux EFI System Partitions:${nc} - - ---------------------------- -${multi_esp} - ---------------------------- - " - YELLOW " - - ### Only the ${nc}1st EFI partition${yellow} on a selected disk can be ${nc}auto-assigned ${yellow}as a valid EFI partition - " if [[ "${multibooting}" == "n" ]]; then - CYAN " - >> ${nc}Partition ${yellowl}${esp_comply} ${nc}is auto-assigned as such and will be ${red}[!] ${nc}FORMATTED ${red}[!] - " + action="${red}[!] ${bwhite}FORMATTED ${nc}${red}[!]" elif [[ "${multibooting}" == "y" ]]; then - CYAN " - >> ${nc}Partition ${yellowl}${esp_comply} ${nc}is auto-assigned as such and will be used in the installation - " + action="used in the installation" fi - BLUE " - - - > Proceed ? [Y/n]" - read -r -p " -==> " autoesp - + local color="${cyanl}" + local type="EFI System" + local multi_type="${multi_esp}" + local type_comply="${esp_comply}" + local length="${#esp_dev}" + dashes="$(printf '%*s' "$length" '' | tr ' ' '-')" + local dashline="${nc}${dashes}" + multi_info + get "Proceed ? [Y/n]" + read -r -p "==> " autoesp autoesp="${autoesp:-y}" autoesp="${autoesp,,}" - if [[ "${autoesp}" == "y" ]]; then esp_dev="${esp_comply}" elif [[ "${autoesp}" == "n" ]]; then @@ -4248,46 +2336,21 @@ ${multi_esp} return 1 fi fi -#------------------------------------------------------------------------------------------------------------------------------------------------------------------- + # ATTENTION: MULTI-XBOOTLDR if [[ "${xbootcount}" -gt "1" ]]; then - local stage_prompt="Selecting Partition" - sleep 0.2 - CYAN " - >> ${nc}Multiple ${redl}Linux Extended Boot ${nc}Partitions have been detected - " - sleep 0.2 - CYAN " -###${nc}------------------------------------------------${cyan}[ ${bwhite}DISK OVERVIEW ${nc}${cyan}]${nc}------------------------------------------------${cyan}### - - " - fdisk -l "${instl_drive}" | grep -E --color=no 'Dev|dev' |GREP_COLORS='mt=01;36' grep -E --color=always 'EFI System|$'|GREP_COLORS='mt=01;32' grep -E --color=always 'Linux root|$'|GREP_COLORS='mt=01;35' grep -E --color=always 'Linux home|$'|GREP_COLORS='mt=01;33' grep -E --color=always 'Linux swap|$'|GREP_COLORS='mt=01;31' grep -E --color=always 'Linux extended boot|$' - CYAN " - -###${nc}-----------------------------------------------------------------------------------------------------------------${cyan}### " - NC " - ${redl}Linux Extended Boot Partitions:${nc} - - ---------------------------- -${multi_xboot} - ---------------------------- - " - YELLOW " - - ### Only the ${nc}1st Linux Extended Boot ${yellow}partition on a selected disk can be ${nc}auto-assigned ${yellow}as a valid /XBOOTLDR partition${cyan} - - - >> ${nc}Partition ${yellowl}${xboot_comply} ${nc}is auto-assigned as such and will be ${red}[!] ${nc}FORMATTED ${red}[!] - " - BLUE " - - - > Proceed ? [Y/n]" - read -r -p " -==> " autoxboot - + local color="${redl}" + local type="Linux Extended Boot" + local multi_type="${multi_xboot}" + local type_comply="${xboot_comply}" + local length="${#xboot_dev}" + dashes="$(printf '%*s' "$length" '' | tr ' ' '-')" + local dashline="${nc}${dashes}" + action="${red}[!] ${bwhite}FORMATTED ${nc}${red}[!]" + multi_info + get "Proceed ? [Y/n]" + read -r -p "==> " autoxboot autoxboot="${autoxboot:-y}" autoxboot="${autoxboot,,}" - if [[ "${autoxboot}" == "y" ]]; then xboot_dev="${xboot_comply}" elif [[ "${autoxboot}" == "n" ]]; then @@ -4298,46 +2361,21 @@ ${multi_xboot} return 1 fi fi -#------------------------------------------------------------------------------------------------------------------------------------------------------------------- + # ATTENTION: MULTI-HOME if [[ "${fs}" == "1" && "${sep_home}" == "y" && "${homecount}" -gt "1" ]]; then - local stage_prompt="Selecting Partition" - sleep 0.2 - CYAN " - >> ${nc}Multiple ${magental}Linux /Home ${nc}Partitions have been detected - " - sleep 0.2 - CYAN " -###${nc}------------------------------------------------${cyan}[ ${bwhite}DISK OVERVIEW ${nc}${cyan}]${nc}------------------------------------------------${cyan}### - - " - fdisk -l "${instl_drive}" | grep -E --color=no 'Dev|dev' |GREP_COLORS='mt=01;36' grep -E --color=always 'EFI System|$'|GREP_COLORS='mt=01;32' grep -E --color=always 'Linux root|$'|GREP_COLORS='mt=01;35' grep -E --color=always 'Linux home|$'|GREP_COLORS='mt=01;33' grep -E --color=always 'Linux swap|$'|GREP_COLORS='mt=01;31' grep -E --color=always 'Linux extended boot|$' - CYAN " - -###${nc}-----------------------------------------------------------------------------------------------------------------${cyan}### " - NC " - ${magental}Linux /Home Partitions:${nc} - - ----------------------- -${multi_home} - ----------------------- - " - YELLOW " - - ### Only the ${nc}1st Linux /Home ${yellow}partition on a selected disk can be ${nc}auto-assigned ${yellow}as a valid /Home partition${cyan} - - - >> ${nc}Partition ${yellowl}${home_comply} ${nc}is auto-assigned as such and will be used in the installation - " - BLUE " - - - > Proceed ? [Y/n]" - read -r -p " -==> " autohome - + local color="${magental}" + local type="Linux /Home" + local multi_type="${multi_home}" + local type_comply="${home_comply}" + local length="${#home_dev}" + dashes="$(printf '%*s' "$length" '' | tr ' ' '-')" + local dashline="${nc}${dashes}" + action="used in the installation" + multi_info + get "Proceed ? [Y/n]" + read -r -p "==> " autohome autohome="${autohome:-y}" autohome="${autohome,,}" - if [[ "${autohome}" == "y" ]]; then home_dev="${home_comply}" elif [[ "${autohome}" == "n" ]]; then @@ -4348,46 +2386,21 @@ ${multi_home} return 1 fi fi -#------------------------------------------------------------------------------------------------------------------------------------------------------------------- + # ATTENTION: MULTI-SWAP if [[ "${swapmode}" == "1" && "${swapcount}" -gt "1" ]]; then - local stage_prompt="Selecting Partition" - sleep 0.2 - CYAN " - >> ${nc}Multiple ${yellowl}Linux /Swap ${nc}Partitions have been detected - " - sleep 0.2 - CYAN " -###${nc}------------------------------------------------${cyan}[ ${bwhite}DISK OVERVIEW ${nc}${cyan}]${nc}------------------------------------------------${cyan}### - - " - fdisk -l "${instl_drive}" | grep -E --color=no 'Dev|dev' |GREP_COLORS='mt=01;36' grep -E --color=always 'EFI System|$'|GREP_COLORS='mt=01;32' grep -E --color=always 'Linux root|$'|GREP_COLORS='mt=01;35' grep -E --color=always 'Linux home|$'|GREP_COLORS='mt=01;33' grep -E --color=always 'Linux swap|$'|GREP_COLORS='mt=01;31' grep -E --color=always 'Linux extended boot|$' - CYAN " - -###${nc}-----------------------------------------------------------------------------------------------------------------${cyan}### " - NC " - ${yellowl}Linux /Swap Partitions:${nc} - - ----------------------- -${multi_swap} - ----------------------- - " - YELLOW " - - ### Only the ${nc}1st Linux /Swap ${yellow}partition on a selected disk can be ${nc}auto-assigned ${yellow}as a valid /Swap partition${cyan} - - - >> ${nc}Partition ${yellowl}${swap_comply} ${nc}is auto-assigned as such and will be ${red}[!] ${nc}FORMATTED ${red}[!] - " - BLUE " - - - > Proceed ? [Y/n]" - read -r -p " -==> " autoswap - + local color="${yellowl}" + local type="Linux /Swap" + local multi_type="${multi_swap}" + local type_comply="${swap_comply}" + local length="${#swap_dev}" + dashes="$(printf '%*s' "$length" '' | tr ' ' '-')" + local dashline="${nc}${dashes}" + action="${red}[!] ${bwhite}FORMATTED ${nc}${red}[!]" + multi_info + get "Proceed ? [Y/n]" + read -r -p "==> " autoswap autoswap="${autoswap:-y}" autoswap="${autoswap,,}" - if [[ "${autoswap}" == "y" ]]; then swap_dev="${swap_comply}" elif [[ "${autoswap}" == "n" ]]; then @@ -4398,7 +2411,7 @@ ${multi_swap} return 1 fi fi -#------------------------------------------------------------------------------------------------------------------------------------------------------------------- + # ATTENTION: ROOT if [[ -e "${root_dev}" ]]; then rootpartsize="$(lsblk -dno SIZE --bytes "${root_dev}")" if [[ "${rootpartsize}" -ge "8589934592" ]]; then @@ -4406,51 +2419,41 @@ ${multi_swap} else rootprt="ok" sleep 0.2 - CYAN " - >> ${yellowl}WARNING: ${nc}/Root's size might not be adequate " #ATTENTION + CYAN "\n >> ${yellowl}WARNING: ${nc}/Root's size might not be adequate" sleep 0.2 - CYAN " - >> ${nc}Depending on the ${yellowl}size ${nc}of your setup, installation might ${yellowl}fail - " #ATTENTION + CYAN "\n + >> ${nc}Depending on the ${yellowl}size ${nc}of your setup, installation might ${yellowl}fail\n" keypress fi if [[ "${autoroot}" == "y" ]]; then if [[ "${presetpart}" == "y" || "${smartpart}" == "y" ]]; then rootprt="ok" sleep 0.2 - GREEN " - >> ${nc}Linux x86-64 /Root partition ${green}OK " #ATTENTION + GREEN "\n >> ${nc}Linux x86-64 /Root partition ${green}OK" else rootprt="ok" sleep 0.2 - GREEN " - >> ${yellowl}Confirmed ${nc}Linux x86-64 /Root partition ${green}OK " #ATTENTION + GREEN "\n >> ${yellowl}Confirmed ${nc}Linux x86-64 /Root partition ${green}OK" fi else sleep 0.2 rootprt="ok" - GREEN " - >> ${nc}Linux x86-64 /Root partition ${green}OK " #ATTENTION + GREEN "\n >> ${nc}Linux x86-64 /Root partition ${green}OK" fi else rootprt="fail" sleep 0.2 - RED " - >> ${yellowl}Linux x86-64 /Root ${nc}partition not detected " #ATTENTION + RED "\n >> ${yellowl}Linux x86-64 /Root ${nc}partition not detected" fi -#.................................................................................................. - + # ATTENTION: ESP if [[ ! -e "${esp_dev}" ]]; then espprt="fail" sleep 0.2 - RED " - >> ${yellowl}/EFI System ${nc}partition not detected " #ATTENTION + RED "\n >> ${yellowl}/EFI System ${nc}partition not detected" fi - if [[ -e "${esp_dev}" ]]; then espsize="$(lsblk -dno SIZE --bytes "${esp_dev}")" fi - if [[ -e "${esp_dev}" && "${espsize}" -ge "209715200" ]]; then espprt="ok" xbootloader="no" @@ -4458,22 +2461,18 @@ ${multi_swap} if [[ "${presetpart}" == "y" || "${smartpart}" == "y" ]]; then espprt="ok" sleep 0.2 - GREEN " - >> ${nc}/EFI System partition ${green}OK " #ATTENTION + GREEN "\n >> ${nc}/EFI System partition ${green}OK" else espprt="ok" sleep 0.2 - GREEN " - >> ${yellowl}Confirmed ${nc}/EFI System partition ${green}OK " #ATTENTION + GREEN "\n >> ${yellowl}Confirmed ${nc}/EFI System partition ${green}OK" fi else espprt="ok" sleep 0.2 - GREEN " - >> ${nc}/EFI System partition ${green}OK " #ATTENTION + GREEN "\n >> ${nc}/EFI System partition ${green}OK" fi fi - if [[ -e "${esp_dev}" && "${espsize}" -lt "209715200" ]]; then if [[ "${bootloader}" == "1" ]]; then if [[ "${multibooting}" == "y" ]]; then @@ -4485,81 +2484,68 @@ ${multi_swap} if [[ "${presetpart}" == "y" || "${smartpart}" == "y" ]]; then espprt="ok" sleep 0.2 - GREEN " - >> ${nc}/EFI System partition ${green}OK " #ATTENTION + GREEN "\n >> ${nc}/EFI System partition ${green}OK" else espprt="ok" sleep 0.2 - GREEN " - >> ${yellowl}Confirmed ${nc}/EFI System partition ${green}OK " #ATTENTION + GREEN "\n >> ${yellowl}Confirmed ${nc}/EFI System partition ${green}OK" fi else espprt="ok" sleep 0.2 - GREEN " - >> ${nc}/EFI System partition ${green}OK " #ATTENTION + GREEN "\n >> ${nc}/EFI System partition ${green}OK" fi if [[ "${autoxboot}" == "y" ]]; then if [[ "${presetpart}" == "y" || "${smartpart}" == "y" ]]; then sleep 0.2 - GREEN " - >> ${nc}Linux /Extended Boot partition ${green}OK " #ATTENTION + GREEN "\n >> ${nc}Linux /Extended Boot partition ${green}OK" else sleep 0.2 - GREEN " - >> ${yellowl}Confirmed ${nc}Linux /Extended Boot partition ${green}OK " #ATTENTION + GREEN "\n >> ${yellowl}Confirmed ${nc}Linux /Extended Boot partition ${green}OK" fi else sleep 0.2 - GREEN " - >> ${nc}Linux /Extended Boot partition ${green}OK " #ATTENTION + GREEN "\n >> ${nc}Linux /Extended Boot partition ${green}OK" fi else xbootprt="fail" espprt="fail" sleep 0.2 - CYAN " - >> ${yellowl}WARNING: ${nc}ESP's size is not ${bwhite}adequate " #ATTENTION + CYAN "\n >> ${yellowl}WARNING: ${nc}ESP's size is not ${bwhite}adequate" sleep 0.2 - RED " - >> ${yellowl}Linux /Extended Boot ${nc}partition not detected " #ATTENTION + RED "\n >> ${yellowl}Linux /Extended Boot ${nc}partition not detected" fi elif [[ "${multibooting}" == "n" ]]; then espprt="fail" xbootloader="no" sleep 0.2 - CYAN " - >> ${yellowl}WARNING: ${nc}ESP's size is not ${bwhite}adequate " #ATTENTION + CYAN "\n >> ${yellowl}WARNING: ${nc}ESP's size is not ${bwhite}adequate" fi elif [[ "${bootloader}" == "2" ]]; then if [[ "${espmnt}" == "2" ]]; then espprt="fail" xbootloader="no" sleep 0.2 - CYAN " - >> ${yellowl}WARNING: ${nc}ESP's size is not ${bwhite}adequate " #ATTENTION + CYAN "\n >> ${yellowl}WARNING: ${nc}ESP's size is not ${bwhite}adequate" elif [[ "${espmnt}" == "1" ]]; then espprt="ok" xbootloader="no" if [[ "${autoesp}" == "y" ]]; then if [[ "${presetpart}" == "y" || "${smartpart}" == "y" ]]; then sleep 0.2 - GREEN " - >> ${nc}/EFI System partition ${green}OK " #ATTENTION + GREEN "\n >> ${nc}/EFI System partition ${green}OK" else sleep 0.2 - GREEN " - >> ${yellowl}Confirmed ${nc}/EFI System partition ${green}OK " #ATTENTION + GREEN "\n >> ${yellowl}Confirmed ${nc}/EFI System partition ${green}OK" fi else sleep 0.2 - GREEN " - >> ${nc}/EFI System partition ${green}OK " #ATTENTION + GREEN "\n >> ${nc}/EFI System partition ${green}OK" fi fi fi fi -#.................................................................................................. + # ATTENTION: HOME if [[ "${fs}" == "1" ]]; then if [[ "${sep_home}" == "y" ]]; then if [[ -e "${home_dev}" ]]; then @@ -4567,102 +2553,66 @@ ${multi_swap} if [[ "${autohome}" == "y" ]]; then if [[ "${presetpart}" == "y" || "${smartpart}" == "y" ]]; then sleep 0.2 - GREEN " - >> ${nc}Linux /Home partition ${green}OK " #ATTENTION + GREEN "\n >> ${nc}Linux /Home partition ${green}OK" else sleep 0.2 - GREEN " - >> ${yellowl}Confirmed ${nc}Linux /Home partition ${green}OK " #ATTENTION + GREEN "\n >> ${yellowl}Confirmed ${nc}Linux /Home partition ${green}OK" fi else - GREEN " - >> ${nc}Linux /Home partition ${green}OK " #ATTENTION + GREEN "\n >> ${nc}Linux /Home partition ${green}OK" fi else homeprt="fail" sleep 0.2 - RED " - >> ${yellowl}Linux /Home ${nc}partition not detected " #ATTENTION + RED "\n >> ${yellowl}Linux /Home ${nc}partition not detected" fi fi fi -#.................................................................................................. + # ATTENTION: SWAP if [[ "${swapmode}" == "1" ]]; then if [[ -e "${swap_dev}" ]]; then swapprt="ok" if [[ "${autoswap}" == "y" ]]; then if [[ "${presetpart}" == "y" || "${smartpart}" == "y" ]]; then sleep 0.2 - GREEN " - >> ${nc}Linux /Swap partition ${green}OK " #ATTENTION + GREEN "\n >> ${nc}Linux /Swap partition ${green}OK" else sleep 0.2 - GREEN " - >> ${yellowl}Confirmed ${nc}Linux /Swap partition ${green}OK " #ATTENTION + GREEN "\n >> ${yellowl}Confirmed ${nc}Linux /Swap partition ${green}OK" fi else sleep 0.2 - GREEN " - >> ${nc}Linux /Swap partition ${green}OK " #ATTENTION + GREEN "\n >> ${nc}Linux /Swap partition ${green}OK" fi else swapprt="fail" sleep 0.2 - RED " - >> ${yellowl}Linux /Swap ${nc}partition not detected " #ATTENTION + RED "\n >> ${yellowl}Linux /Swap ${nc}partition not detected" fi fi -#.................................................................................................. if [[ "${rootprt}" == "fail" || "${espprt}" == "fail" || "${xbootprt}" == "fail" || "${homeprt}" == "fail" || "${swapprt}" == "fail" ]]; then sanity="no" else sanity="ok" fi -#-------------------------------------------------------------------------------------------------- + # ATTENTION: SANITY CHECK OK if [[ "${sanity}" == "ok" ]]; then if [[ "${smartpart}" == "y" ]]; then - sleep 0.2 - NC " - -==> [${green}Disk ${sgdrive} Smart-Partitioned OK${nc}] " + local prompt="Disk ${sgdrive} Smart-Partitioned" + ok elif [[ "${presetpart}" == "y" ]]; then - sleep 0.2 - NC " - -==> [${green}Disk ${sgdrive} Preset-Partitioned OK${nc}] " + local prompt="Disk ${sgdrive} Preset-Partitioned" + ok fi - sleep 0.2 - GREEN " - - ----------------------- - ### ${bwhite}SANITY CHECK OK${nc}${green} ### - -----------------------" - sleep 0.2 - CYAN " - - -###${nc}------------------------------------------------${cyan}[ ${bwhite}DISK OVERVIEW ${nc}${cyan}]${nc}------------------------------------------------${cyan}### - - " - fdisk -l "${instl_drive}" | grep -E --color=no 'Dev|dev' |GREP_COLORS='mt=01;36' grep -E --color=always 'EFI System|$'|GREP_COLORS='mt=01;32' grep -E --color=always 'Linux root|$'|GREP_COLORS='mt=01;35' grep -E --color=always 'Linux home|$'|GREP_COLORS='mt=01;33' grep -E --color=always 'Linux swap|$'|GREP_COLORS='mt=01;31' grep -E --color=always 'Linux extended boot|$' - CYAN " - -###${nc}-----------------------------------------------------------------------------------------------------------------${cyan}### " - BLUE " - - - > Proceed using the ${nc}${cyan}current ${blue}partitioning layout ? [Y/n] - " - read -r -p " -==> " partok - - echo + msg "SANITY CHECK OK" + printf "\n\n" + disk_overview + get "Proceed using the ${nc}${cyan}current ${blue}partitioning layout ? [Y/n]" + read -r -p "==> " partok partok="${partok:-y}" partok="${partok,,}" - local prompt="Disk Partitioning" local stage_prompt="Partitioning" - if [[ "${partok}" == "y" ]]; then ok return 0 @@ -4688,39 +2638,23 @@ ${multi_swap} y_n return 1 fi -#-------------------------------------------------------------------------------------------------- + # ATTENTION; SANITY CHECK FAIL elif [[ "${sanity}" == "no" ]]; then - sleep 0.2 - RED " - - ----------------------------- - ### ${bwhite}SANITY CHECK FAILED ${nc}${red}### - ----------------------------- - " + err "SANITY CHECK FAILED" keypress - if [[ "${multibooting}" == "y" ]]; then if [[ "${espprt}" == "fail" && -e "${esp_dev}" ]]; then sleep 0.2 - CYAN " - >> ${yellowl}ESP: ${nc}Not all prerequisites are satisfied " #ATTENTION + CYAN "\n >> ${yellowl}ESP: ${nc}Not all prerequisites are satisfied" if [[ "${espmnt}" == "2" ]]; then sleep 0.2 - CYAN " - - >> ${nc}Select ${yellowl}/mnt/efi ${nc}as the mountpoint for your ${yellowl}ESP " #ATTENTION + CYAN "\n\n >> ${nc}Select ${yellowl}/mnt/efi ${nc}as the mountpoint for your ${yellowl}ESP" fi if [[ "${xbootprt}" == "fail" ]]; then sleep 0.2 - CYAN " - - >> ${yellowl}Systemd-boot:${nc}${cyan} - - >> ${nc}Create a ${yellowl}300M ${nc}(at minimum) Linux Extended Boot Partition ${bwhite}(XBOOTLDR) ${yellowl}[GUID CODE: ea00] - " #ATTENTION + CYAN "\n\n >> ${yellowl}Systemd-boot:${nc}${cyan}\n\n >> ${nc}Create a ${yellowl}300M ${nc}(at minimum) Linux Extended Boot Partition ${bwhite}(XBOOTLDR) ${yellowl}[GUID CODE: ea00]\n" fi keypress - if [[ "${espmnt}" == "2" ]]; then until slct_espmnt; do : ; done fi @@ -4745,9 +2679,7 @@ ${multi_swap} fi fi } -################################################################################################### ask_crypt() { - local prompt="Encryption Setup" LuksArray=(Root) [[ "${hometype}" == "1" ]] && LuksArray+=(Home) @@ -4758,65 +2690,29 @@ ask_crypt() { LuksParts="$LuksParts$delimiter$item" delimiter="," done - sleep 0.2 - NC " - - -${magenta}###${nc}------------------------------------${magenta}[ ${bwhite}Encryption Setup${nc} ${magenta}]${nc}------------------------------------${magenta}### - " - BLUE " - - > Utilize LUKS encryption for your system ? " - NC " - - - * Type '${cyan}no${nc}' to proceed without encryption - - * Type '${cyan}yes${nc}' to encrypt your ${yellowl}${LuksParts} - " - read -r -p " -==> " encrypt - echo - + title "Encryption Setup" + ask "Utilize LUKS encryption for your system ?" + NC "\n\n * Type '${cyan}no${nc}' to proceed without encryption\n\n * Type '${cyan}yes${nc}' to encrypt your ${yellowl}${LuksParts}\n" + read -r -p "==> " encrypt if [[ "${encrypt}" == "no" ]]; then skip ok - line2 + printf "\n\n" return 0 elif [[ "${encrypt}" == "yes" ]]; then if [[ "${bootloader}" == "2" && "${espmnt}" == "1" ]]; then - sleep 0.2 - RED " - ----------------------------------------- - ### ${nc}Incompatible Selection detected ${red}### - -----------------------------------------" - YELLOW " - - ### ESP cannot be mounted on ${nc}'/efi' ${yellow}when using Grub on a LUKS encrypted Root partition - - - > Change ESP mountpoint to ${nc}'/boot' ${yellow}instead ? [Y/n] " - BLUE " - - -Enter [Y/n]: " - read -r -p " -==> " cng_espmnt - - echo + err "Incompatible Selection detected" + ack "ESP cannot be mounted on ${nc}'/efi' ${yellow}when using Grub on a LUKS encrypted Root partition" + ask "Change ESP mountpoint to ${nc}'/boot' ${yellow}instead ? [Y/n]" + get "Enter [Y/n]" + read -r -p "==> " cng_espmnt cng_espmnt="${cng_espmnt:-y}" cng_espmnt="${cng_espmnt,,}" - if [[ "${cng_espmnt}" == "y" ]]; then espmnt="2" esp_mount="/mnt/boot" btldr_esp_mount="/boot" - sleep 0.2 - YELLOW " - - ### '/mnt/boot' mountpoint has been selected - - " + ack "'/mnt/boot' mountpoint has been selected" elif [[ "${cng_espmnt}" == "n" ]]; then failure else @@ -4824,33 +2720,15 @@ Enter [Y/n]: " return 1 fi fi + ask "Set your LUKS encryption password" + get "Enter password" + read -r -p "==> " CRYPTPASS sleep 0.2 - YELLOW " - - > Set your LUKS encryption password: " - BLUE " - - -Enter password: " - read -r -p " -==> " CRYPTPASS - sleep 0.2 - YELLOW " - - > Verify your LUKS encryption password: " - BLUE " - - -Re-enter password: " - read -r -p " -==> " CRYPTPASS2 - + ask "Verify your LUKS encryption password" + get "Re-enter password" + read -r -p "==> " CRYPTPASS2 if [[ "${CRYPTPASS}" != "${CRYPTPASS2}" ]]; then - sleep 0.2 - RED " - --------------------------------------------------- - ### ${nc}Passwords don't match. Please try again.. ${red}### - ---------------------------------------------------" + err "Passwords don't match. Please try again.." reload return 1 fi @@ -4860,30 +2738,14 @@ Re-enter password: " return 1 fi } -################################################################################################### instl() { - install="yes" if [[ -z "${lcl_slct}" ]]; then - if [[ -e /usr/bin/pv ]]; then - sleep 0.2 - CYAN " - - - >> ${nc}Please complete ${bwhite}'Locale & Keyboard Layout Selection' ${nc}to continue - " | pv -qL 70 - else - sleep 0.2 - CYAN " - - - >> ${nc}Please complete ${bwhite}'Locale & Keyboard Layout Selection' ${nc}to continue - " - fi + local stage_prompt="Locale & Keyboard Layout Selection" + completion_err until slct_locale; do : ; done until slct_kbd; do : ; done fi - if [[ -z "${USERNAME}" ]]; then local stage_prompt="User, Root User, Hostname & Shell Setup" completion_err @@ -4892,7 +2754,6 @@ instl() { until slct_hostname; do : ; done until slct_shell; do : ; done fi - if [[ -z "${kernelnmbr}" || "${revision}" == "y" ]]; then local stage_prompt="Kernel, Secureboot Signing, Bootloader & ESP Mountpoint" completion_err @@ -4901,20 +2762,17 @@ instl() { until slct_bootldr; do : ; done until slct_espmnt; do : ; done fi - if [[ -z "${fs}" || "${revision}" == "y" ]]; then local stage_prompt="Filesystem & Swap Setup" completion_err until slct_fs; do : ; done until slct_swap; do : ; done fi - if [[ "${vendor}" != "Virtual Machine" && -z "${gfx_slct}" ]] || [[ "${vendor}" != "Virtual Machine" && "${revision}" == "y" ]]; then local stage_prompt="Graphics Setup" completion_err until dtct_gfx; do : ; done fi - if [[ -z "${desktop}" || "${revision}" == "y" ]]; then local stage_prompt="Desktop Setup" completion_err @@ -4928,7 +2786,6 @@ instl() { until web_browser; do : ; done fi fi - if [[ "${vendor}" != "Virtual Machine" ]]; then if [[ -z "${printer}" || "${revision}" == "y" ]]; then if [[ ! "${desktop}" =~ ^(11|12)$ ]]; then @@ -4941,15 +2798,14 @@ instl() { until boot_entr; do : ; done fi fi - - if [[ -z "${askoptm}" ]]; then - local stage_prompt="Optimizations" + if [[ -z "${show_extopts}" ]]; then + local stage_prompt="Extended Options" completion_err - until ask_optm; do : ; done - if [[ "${askoptm}" == "y" ]]; then + until display_ext_opt; do : ; done + if [[ "${show_extopts}" == "y" ]]; then until cust_kern_param; do : ; done until sys_watchdog; do : ; done - until gen_optm; do : ; done + until sysoptm; do : ; done if [[ "${vendor}" != "Virtual Machine" ]]; then until ask_wireless_regdom; do : ; done fi @@ -4965,11 +2821,9 @@ instl() { fi until instl_dsk; do : ; done until ask_crypt; do : ; done - if [[ "${swapmode}" == "1" ]]; then until "${swaptype}"; do : ; done fi - if [[ "${encrypt}" == "no" ]]; then until set_mode; do : ; done elif [[ "${encrypt}" == "yes" ]]; then @@ -4986,136 +2840,75 @@ instl() { fi set_vars chroot_conf + completion + installation="ok" + umount -R /mnt + reboot } -################################################################################################### swappart() { - if [[ "${encrypt}" == "yes" ]]; then - line2 + printf "\n\n" fi local prompt="Swap Partition Creation" local stage_prompt="Swap Partition Creation" sleep 0.2 - NC " -${magenta}###${nc}----------------------------------${magenta}[ ${bwhite}Swap Partition Setup${nc} ${magenta}]${nc}----------------------------------${magenta}### - " + NC "\n${magenta}###${nc}----------------------------------${magenta}[ ${bwhite}Swap Partition Setup${nc} ${magenta}]${nc}----------------------------------${magenta}###\n" if mkswap "${swap_dev}" > "${void}" 2> "${log}" ; then ok else stage_fail fi } -################################################################################################### set_mode() { - if [[ "${rootcount}" -gt "1" || "${espcount}" -gt "1" || "${xbootcount}" -gt "1" || "${homecount}" -gt "1" || "${swapcount}" -gt "1" ]]; then until auto_mode; do : ; done - sleep 0.2 - NC " - -==> [${green}Filesystems OK${nc}] - " - sleep 0.2 - CYAN " -###${nc}---------------------------------------------${cyan}[ ${bwhite}FILESYSTEM OVERVIEW ${nc}${cyan}]${nc}---------------------------------------------${cyan}### - - " - lsblk -f|GREP_COLORS='mt=01;36' grep -E --color=always 'vfat|$'|GREP_COLORS='mt=01;32' grep -E --color=always 'ext4|$'|GREP_COLORS='mt=01;35' grep -E --color=always 'btrfs|$'|GREP_COLORS='mt=01;31' grep -E --color=always 'ntfs|$'|GREP_COLORS='mt=01;33' grep -E --color=always 'swap|$' - CYAN " - -###${nc}-----------------------------------------------------------------------------------------------------------------${cyan}### - " - sleep 0.2 + local prompt="Filesystems" + ok + filesystem_overview return 0 fi - - sleep 0.2 - NC " - - -${magenta}###${nc}-------------------------------------${magenta}[ ${bwhite}Mode Selection${nc} ${magenta}]${nc}-------------------------------------${magenta}### - " - YELLOW " - - > Select a Mode to continue: " - NC " - - [1] Auto (Automatically Format, Label & Mount partitions) - - [2] Manual (Manually Format, Label & Mount partitions) " - BLUE " - - -Enter a Mode number: " - read -r -p " -==> " setmode - echo - + title "Mode Selection" + ask "Select a Mode to continue" + NC "\n\n [1] Auto (Automatically Format, Label & Mount partitions)\n\n [2] Manual (Manually Format, Label & Mount partitions)" + get "Enter a Mode number" + read -r -p "==> " setmode case "${setmode}" in 1) until auto_mode; do : ; done ;; 2) until manual_mode; do : ; done ;; "") - sleep 0.2 - RED " - ------------------------------------------ - ### ${nc}Please select a Mode to continue ${red}### - ------------------------------------------" + err "Please select a Mode to continue" reload return 1 ;; *) invalid return 1 ;; esac - - sleep 0.2 - NC " - -==> [${green}Filesystems OK${nc}] - " - sleep 0.2 - CYAN " -###${nc}---------------------------------------------${cyan}[ ${bwhite}FILESYSTEM OVERVIEW ${nc}${cyan}]${nc}---------------------------------------------${cyan}### - - " - lsblk -f|GREP_COLORS='mt=01;36' grep -E --color=always 'vfat|$'|GREP_COLORS='mt=01;32' grep -E --color=always 'ext4|$'|GREP_COLORS='mt=01;35' grep -E --color=always 'btrfs|$'|GREP_COLORS='mt=01;31' grep -E --color=always 'ntfs|$'|GREP_COLORS='mt=01;33' grep -E --color=always 'swap|$' - CYAN " - -###${nc}-----------------------------------------------------------------------------------------------------------------${cyan}### - " - sleep 0.2 + local prompt="Filesystems" + ok + filesystem_overview } -################################################################################################### auto_mode() { - if [[ "${swapmode}" == "1" ]]; then - line2 + printf "\n\n" fi espfs="$(lsblk -dno FSTYPE "${esp_dev}")" sleep 0.2 - NC " -${magenta}###${nc}----------------------------------------${magenta}[ ${bwhite}Auto Mode${nc} ${magenta}]${nc}----------------------------------------${magenta}### - " + NC "\n${magenta}###${nc}----------------------------------------${magenta}[ ${bwhite}Auto Mode${nc} ${magenta}]${nc}----------------------------------------${magenta}###\n" sleep 0.2 - YELLOW " - - > Auto Mode Selected - - " + YELLOW "\n\n > Auto Mode Selected\n\n" if [[ "${fs}" == "1" ]]; then if mkfs.ext4 -F -L Root "${root_dev}" > "${void}" 2> "${log}" ; then tune2fs -O fast_commit "${root_dev}" > "${void}" 2> "${log}" || err_abort mount "${root_dev}" /mnt > "${void}" 2> "${log}" || err_abort sleep 0.2 - NC " -==> [${green}/Root OK${nc}] " + NC "\n==> [${green}/Root OK${nc}]" else umount_manual until form_root; do : ; done until mount_mnt; do : ; done fi -#-------------------------------------------------------------------------------------------------- elif [[ "${fs}" == "2" ]]; then if mkfs.btrfs -f -L Root "${root_dev}" > "${void}" 2> "${log}" ; then mount "${root_dev}" /mnt > "${void}" 2> "${log}" || err_abort @@ -5139,8 +2932,7 @@ ${magenta}###${nc}----------------------------------------${magenta}[ ${bwhite}A mount --mkdir -o "${sbvl_mnt_opts}",subvol=@swap "${root_dev}" /mnt/swap > "${void}" 2> "${log}" || err_abort fi sleep 0.2 - NC " -==> [${green}/@ OK${nc}] " + NC "\n==> [${green}/@ OK${nc}]" else umount_manual until form_root; do : ; done @@ -5148,13 +2940,11 @@ ${magenta}###${nc}----------------------------------------${magenta}[ ${bwhite}A fi fi sleep 0.2 -#-------------------------------------------------------------------------------------------------- if [[ "${multibooting}" == "n" ]]; then if mkfs.fat -F 32 -n ESP "${esp_dev}" > "${void}" 2> "${log}" ; then mount --mkdir "${esp_dev}" "${esp_mount}" > "${void}" 2> "${log}" || err_abort sleep 0.2 - NC " -==> [${green}/ESP OK${nc}] " + NC "\n==> [${green}/ESP OK${nc}]" else umount_manual until form_esp; do : ; done @@ -5164,8 +2954,7 @@ ${magenta}###${nc}----------------------------------------${magenta}[ ${bwhite}A elif [[ "${multibooting}" == "y" && "${espfs}" == "vfat" ]]; then if mount --mkdir "${esp_dev}" "${esp_mount}" > "${void}" 2> "${log}" ; then sleep 0.2 - NC " -==> [${green}Unformatted /ESP Mounted OK${nc}] " + NC "\n==> [${green}Unformatted /ESP Mounted OK${nc}]" else umount_manual until mount_mnt; do : ; done @@ -5175,8 +2964,7 @@ ${magenta}###${nc}----------------------------------------${magenta}[ ${bwhite}A if mkfs.fat -F 32 -n ESP "${esp_dev}" > "${void}" 2> "${log}" ; then mount --mkdir "${esp_dev}" "${esp_mount}" > "${void}" 2> "${log}" || err_abort sleep 0.2 - NC " -==> [${green}/ESP OK${nc}] " + NC "\n==> [${green}/ESP OK${nc}]" else umount_manual until form_esp; do : ; done @@ -5185,13 +2973,11 @@ ${magenta}###${nc}----------------------------------------${magenta}[ ${bwhite}A fi fi sleep 0.2 -#-------------------------------------------------------------------------------------------------- if [[ "${xbootloader}" == "yes" ]]; then if mkfs.fat -F 32 -n XBOOTLDR "${xboot_dev}" > "${void}" 2> "${log}" ; then mount --mkdir "${xboot_dev}" /mnt/boot > "${void}" 2> "${log}" || err_abort sleep 0.2 - NC " -==> [${green}/XBOOTLDR OK${nc}] " + NC "\n==> [${green}/XBOOTLDR OK${nc}]" else umount_manual until form_xboot; do : ; done @@ -5201,7 +2987,6 @@ ${magenta}###${nc}----------------------------------------${magenta}[ ${bwhite}A fi fi sleep 0.2 -#-------------------------------------------------------------------------------------------------- if [[ "${fs}" == "1" && -e "${home_dev}" && "${sep_home}" == "y" ]]; then if [[ "${smartpart}" == "y" ]]; then homeform="y" @@ -5212,14 +2997,12 @@ ${magenta}###${nc}----------------------------------------${magenta}[ ${bwhite}A elif [[ "${hometype}" == "2" ]]; then homeform="n" fi - if [[ "${homeform}" == "y" ]]; then if mkfs.ext4 -F -L Home "${home_dev}" > "${void}" 2> "${log}" ; then tune2fs -O fast_commit "${home_dev}" > "${void}" 2> "${log}" || err_abort mount --mkdir "${home_dev}" /mnt/home > "${void}" 2> "${log}" || err_abort sleep 0.2 - NC " -==> [${green}/Home OK${nc}] " + NC "\n==> [${green}/Home OK${nc}]" else umount_manual until manual_part; do : ; done @@ -5234,18 +3017,14 @@ ${magenta}###${nc}----------------------------------------${magenta}[ ${bwhite}A elif [[ "${homeform}" == "n" ]]; then mount --mkdir "${home_dev}" /mnt/home > "${void}" 2> "${log}" || err_abort sleep 0.2 - NC " -==> [${green}Unformatted /Home Mounted OK${nc}] " + NC "\n==> [${green}Unformatted /Home Mounted OK${nc}]" fi fi blkid > "${void}" 2> "${log}" keypress } -################################################################################################### manual_mode() { - volumes="$(fdisk -l | grep '^/dev' | cat --number)" - if [[ "${multibooting}" == "no" ]]; then until form_esp; do : ; done fi @@ -5265,41 +3044,22 @@ manual_mode() { until mount_home; do : ; done fi } -################################################################################################### form_esp() { - - sleep 0.2 - NC " - - -${magenta}###${nc}-------------------------------${magenta}[ ${bwhite}Format EFI System Partition${nc} ${magenta}]${nc}-------------------------------${magenta}### - " + title "Format EFI System Partition" form_esp_nmbr=" " - while [[ -n "${form_esp_nmbr}" ]]; do - YELLOW " - - > Select an EFI System Partition to format as ${nc}vfat - - -${volumes}" - BLUE " - - -Enter a partition number: " - read -r -p " -==> " form_esp_nmbr - + ask "Select an EFI System Partition to format as ${nc}vfat" + NC "\n\n\n${volumes}" + get "Enter a partition number" + read -r -p "==> " form_esp_nmbr if [[ -n "${form_esp_nmbr}" ]]; then esppart="$(echo "${volumes}" | awk "\$1 == ${form_esp_nmbr} {print \$2}")" manespfs="$(lsblk -dno FSTYPE "${esppart}" 2> "${void}")" if [[ -e "${esppart}" ]]; then if [[ "${multibooting}" == "n" ]]; then if mkfs.fat -F 32 -n ESP "${esppart}" > "${void}" 2> "${log}" ; then - sleep 0.2 - NC " - -==> [${green}Format & Label /ESP OK${nc}] " + local prompt="Format & Label /ESP" + ok return 0 else do_umount @@ -5308,17 +3068,13 @@ Enter a partition number: " return 0 fi elif [[ "${multibooting}" == "y" && "${manespfs}" == "vfat" ]]; then - sleep 0.2 - NC " - -==> [${green}/Unformatted ESP OK${nc}] " + local prompt="Unformatted ESP" + ok return 0 elif [[ "${multibooting}" == "y" && "${manespfs}" != "vfat" ]]; then if mkfs.fat -F 32 -n ESP "${esppart}" > "${void}" 2> "${log}" ; then - sleep 0.2 - NC " - -==> [${green}Format & Label /ESP OK${nc}] " + local prompt="Format & Label /ESP" + ok return 0 else do_umount @@ -5338,39 +3094,20 @@ Enter a partition number: " blkid > "${void}" 2> "${log}" done } -################################################################################################### form_xboot() { - - sleep 0.2 - NC " - - -${magenta}###${nc}--------------------------${magenta}[ ${bwhite}Format Linux Extended Boot Partition${nc} ${magenta}]${nc}--------------------------${magenta}### - " + title "Format Linux Extended Boot Partition" form_xboot_nmbr=" " - while [[ -n "${form_xboot_nmbr}" ]]; do - YELLOW " - - > Select a Linux Extended Boot Partition to format as ${nc}vfat - - -${volumes}" - BLUE " - - -Enter a partition number: " - read -r -p " -==> " form_xboot_nmbr - + ask "Select a Linux Extended Boot Partition to format as ${nc}vfat" + NC "\n\n\n${volumes}" + get "Enter a partition number" + read -r -p "==> " form_xboot_nmbr if [[ -n "${form_xboot_nmbr}" ]]; then xbootpart="$(echo "${volumes}" | awk "\$1 == ${form_xboot_nmbr} {print \$2}")" if [[ -e "${xbootpart}" ]]; then if mkfs.fat -F 32 -n XBOOTLDR "${xbootpart}" > "${void}" 2> "${log}" ; then - sleep 0.2 - NC " - -==> [${green}Format & Label /XBOOTLDR OK${nc}] " + local prompt="Format & Label /XBOOTLDR" + ok else do_umount until manual_part; do : ; done @@ -5388,50 +3125,28 @@ Enter a partition number: " blkid > "${void}" 2> "${log}" done } -################################################################################################### form_root() { - - sleep 0.2 - NC " - - -${magenta}###${nc}----------------------------------${magenta}[ ${bwhite}Format Root Partition${nc} ${magenta}]${nc}----------------------------------${magenta}### - " + title "Format Root Partition" form_root_nmbr=" " - while [[ -n "${form_root_nmbr}" ]]; do - YELLOW " - - > Select a ${roottype} Partition to format as ${nc}${fsname} - - -${volumes}" - BLUE " - - -Enter a partition number: " - read -r -p " -==> " form_root_nmbr - + ask "Select a ${roottype} Partition to format as ${nc}${fsname}" + NC "\n\n\n${volumes}" + get "Enter a partition number" + read -r -p "==> " form_root_nmbr if [[ -n "${form_root_nmbr}" ]]; then rootpart="$(echo "${volumes}" | awk "\$1 == ${form_root_nmbr} {print \$2}")" if [[ -e "${rootpart}" ]]; then -#-------------------------------------------------------------------------------------------------- if [[ "${fs}" == "1" ]]; then if mkfs.ext4 -F "${rootpart}" > "${void}" 2> "${log}" ; then tune2fs -O fast_commit "${rootpart}" > "${void}" 2> "${log}" || err_abort - sleep 0.2 - NC " - - -==> [${green}Format ${roottype} OK${nc}] " + local prompt="Format ${roottype}" + ok else do_umount until manual_part; do : ; done until form_root; do : ; done return 0 fi -#-------------------------------------------------------------------------------------------------- elif [[ "${fs}" == "2" ]]; then if mkfs.btrfs -f "${rootpart}" > "${void}" 2> "${log}" ; then mount "${rootpart}" /mnt > "${void}" 2> "${log}" || err_abort @@ -5445,11 +3160,8 @@ Enter a partition number: " btrfs subvolume create /mnt/@swap > "${void}" 2> "${log}" || err_abort fi umount /mnt > "${void}" 2> "${log}" || err_abort - sleep 0.2 - NC " - - -==> [${green}Format ${roottype} OK${nc}] " + local prompt="Format ${roottype}" + ok else do_umount until manual_part; do : ; done @@ -5461,24 +3173,15 @@ Enter a partition number: " invalid return 1 fi - - YELLOW " - - > Label the ${roottype} Partition " - BLUE " - - -Enter a name: " - read -r -p " -==> " rootpartname - + echo + ask "Label the ${roottype} Partition" + get "Enter a name" + read -r -p "==> " rootpartname if [[ -n "${rootpartname}" ]]; then if [[ "${fs}" == "1" ]]; then if e2label "${rootpart}" "${rootpartname}" > "${void}" 2> "${log}" ; then - sleep 0.2 - NC " - -==> [${green}Label ${roottype} OK${nc}] " + local prompt="Label ${roottype}" + ok return 0 else err_try @@ -5488,18 +3191,12 @@ Enter a name: " mount "${rootpart}" /mnt || err_abort btrfs filesystem label /mnt "${rootpartname}" > "${void}" 2> "${log}" || err_abort umount /mnt || err_abort - sleep 0.2 - NC " - -==> [${green}Label ${roottype} OK${nc}] " + local prompt="Label ${roottype}" + ok return 0 fi else - sleep 0.2 - RED " - ----------------------------- - ### ${nc}Please enter a name ${red}### - -----------------------------" + err "Please enter a name" reload return 1 fi @@ -5510,42 +3207,21 @@ Enter a name: " blkid > "${void}" 2> "${log}" done } -################################################################################################### form_home() { - - sleep 0.2 - NC " - - -${magenta}###${nc}----------------------------------${magenta}[ ${bwhite}Format Home Partition${nc} ${magenta}]${nc}----------------------------------${magenta}### - " + title "Format Home Partition" form_home_nmbr=" " - while [[ -n "${form_home_nmbr}" ]]; do - YELLOW " - - > Select a /Home Partition to format as ${nc}Ext4 - - - -${volumes} " - BLUE " - - -Enter a partition number ${bwhite}(empty to skip and proceed)${blue}: " - read -r -p " -==> " form_home_nmbr - + ask "Select a /Home Partition to format as ${nc}Ext4" + NC "\n\n\n${volumes}" + get "Enter a partition number ${bwhite}(empty to skip and proceed)" + read -r -p "==> " form_home_nmbr if [[ -n "${form_home_nmbr}" ]]; then homepart="$(echo "${volumes}" | awk "\$1 == ${form_home_nmbr} {print \$2}")" if [[ -e "${homepart}" ]]; then if mkfs.ext4 -F "${homepart}" > "${void}" 2> "${log}" ; then tune2fs -O fast_commit "${homepart}" > "${void}" 2> "${log}" || err_abort - sleep 0.2 - NC " - - -==> [${green}Format /Home OK${nc}] " + local prompt="Format /Home" + ok else do_umount until manual_part; do : ; done @@ -5556,84 +3232,48 @@ Enter a partition number ${bwhite}(empty to skip and proceed)${blue}: " invalid return 1 fi - YELLOW " - - > Label the /Home Partition " - BLUE " - - -Enter a name: " - read -r -p " -==> " homepartname - + echo + ask "Label the /Home Partition" + get "Enter a name" + read -r -p "==> " homepartname if [[ -n "${homepartname}" ]]; then if e2label "${homepart}" "${homepartname}" > "${void}" 2> "${log}" ;then - sleep 0.2 - NC " - -==> [${green}Label /Home OK${nc}] " + local prompt="Label /Home" + ok else err_try return 1 fi else - sleep 0.2 - RED " - ----------------------------- - ### ${nc}Please enter a name ${red}### - -----------------------------" + err "Please enter a name" reload return 1 fi else - RED " - --------------------------------------------------- - ### ${yellow}WARNING: ${nc}PARTITION HAS NOT BEEN FORMATTED ${red}### - ---------------------------------------------------" + err "${yellow}WARNING: ${nc}PARTITION HAS NOT BEEN FORMATTED" skip fi blkid > "${void}" 2> "${log}" done } -################################################################################################### mount_mnt() { - local prompt="Mount ${roottype}" - sleep 0.2 - NC " - - -${magenta}###${nc}----------------------------------${magenta}[ ${bwhite}Mount Root Partition${nc} ${magenta}]${nc}----------------------------------${magenta}### - " - YELLOW " - - > Select a ${roottype} Partition to mount to ${nc}/mnt - - - -${volumes} " - BLUE " - - -Enter your${nc} ${cyan}${roottype} ${blue}partition number: " - read -r -p " -==> " mntroot_nmbr - echo - + title "Mount Root Partition" + ask "Select a ${roottype} Partition to mount to ${nc}/mnt" + NC "\n\n\n${volumes}" + get "Enter your${nc} ${cyan}${roottype} ${blue}partition number" + read -r -p "==> " mntroot_nmbr if [[ -n "${mntroot_nmbr}" ]]; then rootpart="$(echo "${volumes}" | awk "\$1 == ${mntroot_nmbr} {print \$2}")" if [[ -e "${rootpart}" ]]; then -#-------------------------------------------------------------------------------------------------- if [[ "${fs}" == "1" ]]; then if mount "${rootpart}" /mnt > "${void}" 2> "${log}" ; then - sleep 0.2 ok return 0 else do_umount until mount_mnt; do : ; done fi -#-------------------------------------------------------------------------------------------------- elif [[ "${fs}" == "2" ]]; then if mount -o "${sbvl_mnt_opts}",subvol=@ "${rootpart}" /mnt > "${void}" 2> "${log}" ; then mount --mkdir -o "${sbvl_mnt_opts}",subvol=@home "${rootpart}" /mnt/home > "${void}" 2> "${log}" || err_abort @@ -5644,7 +3284,6 @@ Enter your${nc} ${cyan}${roottype} ${blue}partition number: " if [[ "${swapmode}" == "2" ]]; then mount --mkdir -o "${sbvl_mnt_opts}",subvol=@swap "${rootpart}" /mnt/swap > "${void}" 2> "${log}" || err_abort fi - sleep 0.2 ok return 0 else @@ -5652,7 +3291,6 @@ Enter your${nc} ${cyan}${roottype} ${blue}partition number: " until mount_mnt; do : ; done fi fi -#-------------------------------------------------------------------------------------------------- else invalid return 1 @@ -5662,31 +3300,13 @@ Enter your${nc} ${cyan}${roottype} ${blue}partition number: " return 1 fi } -################################################################################################### mount_esp() { - - local prompt="Mount ESP" - sleep 0.2 - NC " - - -${magenta}###${nc}-----------------------------------${magenta}[ ${bwhite}Mount ESP Partition${nc} ${magenta}]${nc}-----------------------------------${magenta}### - " - YELLOW " - - > Select an EFI System Partition to mount to ${nc}${esp_mount} - - - -${volumes}" - BLUE " - - -Enter your${nc} ${cyan}/ESP ${blue}partition number: " - read -r -p " -==> " mntesp_nmbr - echo - + local prompt="Mount ESP Partition" + title "${prompt}" + ask "Select an EFI System Partition to mount to ${nc}${esp_mount}" + NC "\n\n\n${volumes}" + get "Enter your${nc} ${cyan}/ESP ${blue}partition number" + read -r -p "==> " mntesp_nmbr if [[ -n "${mntesp_nmbr}" ]]; then esppart="$(echo "${volumes}" | awk "\$1 == ${mntesp_nmbr} {print \$2}")" if [[ -e "${esppart}" ]]; then @@ -5707,31 +3327,13 @@ Enter your${nc} ${cyan}/ESP ${blue}partition number: " return 1 fi } -################################################################################################### mount_xboot() { - - local prompt="Mount XBOOTLDR" - sleep 0.2 - NC " - - -${magenta}###${nc}--------------------------------${magenta}[ ${bwhite}Mount XBOOTLDR Partition${nc} ${magenta}]${nc}--------------------------------${magenta}### - " - YELLOW " - - > Select a Linux Extended Boot Partition to mount to ${nc}/mnt/boot - - - -${volumes}" - BLUE " - - -Enter your${nc} ${cyan}/XBOOTLDR ${blue}partition number: " - read -r -p " -==> " mntxboot_nmbr - echo - + local prompt="Mount XBOOTLDR Partition" + title "${prompt}" + ask "Select a Linux Extended Boot Partition to mount to ${nc}/mnt/boot" + NC "\n\n\n${volumes}" + get "Enter your${nc} ${cyan}/XBOOTLDR ${blue}partition number" + read -r -p "==> " mntxboot_nmbr if [[ -n "${mntxboot_nmbr}" ]]; then xbootpart="$(echo "${volumes}" | awk "\$1 == ${mntxboot_nmbr} {print \$2}")" if [[ -e "${xbootpart}" ]]; then @@ -5753,31 +3355,13 @@ Enter your${nc} ${cyan}/XBOOTLDR ${blue}partition number: " return 1 fi } -################################################################################################### mount_home() { - - local prompt="Mount /Home" - sleep 0.2 - NC " - - -${magenta}###${nc}----------------------------------${magenta}[ ${bwhite}Mount Home Partition${nc} ${magenta}]${nc}----------------------------------${magenta}### - " - YELLOW " - - > Select a /Home Partition to mount to ${nc}/mnt/home - - - -${volumes}" - BLUE " - - -Enter your${nc} ${cyan}/Home ${blue}partition number: " - read -r -p " -==> " mnthome_nmbr - echo - + local prompt="Mount Home Partition" + title "${prompt}" + ask "Select a /Home Partition to mount to ${nc}/mnt/home" + NC "\n\n\n${volumes}" + get "Enter your${nc} ${cyan}/Home ${blue}partition number" + read -r -p "==> " mnthome_nmbr if [[ -n "${mnthome_nmbr}" ]]; then homepart="$(echo "${volumes}" | awk "\$1 == ${mnthome_nmbr} {print \$2}")" if [[ -e "${homepart}" ]]; then @@ -5800,32 +3384,15 @@ Enter your${nc} ${cyan}/Home ${blue}partition number: " return 1 fi } -################################################################################################### confirm_status() { - local prompt="System Ready" - sleep 0.2 - NC " - - -${magenta}###${nc}-------------------------------${magenta}[ ${bwhite}Confirm Installation Status${nc} ${magenta}]${nc}-------------------------------${magenta}### - " - BLUE " - - > Proceed ? " - NC " - - * Type '${cyan}yes${nc}' to continue installation - - * Type '${cyan}no${nc}' to revise installation - - " - read -r -p " -==> " agree - + title "Confirm Installation Status" + get "> Proceed ?" + NC "\n * Type '${cyan}yes${nc}' to continue installation\n\n * Type '${cyan}no${nc}' to revise installation\n\n" + read -r -p "==> " agree if [[ "${agree}" == "yes" ]]; then ok - line3 + printf "\n\n\n" return 0 elif [[ "${agree}" == "no" ]]; then unmount @@ -5835,65 +3402,36 @@ ${magenta}###${nc}-------------------------------${magenta}[ ${bwhite}Confirm In return 1 fi } -################################################################################################### revise() { - revision="y" gfxpkgs=() validpkgs=() - reset=(xbootloader="" desktop="" terminal="" custompkgs="" customservices="" cust_bootopts="" REGDOM="" autoroot="" autoxboot="" autohome="" autoswap="" lowlat="" nogsp="" sanity="" partok="" preset="" set_optm="" ask_param="" kill_watchdog="" genoptm="" desk_setup="" devel="" web="" web_pkg="" web_aur="" web_slct="" oomd="" irqbalance="" thermald="" rngd="" rtkit="" tlp="" CRYPTPASS="" CRYPTPASS2="" askoptm="" gptslct="" gptok="" gptabort="" nvidiaprop="" nowarning="" hometype="" homeform="" smartpart="" LuksParts="" nvidia_aur="" web_aur_url="" session="" alt_session="" session_support="" alt_session_pack="") + reset=(trg="" xbootloader="" desktop="" terminal="" custompkgs="" customservices="" cust_bootopts="" REGDOM="" autoroot="" autoxboot="" autohome="" autoswap="" lowlat="" nogsp="" sanity="" partok="" preset="" set_ext_opt="" ask_param="" kill_watchdog="" sys_optm="" desk_setup="" devel="" web="" web_pkg="" web_aur="" web_slct="" oomd="" irqbalance="" thermald="" rngd="" rtkit="" tlp="" CRYPTPASS="" CRYPTPASS2="" show_extopts="" gptslct="" gptok="" gptabort="" nvidiaprop="" nowarning="" hometype="" homeform="" smartpart="" LuksParts="" nvidia_aur="" web_aur_url="" session="" alt_session="" session_support="" alt_session_pack="") export "${reset[@]}" instl - } -################################################################################################### sec_erase() { - - local prompt="Secure Erasure" - sleep 0.2 - NC " - - -${magenta}###${nc}-----------------------------------${magenta}[ ${bwhite}Secure Disk Erasure${nc} ${magenta}]${nc}-----------------------------------${magenta}### - " + local prompt="Secure Disk Erasure" + title "${prompt}" erase_dsk_nmbr=" " - while [[ -n "${erase_dsk_nmbr}" ]]; do - YELLOW " - - > Select a disk for Secure Erasure ${red}[!] (CAUTION) [!]${yellow} " - CYAN " - - >> ${nc}A reboot is mandatory and will take effect ${yellowl}immediately ${nc}when done " - NC " - - -${disks}" - BLUE " - - -Enter a disk number ${bwhite}(empty to skip)${blue}: " - read -r -p " -==> " erase_dsk_nmbr - echo - + ask "Select a disk for Secure Erasure ${red}[!] (CAUTION) [!]" + inf "${nc}A reboot is mandatory and will take effect ${yellowl}immediately ${nc}when done" + NC "\n\n\n${disks}" + get "Enter a disk number ${bwhite}(empty to skip)" + read -r -p "==> " erase_dsk_nmbr if [[ -n "${erase_dsk_nmbr}" ]]; then erasedrive="$(echo "${disks}" | awk "\$1 == ${erase_dsk_nmbr} {print \$2}")" if [[ -e "${erasedrive}" ]]; then cryptsetup open --type plain -d /dev/urandom "${erasedrive}" temp || err_abort dd if=/dev/zero of=/dev/mapper/temp status=progress bs=1M oflag=direct || err_abort cryptsetup close temp || err_abort - sleep 0.2 - NC " - -==> [${green}Drive ${erasedrive} Erased OK${nc}] " - - sleep 0.2 - NC " - -==> [${green}Rebooting${nc}] " + local prompt="Drive ${erasedrive} Erased" + ok + local prompt="Rebooting" + ok sleep 1 - reboot + systemctl reboot else invalid return 1 @@ -5904,39 +3442,24 @@ Enter a disk number ${bwhite}(empty to skip)${blue}: " fi done } -################################################################################################### luks() { - + # NOTE: LUKS Root espfs="$(lsblk -f --noheadings "${esp_dev}" | awk "{print \$2}")" - sleep 0.2 - NC " - - -${magenta}###${nc}-------------------------------------${magenta}[ ${bwhite}LUKS Encryption${nc} ${magenta}]${nc}-------------------------------------${magenta}### - " - BLUE " - - - > Encrypting your ${yellowl}${LuksParts}${blue}: - - - " + title "LUKS Encryption" + BLUE "\n\n\n > Encrypting your ${yellowl}${LuksParts}${blue}:\n\n\n" if echo -n "${CRYPTPASS}" | cryptsetup luksFormat --label CRYPTROOT "${root_dev}" > "${void}"; then if [[ "${rota}" == "0" ]]; then echo -n "${CRYPTPASS}" | cryptsetup --perf-no_read_workqueue --perf-no_write_workqueue --persistent luksOpen "${root_dev}" root || err_abort else echo -n "${CRYPTPASS}" | cryptsetup luksOpen "${root_dev}" root || err_abort fi -#------------------------------------------------------------------------------------------ if [[ "${fs}" == "1" ]]; then mkfs.ext4 -F -L Root /dev/mapper/root > "${void}" 2> "${log}" || err_abort tune2fs -O fast_commit /dev/mapper/root > "${void}" 2> "${log}" || err_abort mount /dev/mapper/root /mnt > "${void}" 2> "${log}" || err_abort sleep 0.2 - NC " -==> [${green}Encrypted /Root OK${nc}] " + NC "\n==> [${green}Encrypted /Root OK${nc}]" luks_root="ok" -#------------------------------------------------------------------------------------------ elif [[ "${fs}" == "2" ]]; then mkfs.btrfs -f -L Root /dev/mapper/root > "${void}" 2> "${log}" || err_abort mount /dev/mapper/root /mnt > "${void}" 2> "${log}" || err_abort @@ -5960,19 +3483,18 @@ ${magenta}###${nc}-------------------------------------${magenta}[ ${bwhite}LUKS mount --mkdir -o "${sbvl_mnt_opts}",subvol=@swap /dev/mapper/root /mnt/swap > "${void}" 2> "${log}" || err_abort fi sleep 0.2 - NC " -==> [${green}Encrypted /@ OK${nc}] " + NC "\n==> [${green}Encrypted /@ OK${nc}]" luks_root="ok" fi else - line2 + printf "\n\n" err_try do_umount return 1 fi -#-------------------------------------------------------------------------------------------------- + # NOTE: LUKS Swap if [[ -e "${swap_dev}" && "${swapmode}" == "1" ]]; then - line2 + printf "\n\n" if echo -n "${CRYPTPASS}" | cryptsetup luksFormat --label CRYPTSWAP "${swap_dev}" > "${void}"; then if [[ "${rota}" == "0" ]]; then echo -n "${CRYPTPASS}" | cryptsetup --perf-no_read_workqueue --perf-no_write_workqueue --persistent luksOpen "${swap_dev}" swap || err_abort @@ -5981,19 +3503,18 @@ ${magenta}###${nc}-------------------------------------${magenta}[ ${bwhite}LUKS fi mkswap /dev/mapper/swap > "${void}" 2> "${log}" || err_abort sleep 0.2 - NC " -==> [${green}Encrypted /Swap OK${nc}] " + NC "\n==> [${green}Encrypted /Swap OK${nc}]" luks_swap="ok" else - line2 + printf "\n\n" err_try do_umount return 1 fi fi -#-------------------------------------------------------------------------------------------------- + # NOTE: LUKS Home if [[ "${sep_home}" == "y" && "${hometype}" == "1" ]]; then - line2 + printf "\n\n" if echo -n "${CRYPTPASS}" | cryptsetup luksFormat --label CRYPTHOME "${home_dev}" > "${void}"; then if [[ "${rota}" == "0" ]]; then echo -n "${CRYPTPASS}" | cryptsetup --perf-no_read_workqueue --perf-no_write_workqueue --persistent luksOpen "${home_dev}" home || err_abort @@ -6004,52 +3525,39 @@ ${magenta}###${nc}-------------------------------------${magenta}[ ${bwhite}LUKS tune2fs -O fast_commit /dev/mapper/home > "${void}" 2> "${log}" || err_abort mount --mkdir /dev/mapper/home /mnt/home > "${void}" 2> "${log}" || err_abort sleep 0.2 - NC " -==> [${green}Encrypted /Home OK${nc}] - " + NC "\n==> [${green}Encrypted /Home OK${nc}]\n" luks_home="ok" else - line2 + printf "\n\n" err_try do_umount return 1 fi elif [[ "${sep_home}" == "y" && "${hometype}" == "2" ]]; then - sleep 0.2 - YELLOW " - - > An existing /Home partition has been detected and will be utilized in this installation - - " + ack "An existing /Home partition has been detected and will be utilized in this installation" keypress mount --mkdir "${home_dev}" /mnt/home > "${void}" 2> "${log}" || err_abort sleep 0.2 - NC " -==> [${green}Unformatted /Home Mounted OK${nc}] - " + NC "\n==> [${green}Unformatted /Home Mounted OK${nc}]\n" fi -#-------------------------------------------------------------------------------------------------- + # NOTE: Unencrypted ESP if [[ "${multibooting}" == "n" ]]; then if mkfs.fat -F 32 -n ESP "${esp_dev}" > "${void}" 2> "${log}" ; then mount --mkdir "${esp_dev}" "${esp_mount}" > "${void}" 2> "${log}" || err_abort - sleep 0.2 - NC " - -==> [${green}/ESP OK${nc}] - " + local prompt="/ESP" + ok + echo else do_umount until luks; do : ; done fi elif [[ "${multibooting}" == "y" && "${espfs}" == "vfat" ]]; then if mount --mkdir "${esp_dev}" "${esp_mount}" > "${void}" 2> "${log}" ; then - sleep 0.2 - NC " - -==> [${green}Unformatted /ESP Mounted OK${nc}] - " + local prompt="Unformatted /ESP Mounted" + ok + echo else - line2 + printf "\n\n" err_try do_umount return 1 @@ -6057,143 +3565,83 @@ ${magenta}###${nc}-------------------------------------${magenta}[ ${bwhite}LUKS elif [[ "${multibooting}" == "y" && "${espfs}" != "vfat" ]]; then if mkfs.fat -F 32 -n ESP "${esp_dev}" > "${void}" 2> "${log}" ; then mount --mkdir "${esp_dev}" "${esp_mount}" > "${void}" 2> "${log}" || err_abort - sleep 0.2 - NC " - -==> [${green}/ESP OK${nc}] - " + local prompt="/ESP" + ok + echo else do_umount until luks; do : ; done fi fi -#-------------------------------------------------------------------------------------------------- + # NOTE: XBOOTLDR if [[ "${xbootloader}" == "yes" ]] ; then if mkfs.fat -F 32 -n XBOOTLDR "${xboot_dev}" > "${void}" 2> "${log}" ; then mount --mkdir "${xboot_dev}" /mnt/boot > "${void}" 2> "${log}" || err_abort sleep 0.2 - NC " -==> [${green}/XBOOTLDR OK${nc}] - " + NC "\n==> [${green}/XBOOTLDR OK${nc}]\n" else - line2 + printf "\n\n" err_try do_umount return 1 fi fi -#-------------------------------------------------------------------------------------------------- sleep 0.2 - NC " -==> [${green}Encryption Completed OK${nc}]" + NC "\n==> [${green}Encryption Completed OK${nc}]" luks_encrypt="ok" - sleep 0.2 - NC " - -==> [${green}Filesystems OK${nc}] - " + local prompt="Filesystems" + ok keypress blkid > "${void}" 2> "${log}" - sleep 0.2 - CYAN " -###${nc}---------------------------------------------${cyan}[ ${bwhite}FILESYSTEM OVERVIEW ${nc}${cyan}]${nc}---------------------------------------------${cyan}### - - " - lsblk -f|GREP_COLORS='mt=01;36' grep -E --color=always 'vfat|$'|GREP_COLORS='mt=01;32' grep -E --color=always 'ext4|$'|GREP_COLORS='mt=01;35' grep -E --color=always 'btrfs|$'|GREP_COLORS='mt=01;31' grep -E --color=always 'ntfs|$'|GREP_COLORS='mt=01;33' grep -E --color=always 'swap|$' - CYAN " - -###${nc}-----------------------------------------------------------------------------------------------------------------${cyan}### - " - sleep 0.2 + filesystem_overview } -################################################################################################### opt_pcmn() { - - local prompt="PacMan" - sleep 0.2 - NC " - - -${magenta}###${nc}-----------------------------------${magenta}[ ${bwhite}Pacman Optimization${nc} ${magenta}]${nc}-----------------------------------${magenta}### - " - YELLOW " - - > Select a Country for your Arch Mirrors: - - - - ### [Enter ${nc}'l' ${yellow}to list Countries, then ${nc}'enter' ${yellow}to search or ${nc}'q' ${yellow}to quit] " - BLUE " - - -Enter country name or country code ${bwhite}(Empty for Defaults)${blue}: " - read -r -p " -==> " COUNTRY - echo - + title "Pacman Optimization" + ask "Select a Country for your Arch Mirrors" + ack "[Enter ${nc}'l' ${yellow}to list Countries, then ${nc}'enter' ${yellow}to search or ${nc}'q' ${yellow}to quit]" + get "Enter country name or country code ${bwhite}(Empty for Defaults)" + read -r -p "==> " COUNTRY COUNTRY="${COUNTRY^^}" - if [[ -z "${COUNTRY}" ]] ; then - sleep 0.2 - NC " - -==> [${green}Default Mirrors OK${nc}] " + local prompt="Default Mirrors" + ok elif [[ "${COUNTRY}" == "l" ]]; then reflector --list-countries | less return 1 elif [[ -n "${COUNTRY}" ]]; then - line2 + printf "\n\n" if reflector --verbose -c "${COUNTRY}" -l 10 -p https -f 10 --sort rate --save /etc/pacman.d/mirrorlist ; then - sleep 0.2 - NC " - -==> [${green}${COUNTRY}'s Mirrors OK${nc}] " + local prompt="${COUNTRY}'s Mirrors" + ok else err_try return 1 fi fi - YELLOW " - - - - > Enable Arch's 'Multilib' repository in the installed system ? [y/N] " - BLUE " - - -Enter [y/N]: " - read -r -p " -==> " multilib - - echo + ask "Enable Arch's 'Multilib' repository in the installed system ? [y/N]" + get "Enter [y/N]" + read -r -p "==> " multilib multilib="${multilib:-n}" multilib="${multilib,,}" - if [[ "${multilib}" == "y" ]]; then - sleep 0.2 - NC " - -==> [${green}Multilib repository OK${nc}]" + local prompt="Multilib repository" + ok elif [[ "${multilib}" == "n" ]]; then skip else y_n return 1 fi + local prompt="Pacman Optimization" ok } -################################################################################################### pkg_collection() { - gfxpkgs_set - if [[ "${bootloader}" == "2" ]]; then [[ "${fs}" == "1" ]] && bootldr_pkgs="grub os-prober" [[ "${fs}" == "2" ]] && bootldr_pkgs="grub-btrfs inotify-tools os-prober" fi - basepkgs=(base efibootmgr nano networkmanager pkgstats sudo vim "${fstools}" "${kernel}" "${microcode}" "${shell_pkgs}") - [[ -n "${shell}" ]] && basepkgs+=("${shell}") [[ -n "${nrg_plc}" ]] && basepkgs+=("${nrg_plc}") [[ -n "${bootldr_pkgs}" ]] && basepkgs+=("${bootldr_pkgs}") @@ -6210,55 +3658,41 @@ pkg_collection() { [[ "${nvidiaprop}" == "y" ]] && basepkgs+=("${kernel}-headers") [[ "${session_support}" == "y" ]] && basepkgs+=("${alt_session_pack}") [[ ! "${desktop}" =~ ^(11|12)$ ]] && basepkgs+=(7zip alsa-plugins alsa-utils bluez bluez-hid2hci bluez-obex bluez-utils exfatprogs git glibc-locales gst-libav gst-plugin-libcamera gst-plugin-pipewire gst-plugins-bad gst-plugins-good gst-plugins-ugly libfido2 man-db man-pages mesa-utils nano-syntax-highlighting pacman-contrib pipewire-alsa pipewire-libcamera pipewire-onnx pipewire-pulse pipewire-zeroconf reflector usb_modeswitch xdg-user-dirs) - case "${desktop}" in - 1) # Plasma Desktop: deskpkgs="${basepkgs[*]} dolphin-plugins konsole plasma qt6-multimedia-gstreamer" displaymanager="plasmalogin" ;; - 2) # Plasma Lite Desktop: deskpkgs="${basepkgs[*]} ark bluedevil breeze-gtk colord-kde dolphin-plugins flatpak-kcm freerdp kate kcalc kclock kde-gtk-config kde-inotify-survey kdegraphics-mobipocket kdegraphics-thumbnailers kdenetwork-filesharing kdeplasma-addons kdf kdialog keditbookmarks kimageformats kio-admin kio-gdrive kio-zeroconf konsole krdc krfb kscreen kwayland-integration kwrited okular purpose ocean-sound-theme packagekit-qt6 partitionmanager plasma5-integration plasma-browser-integration plasma-desktop plasma-disks plasma-firewall plasma-keyboard plasma-login-manager plasma-nm plasma-pa plasma-systemmonitor plasma-wayland-protocols spectacle appmenu-gtk-module arj dosfstools ffmpegthumbs icoutils kvantum libappimage libappindicator lrzip lzop ntfs-3g power-profiles-daemon qrca qt5-xmlpatterns qt6-connectivity qt6-multimedia-gstreamer unarchiver unrar xdg-desktop-portal-gtk" displaymanager="plasmalogin" ;; - 3) # Gnome Desktop: deskpkgs="${basepkgs[*]} gnome" displaymanager="gdm" ;; - 4) # Gnome Lite Desktop: deskpkgs="${basepkgs[*]} dconf-editor file-roller gdm gnome-browser-connector gnome-calculator gnome-clocks gnome-console gnome-control-center gnome-disk-utility gnome-keyring gnome-menus gnome-shell-extensions gnome-system-monitor gnome-text-editor gnome-tweaks gnome-user-share gvfs gvfs-afc gvfs-mtp gvfs-smb loupe papers sushi dosfstools glib2-devel gparted ntfs-3g power-profiles-daemon unrar unzip xorg-xhost zip" displaymanager="gdm" ;; - 5) # Xfce Desktop: deskpkgs="${basepkgs[*]} blueman catfish ffmpegthumbnailer gvfs gvfs-afc gvfs-mtp gvfs-smb libgsf libopenraw lightdm-gtk-greeter lightdm-gtk-greeter-settings mousepad mugshot network-manager-applet pavucontrol poppler-glib ristretto thunar-archive-plugin thunar-media-tags-plugin thunar-shares-plugin xfce4 xfce4-artwork xfce4-battery-plugin xfce4-clipman-plugin xfce4-datetime-plugin xfce4-indicator-plugin xfce4-mount-plugin xfce4-notifyd xfce4-power-manager xfce4-pulseaudio-plugin xfce4-screensaver xfce4-screenshooter xfce4-taskmanager xfce4-whiskermenu-plugin xfce4-power-manager xiccd" displaymanager="lightdm" ;; - 6) # Cinnamon Desktop: deskpkgs="${basepkgs[*]} blueman cinnamon cinnamon-translations ffmpegthumbnailer gnome-color-manager gnome-keyring gnome-screenshot lightdm-slick-greeter touchegg wget xed xreader" displaymanager="lightdm" ;; - 7) # Deepin Desktop: deskpkgs="${basepkgs[*]} adobe-source-han-sans-otc-fonts deepin deepin-calculator deepin-camera deepin-clipboard deepin-community-wallpapers deepin-compressor deepin-device-formatter deepin-editor deepin-font-manager deepin-grand-search deepin-kwin deepin-movie deepin-printer deepin-screensaver deepin-screensaver-pp deepin-screen-recorder deepin-shortcut-viewer deepin-terminal iw proxychains-ng qt6-multimedia-gstreamer redshift zssh" displaymanager="lightdm" ;; - 8) # Budgie Desktop: deskpkgs="${basepkgs[*]} blueman budgie gnome-user-share lightdm-gtk-greeter lightdm-gtk-greeter-settings nemo network-manager-applet openssh power-profiles-daemon rygel xdg-user-dirs" displaymanager="lightdm" ;; - 9) # Lxqt Desktop: deskpkgs="${basepkgs[*]} blueman breeze-icons gvfs gvfs-mtp kimageformats libarchive libstatgrab libsysstat lxqt network-manager-applet oxygen-icons python-pyxdg qt6-imageformats qt6-multimedia-gstreamer sddm xorg-xrdb xscreensaver xsettingsd" displaymanager="sddm" ;; - 10) # Mate Desktop: deskpkgs="${basepkgs[*]} atril blueman caja-actions caja-audio-video-properties caja-open-terminal caja-sendto caja-share caja-wallpaper cpio engrampa eom gnome-keyring lightdm-gtk-greeter lightdm-gtk-greeter-settings mate mate-applets mate-calc mate-icon-theme-faenza mate-media mate-netbook mate-power-manager mate-screensaver mate-system-monitor mate-terminal mate-user-share mate-utils mozo network-manager-applet pluma python-gobject unace unrar webp-pixbuf-loader xdg-user-dirs-gtk" displaymanager="lightdm" ;; - 11) # Base System: deskpkgs="${basepkgs[*]}" ;; - 12) # Custom System: custarray=(base sudo "${custompkgs}" "${fstools}" "${kernel}" "${microcode}") - [[ -n "${shell}" ]] && custarray+=("${shell}") [[ -n "${bootldr_pkgs}" ]] && custarray+=("${bootldr_pkgs}") [[ -n "${ukify}" ]] && custarray+=("${ukify}") @@ -6269,37 +3703,25 @@ pkg_collection() { [[ "${vendor}" == "Virtual Machine" ]] && custarray+=("${vmpkgs}") [[ "${vendor}" != "Virtual Machine" ]] && custarray+=(linux-firmware) [[ "${nvidiaprop}" == "y" ]] && custarray+=("${kernel}-headers") - [[ "${greeternmbr}" =~ ^(1|2|3|4)$ ]] && custarray+=("${greeter}") - deskpkgs="${custarray[*]}" ;; - 13) # Cosmic Desktop: deskpkgs="${basepkgs[*]} cosmic dconf gnome-keyring gvfs gvfs-dnssd gvfs-nfs gvfs-smb packagekit power-profiles-daemon pulseaudio-alsa" displaymanager="cosmic-greeter" ;; - 14) # Pantheon Desktop: deskpkgs="${basepkgs[*]} pantheon pantheon-print sound-theme-elementary" displaymanager="lightdm" ;; esac } -################################################################################################### pkg_validation() { - local prompt="Arch Packages Validation" local stage_prompt="Arch Packages Validation" sleep 0.2 - YELLOWL " - ------------------------------------------ - ### ${bwhite}Validating Installation Packages ${yellowl}### - ------------------------------------------ - - - " + YELLOWL "\n ------------------------------------------\n ### ${bwhite}Validating Installation Packages ${yellowl}###\n ------------------------------------------\n\n" validpkgs+=("${deskpkgs}") echo "${validpkgs[*]}" keypress valids="${validpkgs[*]}" - line2 + printf "\n\n" if pacman -Syy > "${void}" 2>&1 2> "${log}" && pacman -Spd ${valids} > "${void}" 2>&1 2> "${log}"; then ok if [[ -n "${web_aur}" ]]; then @@ -6329,44 +3751,25 @@ pkg_validation() { err_try return 1 fi - if [[ "${encrypt}" == "no" ]]; then until confirm_status; do : ; done elif [[ "${encrypt}" == "yes" ]]; then keypress fi } -################################################################################################### pacstrap_system() { - - sleep 0.2 - NC " - - -${magenta}###${nc}-------------------------------------${magenta}[ ${bwhite}Pacstrap System${nc} ${magenta}]${nc}-------------------------------------${magenta}### - " + local prompt="Pacstrap System" + title "${prompt}" installing pkg_collection pkg_validation if pacstrap -K /mnt ${deskpkgs} 2> "${log}" ; then if [[ -n "${nvidia_aur}" ]]; then - YELLOWL " - - - - --------------------------------------- - ### ${nc}Building ${bwhite}Nvidia-580xx ${nc}Drivers ${yellowl}### - ---------------------------------------${nc} - - - ... Please Wait ... - - - " + YELLOWL "\n\n\n ---------------------------------------\n ### ${nc}Building ${bwhite}Nvidia-580xx ${nc}Drivers ${yellowl}###\n ---------------------------------------${nc}\n ... Please Wait ...\n\n\n" if [[ "${dev}" != "y" ]]; then local stage_prompt="Base-devel Package Installation" if arch-chroot /mnt <<-BASE_DEVEL > "${void}" 2>&1 2> "${log}" ; then - pacman -S --noconfirm base-devel || exit + pacman -S --noconfirm base-devel BASE_DEVEL stage_ok else @@ -6376,7 +3779,7 @@ BASE_DEVEL if [[ "${desktop}" =~ ^(11|12)$ ]]; then local stage_prompt="Git Package Installation" if arch-chroot /mnt <<-GIT > "${void}" 2>&1 2> "${log}" ; then - pacman -S --noconfirm git || exit + pacman -S --noconfirm git GIT stage_ok else @@ -6385,50 +3788,40 @@ GIT fi local stage_prompt="AUR Nvidia Packages Installation" if arch-chroot /mnt <<-AUR_NVIDIA_PKGS > "${void}" 2>&1 2> "${log}" ; then - sed -i 's|if (( EUID == 0 )); then|if (( EUID != 0 )); then|g' /usr/bin/makepkg || exit - git clone --branch nvidia-580xx-utils --single-branch https://github.com/archlinux/aur.git nvidia-580xx-utils && cd nvidia-580xx-utils && makepkg -s --noconfirm && sudo pacman -U --noconfirm *x86_64.pkg.tar.zst && cd .. && rm -rf nvidia-580xx-utils || exit - git clone --branch nvidia-580xx-settings --single-branch https://github.com/archlinux/aur.git nvidia-580xx-settings && cd nvidia-580xx-settings && makepkg -s --noconfirm && sudo pacman -U --noconfirm *x86_64.pkg.tar.zst && cd .. && rm -rf nvidia-580xx-settings || exit - sed -i 's|if (( EUID != 0 )); then|if (( EUID == 0 )); then|g' /usr/bin/makepkg || exit + sed -i 's|if (( EUID == 0 )); then|if (( EUID != 0 )); then|g' /usr/bin/makepkg + git clone --branch nvidia-580xx-utils --single-branch https://github.com/archlinux/aur.git nvidia-580xx-utils && cd nvidia-580xx-utils && makepkg -s --noconfirm && sudo pacman -U --noconfirm *x86_64.pkg.tar.zst && cd .. && rm -rf nvidia-580xx-utils + git clone --branch nvidia-580xx-settings --single-branch https://github.com/archlinux/aur.git nvidia-580xx-settings && cd nvidia-580xx-settings && makepkg -s --noconfirm && sudo pacman -U --noconfirm *x86_64.pkg.tar.zst && cd .. && rm -rf nvidia-580xx-settings + sed -i 's|if (( EUID != 0 )); then|if (( EUID == 0 )); then|g' /usr/bin/makepkg AUR_NVIDIA_PKGS stage_ok else stage_fail fi fi - local prompt="Pacstrap System" ok else local stage_prompt="Pacstrap System" stage_fail fi - if [[ "${fs}" == "2" ]]; then local prompt="Fstab" local stage_prompt="Fstab" genfstab -t PARTUUID /mnt >> /mnt/etc/fstab 2> "${log}" || stage_fail arch-chroot /mnt <<-FSTAB_SBVL_MNT_OPTS > "${void}" 2>&1 2> "${log}" || stage_fail - sed -i 's/^rw.*/${sbvl_mnt_opts}/' /etc/fstab || exit + sed -i 's/^rw.*/${sbvl_mnt_opts}/' /etc/fstab FSTAB_SBVL_MNT_OPTS ok fi - if [[ "${swapmode}" != "2" ]]; then - line2 + printf "\n\n" fi } -################################################################################################### swapfile() { - - local prompt="Swapfile Creation" - local stage_prompt="Swapfile Creation" - sleep 0.2 - NC " - - -${magenta}###${nc}-------------------------------------${magenta}[ ${bwhite}Swapfile Setup${nc} ${magenta}]${nc}-------------------------------------${magenta}### - " + local prompt="Swapfile Setup" + local stage_prompt="Swapfile Setup" + title "${prompt}" if arch-chroot /mnt <<-SWAPFILE > "${void}" 2>&1 2> "${log}" ; then - mkswap -U clear --size ${swapsize}G --file /swapfile || exit + mkswap -U clear --size ${swapsize}G --file /swapfile SWAPFILE cat >> /mnt/etc/fstab <<-FSTAB || err_abort /swapfile none swap defaults 0 0 @@ -6438,19 +3831,12 @@ FSTAB stage_fail fi } -################################################################################################### swapfile_btrfs() { - - local prompt="Btrfs Swapfile Creation" - local stage_prompt="Btrfs Swapfile Creation" - sleep 0.2 - NC " - - -${magenta}###${nc}----------------------------------${magenta}[ ${bwhite}Btrfs Swapfile Setup${nc} ${magenta}]${nc}----------------------------------${magenta}### - " + local prompt="Btrfs Swapfile Setup" + local stage_prompt="Btrfs Swapfile Setup" + title "${prompt}" if arch-chroot /mnt <<-SWAPFILE_BTRFS > "${void}" 2>&1 2> "${log}" ; then - btrfs filesystem mkswapfile --size ${swapsize}g --uuid clear /swap/swapfile || exit + btrfs filesystem mkswapfile --size ${swapsize}g --uuid clear /swap/swapfile SWAPFILE_BTRFS cat >> /mnt/etc/fstab <<-FSTAB || err_abort /swap/swapfile none swap defaults 0 0 @@ -6460,73 +3846,62 @@ FSTAB stage_fail fi } -################################################################################################### set_wireless_regdom() { - local prompt="Wireless Regulatory Domain" local stage_prompt="Wireless Regulatory Domain" - sleep 0.2 - NC " - - -${magenta}###${nc}--------------------------${magenta}[ ${bwhite}Setting Up Wireless Regulatory Domain${nc} ${magenta}]${nc}--------------------------${magenta}### - " + title "Setting Up Wireless Regulatory Domain" if sed -i "/^#WIRELESS_REGDOM=\"${REGDOM}\"/s/^#//" /mnt/etc/conf.d/wireless-regdom ; then ok else stage_fail fi } -################################################################################################### main_chroot() { - local stage_prompt="Base System Configuration" if arch-chroot /mnt <<-CONF > "${void}" 2>&1 2> "${log}" ; 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 - cat <<-MKINITCPIO > /etc/mkinitcpio.conf.d/mkinitcpiod.conf || exit + sed -i "/^#${SETLOCALE}/s/^#//" /etc/locale.gen + locale-gen + echo LANG=${SETLOCALE} > /etc/locale.conf + export LANG=${SETLOCALE} + echo KEYMAP=${SETKBD} > /etc/vconsole.conf + cat <<-MKINITCPIO > /etc/mkinitcpio.conf.d/mkinitcpiod.conf ${mkinitcpio_mods} ${mkinitcpio_bins} ${mkinitcpio_hooks} MKINITCPIO - 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 - cat <<-HOSTS > /etc/hosts || exit + mkinitcpio -P + ln -sf /usr/share/zoneinfo/$(curl -s http://ip-api.com/line?fields=timezone) /etc/localtime + hwclock --systohc + echo ${HOSTNAME} > /etc/hostname + cat <<-HOSTS > /etc/hosts 127.0.0.1 localhost ::1 localhost 127.0.1.1 ${HOSTNAME}.localdomain ${HOSTNAME} HOSTS - echo root:${ROOTPASSWD2} | chpasswd || exit - chsh -s /bin/${shellname} || exit - useradd -m -G wheel -s /bin/${shellname} ${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 + echo root:${ROOTPASSWD2} | chpasswd + chsh -s /bin/${shellname} + useradd -m -G wheel -s /bin/${shellname} ${USERNAME} + echo ${USERNAME}:${USERPASSWD2} | chpasswd + echo "%wheel ALL=(ALL) ALL" | tee /etc/sudoers.d/sudoersd + visudo -c /etc/sudoers.d/sudoersd CONF stage_ok else stage_fail fi } -################################################################################################### btldrcfg() { - if [[ "${bootloader}" == "1" ]]; then local stage_prompt="Systemd-boot Configuration" if [[ "${xbootloader}" == "no" ]]; then if arch-chroot -S /mnt <<-SDBOOT_INSTL > "${void}" 2>&1 2> "${log}" ; then - bootctl install || exit - cat <<-LOADER_CFG > ${btldr_esp_mount}/loader/loader.conf || exit + bootctl install + cat <<-LOADER_CFG > ${btldr_esp_mount}/loader/loader.conf timeout 3 console-mode auto editor no LOADER_CFG - systemctl enable systemd-boot-update || exit + systemctl enable systemd-boot-update SDBOOT_INSTL stage_ok else @@ -6534,20 +3909,20 @@ SDBOOT_INSTL fi elif [[ "${xbootloader}" == "yes" ]]; then if arch-chroot -S /mnt <<-SDBOOT_XBOOTLDR_INSTL > "${void}" 2>&1 2> "${log}" ; then - bootctl --esp-path=/efi --boot-path=/boot install || exit - cat <<-LOADER_CFG > ${btldr_esp_mount}/loader/loader.conf || exit + bootctl --esp-path=/efi --boot-path=/boot install + cat <<-LOADER_CFG > ${btldr_esp_mount}/loader/loader.conf default arch.conf timeout 3 console-mode auto editor no LOADER_CFG - cat <<-ENTRY_CFG > /boot/loader/entries/arch.conf || exit + cat <<-ENTRY_CFG > /boot/loader/entries/arch.conf title Arch Linux linux /vmlinuz-${kernel} initrd /initramfs-${kernel}.img options rw ${boot_opts[*]} ENTRY_CFG - systemctl enable systemd-boot-update || exit + systemctl enable systemd-boot-update SDBOOT_XBOOTLDR_INSTL stage_ok else @@ -6557,8 +3932,8 @@ SDBOOT_XBOOTLDR_INSTL elif [[ "${bootloader}" == "2" ]]; then local stage_prompt="Grub Configuration" if arch-chroot /mnt <<-GRUB_CONF > "${void}" 2>&1 2> "${log}" ; then - cp /etc/default/grub /etc/default/grub.bak || exit - cat <<-CFG > /etc/default/grub || exit + cp /etc/default/grub /etc/default/grub.bak + cat <<-CFG > /etc/default/grub GRUB_DEFAULT=0 GRUB_TIMEOUT=5 GRUB_DISTRIBUTOR="Arch" @@ -6578,13 +3953,12 @@ GRUB_CONF else stage_fail fi - local stage_prompt="Grub Installation" if [[ "${sb_sign}" == "y" && "${path}" == "1" ]]; then if arch-chroot /mnt <<-SB_GRUB_INSTL > "${void}" 2>&1 2> "${log}" ; then - grub-install --target=${uefimode} --efi-directory=${btldr_esp_mount} --bootloader-id=GRUB --modules="tpm" --disable-shim-lock --recheck || exit - sed -i 's/SecureBoot/SecureB00t/' ${btldr_esp_mount}/EFI/GRUB/grubx${bitness}.efi || exit - grub-mkconfig -o /boot/grub/grub.cfg || exit + grub-install --target=${uefimode} --efi-directory=${btldr_esp_mount} --bootloader-id=GRUB --modules="tpm" --disable-shim-lock --recheck + sed -i 's/SecureBoot/SecureB00t/' ${btldr_esp_mount}/EFI/GRUB/grubx${bitness}.efi + grub-mkconfig -o /boot/grub/grub.cfg SB_GRUB_INSTL stage_ok else @@ -6592,9 +3966,9 @@ SB_GRUB_INSTL fi elif [[ "${sb_sign}" == "y" && "${path}" == "2" ]]; then if arch-chroot /mnt <<-SB_GRUB_INSTL_RMV > "${void}" 2>&1 2> "${log}" ; then - grub-install --target=${uefimode} --efi-directory=${btldr_esp_mount} --bootloader-id=GRUB --removable --modules="tpm" --disable-shim-lock --recheck || exit - sed -i 's/SecureBoot/SecureB00t/' ${btldr_esp_mount}/EFI/BOOT/${efiname}.EFI || exit - grub-mkconfig -o /boot/grub/grub.cfg || exit + grub-install --target=${uefimode} --efi-directory=${btldr_esp_mount} --bootloader-id=GRUB --removable --modules="tpm" --disable-shim-lock --recheck + sed -i 's/SecureBoot/SecureB00t/' ${btldr_esp_mount}/EFI/BOOT/${efiname}.EFI + grub-mkconfig -o /boot/grub/grub.cfg SB_GRUB_INSTL_RMV stage_ok else @@ -6602,8 +3976,8 @@ SB_GRUB_INSTL_RMV fi elif [[ "${sb_sign}" == "n" && "${path}" == "1" ]]; then if arch-chroot /mnt <<-GRUB_INSTL > "${void}" 2>&1 2> "${log}" ; then - grub-install --target=${uefimode} --efi-directory=${btldr_esp_mount} --bootloader-id=GRUB --recheck || exit - grub-mkconfig -o /boot/grub/grub.cfg || exit + grub-install --target=${uefimode} --efi-directory=${btldr_esp_mount} --bootloader-id=GRUB --recheck + grub-mkconfig -o /boot/grub/grub.cfg GRUB_INSTL stage_ok else @@ -6611,31 +3985,29 @@ GRUB_INSTL fi elif [[ "${sb_sign}" == "n" && "${path}" == "2" ]]; then if arch-chroot /mnt <<-GRUB_INSTL_RMV > "${void}" 2>&1 2> "${log}" ; then - grub-install --target=${uefimode} --efi-directory=${btldr_esp_mount} --bootloader-id=GRUB --removable --recheck || exit - grub-mkconfig -o /boot/grub/grub.cfg || exit + grub-install --target=${uefimode} --efi-directory=${btldr_esp_mount} --bootloader-id=GRUB --removable --recheck + grub-mkconfig -o /boot/grub/grub.cfg GRUB_INSTL_RMV stage_ok else stage_fail fi fi - if [[ "${fs}" == "2" ]]; then local stage_prompt="Grub-Btrfsd Service Activation" if arch-chroot /mnt <<-GRUB_BTRFSD > "${void}" 2>&1 2> "${log}" ; then - systemctl enable grub-btrfsd || exit + systemctl enable grub-btrfsd GRUB_BTRFSD stage_ok else stage_fail fi fi - if [[ "${nvidiaprop}" == "y" ]]; then local stage_prompt="Grub/Nvidia Configuration" if arch-chroot /mnt <<-NVIDIA_GRUB > "${void}" 2>&1 2> "${log}" ; then - sed -i "/^#GRUB_TERMINAL_OUTPUT=console/s/^#//" /etc/default/grub || exit - grub-mkconfig -o /boot/grub/grub.cfg || exit + sed -i "/^#GRUB_TERMINAL_OUTPUT=console/s/^#//" /etc/default/grub + grub-mkconfig -o /boot/grub/grub.cfg NVIDIA_GRUB stage_ok else @@ -6644,13 +4016,11 @@ NVIDIA_GRUB fi fi } -################################################################################################### trimcfg() { - if [[ -n "${trim}" ]]; then local stage_prompt="Trim Service Activation" if arch-chroot /mnt <<-TRIM > "${void}" 2>&1 2> "${log}" ; then - systemctl enable ${trim} || exit + systemctl enable ${trim} TRIM stage_ok else @@ -6658,13 +4028,11 @@ TRIM fi fi } -################################################################################################### vm_serv() { - if [[ -n "${vm_services}" ]]; then local stage_prompt="VM Service(s) Activation" if arch-chroot /mnt <<-VM_SRVC > "${void}" 2>&1 2> "${log}" ; then - systemctl enable ${vm_services} || exit + systemctl enable ${vm_services} VM_SRVC stage_ok else @@ -6672,27 +4040,25 @@ VM_SRVC fi fi } -################################################################################################### zramcfg() { - if [[ -n "${zram}" ]]; then local stage_prompt="Zram Swap Activation" zram_service="systemd-zram-setup@zram0.service" if arch-chroot /mnt <<-ZRAM_CONF > "${void}" 2>&1 2> "${log}" ; then - mkdir -p /etc/systemd/zram-generator.conf.d || exit - cat <<-ZRAM_GEN > /etc/systemd/zram-generator.conf.d/zram.conf || exit + mkdir -p /etc/systemd/zram-generator.conf.d + cat <<-ZRAM_GEN > /etc/systemd/zram-generator.conf.d/zram.conf [zram0] zram-size = ram / 2 compression-algorithm = zstd ZRAM_GEN - cat <<-ZRAM_VM > /etc/sysctl.d/99-vm-zram-parameters.conf || exit + cat <<-ZRAM_VM > /etc/sysctl.d/99-vm-zram-parameters.conf vm.swappiness = 180 vm.watermark_boost_factor = 0 vm.watermark_scale_factor = 125 vm.page-cluster = 0 ZRAM_VM - systemctl daemon-reload || exit - systemctl start ${zram_service} || exit + systemctl daemon-reload + systemctl start ${zram_service} ZRAM_CONF stage_ok else @@ -6700,14 +4066,12 @@ ZRAM_CONF fi fi } -################################################################################################### nvidia_hook() { - if [[ "${nvidiaprop}" == "y" && -n "${nvname}" ]]; then local stage_prompt="Nvidia Hook Creation" if arch-chroot /mnt <<-NVIDIA_HOOK > "${void}" 2>&1 2> "${log}" ; then - mkdir -p /etc/pacman.d/hooks/ || exit - cat <<-HOOK > /etc/pacman.d/hooks/nvidia.hook || exit + mkdir -p /etc/pacman.d/hooks/ + cat <<-HOOK > /etc/pacman.d/hooks/nvidia.hook [Trigger] Operation=Install Operation=Upgrade @@ -6730,53 +4094,45 @@ NVIDIA_HOOK fi fi } -################################################################################################### mkinitcpio_preset() { - local stage_prompt="Mkinitcpio Kernel Presets Configuration" - if [[ "${uki}" == "y" ]]; then if [[ ! -e "${esp_mount}"/EFI/Linux ]]; then - mkdir -p "${esp_mount}"/EFI/Linux || exit + mkdir -p "${esp_mount}"/EFI/Linux fi if arch-chroot /mnt <<-UKI > "${void}" 2>&1 2> "${log}" ; then - mkdir /etc/cmdline.d || exit - echo "rw ${boot_opts[*]}" | tee /etc/cmdline.d/cmdlined.conf || exit - cp /etc/mkinitcpio.d/${kernel}.preset /etc/mkinitcpio.d/${kernel}.preset.bak || exit - cat <<-MKINITCPIO_PRESET > /etc/mkinitcpio.d/${kernel}.preset || exit + mkdir /etc/cmdline.d + echo "rw ${boot_opts[*]}" | tee /etc/cmdline.d/cmdlined.conf + cp /etc/mkinitcpio.d/${kernel}.preset /etc/mkinitcpio.d/${kernel}.preset.bak + cat <<-MKINITCPIO_PRESET > /etc/mkinitcpio.d/${kernel}.preset # mkinitcpio preset file for the '${kernel}' package - ALL_config="/etc/mkinitcpio.conf.d/mkinitcpiod.conf" ALL_kver="/boot/vmlinuz-${kernel}" PRESETS=('default') default_uki="${btldr_esp_mount}/EFI/Linux/arch-${kernel}.efi" MKINITCPIO_PRESET - mkinitcpio -P || exit + mkinitcpio -P UKI stage_ok else stage_fail fi - - if [[ -e /mnt/boot/initramfs-"${kernel}".img ]]; then - rm /mnt/boot/initramfs-"${kernel}".img || exit - fi - if [[ -e /mnt/boot/initramfs-"${kernel}"-fallback.img ]]; then - rm /mnt/boot/initramfs-"${kernel}"-fallback.img || exit - fi - + for file in /mnt/boot/*.img; do + if [ -f "$file" ]; then + rm "$file" + fi + done elif [[ "${uki}" == "n" ]]; then if arch-chroot /mnt <<-NO_UKI > "${void}" 2>&1 2> "${log}" ; then - cp /etc/mkinitcpio.d/${kernel}.preset /etc/mkinitcpio.d/${kernel}.preset.bak || exit - cat <<-MKINITCPIO_PRESET > /etc/mkinitcpio.d/${kernel}.preset || exit + cp /etc/mkinitcpio.d/${kernel}.preset /etc/mkinitcpio.d/${kernel}.preset.bak + cat <<-MKINITCPIO_PRESET > /etc/mkinitcpio.d/${kernel}.preset # mkinitcpio preset file for the '${kernel}' package - ALL_config="/etc/mkinitcpio.conf.d/mkinitcpiod.conf" ALL_kver="/boot/vmlinuz-${kernel}" PRESETS=('default') default_image="/boot/initramfs-${kernel}.img" MKINITCPIO_PRESET - mkinitcpio -P || exit + mkinitcpio -P NO_UKI stage_ok else @@ -6784,17 +4140,14 @@ NO_UKI fi fi } -################################################################################################### var_opts() { - if [[ "${sb_sign}" == "y" && "${setrescue}" == "y" ]]; then local stage_prompt="Rescue Entry Creation" if [[ "${bootloader}" == "1" && "${uki}" == "y" ]]; then if arch-chroot /mnt <<-SDBOOT_RESCUE_ENTRY > "${void}" 2>&1 2> "${log}" ; then - echo "systemd.unit=rescue.target rw ${boot_opts[*]}" | tee /etc/cmdline.d/rescued.conf || exit - cat <<-MKINITCPIO_PRESET > /etc/mkinitcpio.d/${kernel}.preset || exit + echo "systemd.unit=rescue.target rw ${boot_opts[*]}" | tee /etc/cmdline.d/rescued.conf + cat <<-MKINITCPIO_PRESET > /etc/mkinitcpio.d/${kernel}.preset # mkinitcpio preset file for the '${kernel}' package - ALL_config="/etc/mkinitcpio.conf.d/mkinitcpiod.conf" ALL_kver="/boot/vmlinuz-${kernel}" PRESETS=('default' 'rescue') @@ -6803,7 +4156,7 @@ var_opts() { rescue_uki="${btldr_esp_mount}/EFI/Linux/rescue.efi" rescue_options="--cmdline /etc/cmdline.d/rescued.conf" MKINITCPIO_PRESET - mkinitcpio -P || exit + mkinitcpio -P SDBOOT_RESCUE_ENTRY stage_ok else @@ -6811,7 +4164,7 @@ SDBOOT_RESCUE_ENTRY fi elif [[ "${bootloader}" == "1" && "${uki}" == "n" ]]; then if arch-chroot /mnt <<-SDBOOT_XBOOTLDR_RESCUE_ENTRY > "${void}" 2>&1 2> "${log}" ; then - cat <<-XBOOTLDR_RESCUE_CONF > /boot/loader/entries/rescue.conf || exit + cat <<-XBOOTLDR_RESCUE_CONF > /boot/loader/entries/rescue.conf title Arch Rescue linux /vmlinuz-${kernel} initrd /initramfs-${kernel}.img @@ -6825,9 +4178,9 @@ SDBOOT_XBOOTLDR_RESCUE_ENTRY elif [[ "${bootloader}" == "2" ]]; then if arch-chroot /mnt <<-GRUB_RESCUE_ENTRY > "${void}" 2>&1 2> "${log}" ; then touch /boot/grub/custom.cfg - grep -E -A 11 "'Arch Linux'" /boot/grub/grub.cfg > /boot/grub/custom.cfg || exit - sed -i 's/Arch Linux/Rescue Environment/' /boot/grub/custom.cfg || exit - sed -i '/vmlinuz/ s/$/ systemd.unit=rescue.target/' /boot/grub/custom.cfg || exit + grep -E -A 11 "'Arch Linux'" /boot/grub/grub.cfg > /boot/grub/custom.cfg + sed -i 's/Arch Linux/Rescue Environment/' /boot/grub/custom.cfg + sed -i '/vmlinuz/ s/$/ systemd.unit=rescue.target/' /boot/grub/custom.cfg GRUB_RESCUE_ENTRY stage_ok else @@ -6835,23 +4188,21 @@ GRUB_RESCUE_ENTRY fi fi fi - if [[ "${multilib}" == "y" ]]; then local stage_prompt="Multilib Configuration" if arch-chroot /mnt <<-MULTILIB > "${void}" 2>&1 2> "${log}" ; then - sed -i "/\[multilib\]/,/Include/"'s/^#//' /etc/pacman.conf || exit - pacman -Syy || exit + sed -i "/\[multilib\]/,/Include/"'s/^#//' /etc/pacman.conf + pacman -Syy MULTILIB stage_ok else stage_fail fi fi - if [[ "${CPU}" == *"GenuineIntel"* && "${kill_watchdog}" == "y" ]]; then local stage_prompt="Intel Watchdog Configuration" if arch-chroot /mnt <<-INTEL_WATCHDOG > "${void}" 2>&1 2> "${log}" ; then - echo "blacklist iTCO_wdt" | tee /etc/modprobe.d/blacklist.conf || exit + echo "blacklist iTCO_wdt" | tee /etc/modprobe.d/blacklist.conf INTEL_WATCHDOG stage_ok else @@ -6860,71 +4211,66 @@ INTEL_WATCHDOG elif [[ "${CPU}" == *"AuthenticAMD"* && "${kill_watchdog}" == "y" ]]; then local stage_prompt="AMD Watchdog Configuration" if arch-chroot /mnt <<-AMD_WATCHDOG > "${void}" 2>&1 2> "${log}" ; then - echo "blacklist sp5100_tco" | tee /etc/modprobe.d/blacklist.conf || exit + echo "blacklist sp5100_tco" | tee /etc/modprobe.d/blacklist.conf AMD_WATCHDOG stage_ok else stage_fail fi fi - if [[ "${oomd}" == "y" ]]; then local stage_prompt="Systemd-oomd Service Activation" if arch-chroot /mnt <<-OOMD > "${void}" 2>&1 2> "${log}" ; then - mkdir -p /etc/systemd/system.conf.d > "${void}" 2>&1 || exit - cat <<-OOMD_CONF > /etc/systemd/system.conf.d/00-oomd.conf || exit + mkdir -p /etc/systemd/system.conf.d > "${void}" 2>&1 + cat <<-OOMD_CONF > /etc/systemd/system.conf.d/00-oomd.conf [Manager] DefaultMemoryAccounting=yes OOMD_CONF - systemctl enable systemd-oomd || exit + systemctl enable systemd-oomd OOMD stage_ok else stage_fail fi fi - if [[ "${irqbalance}" == "y" ]]; then local stage_prompt="Irqbalance Service Activation" if arch-chroot /mnt <<-IRQBALANCE > "${void}" 2>&1 2> "${log}" ; then - pacman -S --noconfirm irqbalance || exit - systemctl enable irqbalance || exit + pacman -S --noconfirm irqbalance + systemctl enable irqbalance IRQBALANCE stage_ok else stage_fail fi fi - if [[ "${thermald}" == "y" ]]; then local stage_prompt="Thermald Service Activation" if arch-chroot /mnt <<-THERMALD > "${void}" 2>&1 2> "${log}" ; then - pacman -S --noconfirm thermald || exit - systemctl enable thermald || exit + pacman -S --noconfirm thermald + systemctl enable thermald THERMALD stage_ok else stage_fail fi fi - if [[ "${rngd}" == "y" ]]; then local stage_prompt="Rngd Service Activation" if arch-chroot /mnt <<-RNGD > "${void}" 2>&1 2> "${log}" ; then - pacman -S --noconfirm rng-tools || exit - systemctl enable rngd || exit + pacman -S --noconfirm rng-tools + systemctl enable rngd RNGD stage_ok else stage_fail fi fi - if [[ "${rtkit}" == "y" ]]; then local stage_prompt="Rtkit Service Activation" if arch-chroot /mnt <<-RTKIT > "${void}" 2>&1 2> "${log}" ; then - pacman -S --noconfirm realtime-privileges rtkit || exit - systemctl enable rtkit-daemon || exit + pacman -S --noconfirm realtime-privileges rtkit + systemctl enable rtkit-daemon usermod -aG realtime ${USERNAME} RTKIT stage_ok @@ -6932,37 +4278,34 @@ RTKIT stage_fail fi fi - if [[ "${tlp}" == "y" ]]; then local stage_prompt="Power-profiles-daemon Removal" if [[ -e usr/lib/power-profiles-daemon ]]; then if arch-chroot /mnt <<-PPD > "${void}" 2>&1 2> "${log}" ; then - pacman -Rns --noconfirm power-profiles-daemon || exit + pacman -Rns --noconfirm power-profiles-daemon PPD stage_ok else stage_fail fi fi - local stage_prompt="Tlp Service Activation" if arch-chroot /mnt <<-TLP > "${void}" 2>&1 2> "${log}" ; then - pacman -S --noconfirm tlp || exit + pacman -S --noconfirm tlp systemctl enable tlp - systemctl mask systemd-rfkill.service systemd-rfkill.socket || exit + systemctl mask systemd-rfkill.service systemd-rfkill.socket TLP stage_ok else stage_fail fi fi - if [[ "${printer}" == "y" ]]; then local stage_prompt="Print & Scan Services Activation" if arch-chroot /mnt <<-PRINT_CONF > "${void}" 2>&1 2> "${log}" ; then - systemctl enable avahi-daemon.socket cups.socket cups-browsed ipp-usb || exit - sed -i 's|^hosts.*|hosts: mymachines mdns_minimal resolve [!UNAVAIL=return] files myhostname dns|g' /etc/nsswitch.conf || exit - sed -i 's/ interface = [^ ]*/ interface = all/g' /etc/ipp-usb/ipp-usb.conf || exit + systemctl enable avahi-daemon.socket cups.socket cups-browsed ipp-usb + sed -i 's|^hosts.*|hosts: mymachines mdns_minimal resolve [!UNAVAIL=return] files myhostname dns|g' /etc/nsswitch.conf + sed -i 's/ interface = [^ ]*/ interface = all/g' /etc/ipp-usb/ipp-usb.conf PRINT_CONF stage_ok else @@ -6970,15 +4313,13 @@ PRINT_CONF fi fi } -################################################################################################### foreign() { - if [[ -n "${web_aur}" ]]; then if [[ -z "${nvidia_aur}" ]]; then if [[ "${dev}" != "y" ]]; then local stage_prompt="Base-devel Package Installation" if arch-chroot /mnt <<-BASE_DEVEL > "${void}" 2>&1 2> "${log}" ; then - pacman -S --noconfirm base-devel || exit + pacman -S --noconfirm base-devel BASE_DEVEL stage_ok else @@ -6988,7 +4329,7 @@ BASE_DEVEL if [[ "${desktop}" =~ ^(11|12)$ ]]; then local stage_prompt="Git Package Installation" if arch-chroot /mnt <<-GIT > "${void}" 2>&1 2> "${log}" ; then - pacman -S --noconfirm git || exit + pacman -S --noconfirm git GIT stage_ok else @@ -6997,32 +4338,30 @@ GIT fi fi local stage_prompt="${web_name} Package Installation" - if arch-chroot /mnt <<-AUR_GIT_PKGS > "${void}" 2>&1 2> "${log}" ; then - sed -i 's|if (( EUID == 0 )); then|if (( EUID != 0 )); then|g' /usr/bin/makepkg || exit - git clone --branch ${web_aur} --single-branch https://github.com/archlinux/aur.git ${web_aur} && cd ${web_aur} && makepkg -s --noconfirm && sudo pacman -U --noconfirm *x86_64.pkg.tar.zst && cd .. && rm -rf ${web_aur} || exit - sed -i 's|if (( EUID != 0 )); then|if (( EUID == 0 )); then|g' /usr/bin/makepkg || exit -AUR_GIT_PKGS + if arch-chroot /mnt <<-AUR_WEB_PKGS > "${void}" 2>&1 2> "${log}" ; then + sed -i 's|if (( EUID == 0 )); then|if (( EUID != 0 )); then|g' /usr/bin/makepkg + git clone --branch ${web_aur} --single-branch https://github.com/archlinux/aur.git ${web_aur} && cd ${web_aur} && makepkg -s --noconfirm && sudo pacman -U --noconfirm *x86_64.pkg.tar.zst && cd .. && rm -rf ${web_aur} + sed -i 's|if (( EUID != 0 )); then|if (( EUID == 0 )); then|g' /usr/bin/makepkg +AUR_WEB_PKGS stage_ok else stage_fail fi fi } -################################################################################################### optimizations() { - - if [[ "${genoptm}" == "y" ]]; then + if [[ "${sys_optm}" == "y" ]]; then local stage_prompt="General System Optimizations" - if arch-chroot /mnt <<-GEN_OPTM > "${void}" 2>&1 2> "${log}" ; then - pacman -S --noconfirm ccache ntfs-3g pbzip2 pigz || exit - sed -i 's/^#Color/Color\nILoveCandy/' /etc/pacman.conf || exit - update-pciids || exit - cat <<-MKINITCPIO >> /etc/mkinitcpio.conf.d/mkinitcpiod.conf || exit + if arch-chroot /mnt <<-SYS_OPTM > "${void}" 2>&1 2> "${log}" ; then + pacman -S --noconfirm ccache ntfs-3g pbzip2 pigz + sed -i 's/^#Color/Color\nILoveCandy/' /etc/pacman.conf + update-pciids + cat <<-MKINITCPIO >> /etc/mkinitcpio.conf.d/mkinitcpiod.conf COMPRESSION="zstd" COMPRESSION_OPTIONS=(-c -T$(nproc) --auto-threads=logical -) MKINITCPIO - mkinitcpio -P || exit - cat <<-MAKEPKG > /etc/makepkg.conf.d/makepkgd.conf || exit + mkinitcpio -P + cat <<-MAKEPKG > /etc/makepkg.conf.d/makepkgd.conf #!/hint/bash CFLAGS="-march=native -O2 -pipe -fno-plt -fexceptions \ -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security \ @@ -7035,7 +4374,7 @@ MKINITCPIO COMPRESSBZ2=(pbzip2 -c -f) COMPRESSZST=(zstd -c -T0 --auto-threads=logical -) MAKEPKG - cat <<-IO_SCHED > /etc/udev/rules.d/60-ioschedulers.rules || exit + cat <<-IO_SCHED > /etc/udev/rules.d/60-ioschedulers.rules # HDD ACTION=="add|change", KERNEL=="sd[a-z]*", ATTR{queue/rotational}=="1", ATTR{queue/scheduler}="bfq" # SSD @@ -7043,7 +4382,7 @@ MAKEPKG # NVMe SSD ACTION=="add|change", KERNEL=="nvme[0-9]*", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="none" IO_SCHED - cat <<-SYSCTL > /etc/sysctl.d/99-sysctld.conf || exit + cat <<-SYSCTL > /etc/sysctl.d/99-sysctld.conf net.core.netdev_max_backlog = 16384 net.ipv4.tcp_fastopen = 3 net.ipv4.tcp_tw_reuse = 1 @@ -7058,7 +4397,7 @@ IO_SCHED kernel.printk = 0 0 0 0 ${perf_stream} SYSCTL - cat <<-POLKIT > /etc/polkit-1/rules.d/99-udisks2.rules || exit + cat <<-POLKIT > /etc/polkit-1/rules.d/99-udisks2.rules // Original rules: https://github.com/coldfix/udiskie/wiki/Permissions // Changes: Added org.freedesktop.udisks2.filesystem-mount-system, as this is used by Dolphin. polkit.addRule(function(action, subject) { @@ -7089,13 +4428,13 @@ SYSCTL } }); POLKIT - mkdir -p /etc/systemd/journald.conf.d > ${void} 2>&1 || exit - cat <<-JOURNAL > /etc/systemd/journald.conf.d/00-journald.conf || exit + mkdir -p /etc/systemd/journald.conf.d > ${void} 2>&1 + cat <<-JOURNAL > /etc/systemd/journald.conf.d/00-journald.conf [Journal] SystemMaxUse=100M JOURNAL - mkdir -p /etc/systemd/user.conf.d > ${void} 2>&1 || exit - cat <<-TIMEOUT > /etc/systemd/user.conf.d/00-timeout.conf || exit + mkdir -p /etc/systemd/user.conf.d > ${void} 2>&1 + cat <<-TIMEOUT > /etc/systemd/user.conf.d/00-timeout.conf [Manager] DefaultTimeoutStopSec=5s DefaultTimeoutAbortSec=5s @@ -7103,25 +4442,24 @@ TIMEOUT sed -i \ -e '/^# set linenumbers/s/^#//' \ -e '/^# set minibar/s/^#//' \ - -e '/^# set mouse/s/^#//' /etc/nanorc || exit - echo " include /usr/share/nano/*.nanorc" | tee -a /etc/nanorc || exit - echo tcp_bbr | tee /etc/modules-load.d/modulesd.conf || exit - cat <<-SUDOERS > /etc/sudoers.d/sudoersd || exit + -e '/^# set mouse/s/^#//' /etc/nanorc + echo " include /usr/share/nano/*.nanorc" | tee -a /etc/nanorc + echo tcp_bbr | tee /etc/modules-load.d/modulesd.conf + cat <<-SUDOERS > /etc/sudoers.d/sudoersd Defaults pwfeedback Defaults editor=/usr/bin/nano %wheel ALL=(ALL) ALL SUDOERS - visudo -c /etc/sudoers.d/sudoersd || exit -GEN_OPTM + visudo -c /etc/sudoers.d/sudoersd +SYS_OPTM stage_ok else stage_fail fi - if [[ -d /mnt/etc/udisks2 ]]; then local stage_prompt="Udisks2 Mount Options" if arch-chroot /mnt <<-UDISKS2 > "${void}" 2>&1 2> "${log}" ; then - cat <<-UDISKS_CONF > /etc/udisks2/mount_options.conf || exit + cat <<-UDISKS_CONF > /etc/udisks2/mount_options.conf [defaults] ntfs_drivers=ntfs3,ntfs ntfs:ntfs3_defaults=uid=*,gid=*,windows_names @@ -7134,11 +4472,10 @@ UDISKS2 stage_fail fi fi - if [[ -n "${REGDOM}" ]]; then local stage_prompt="Wpa_Supplicant Configuration" if arch-chroot /mnt <<-WPA > "${void}" 2>&1 2> "${log}" ; then - cat <<-SUPPLICANT > /etc/wpa_supplicant/wpa_supplicant.conf || exit + cat <<-SUPPLICANT > /etc/wpa_supplicant/wpa_supplicant.conf country=${REGDOM} wps_cred_add_sae=1 pmf=2 @@ -7151,78 +4488,68 @@ WPA fi fi } -################################################################################################### view_optm() { - - if [[ "${genoptm}" == "v" ]]; then + if [[ "${sys_optm}" == "v" ]]; then typeset -f optimizations |grep -E 'pacman|/pacman.conf|update-pciids|usermod|systemctl|/etc|/mkinitcpio.conf.d|/makepkg.conf.d|/sysctl.d|/polkit-1/rules.d|/systemd/journald.conf.d|/systemd/user.conf.d|/nanorc|/modules-load.d|/sudoers.d|/udisks2|/wpa_supplicant|/udev/rules.d' | less fi } -################################################################################################### secboot_sign() { - if [[ "${sb_sign}" == "y" ]]; then local stage_prompt="Secure-Boot Signing" + if arch-chroot /mnt <<-SECSIGN_MAIN > "${void}" 2>&1 2> "${log}" ; then + pacman -S --noconfirm sbctl + sbctl create-keys + sbctl enroll-keys -m + sbctl sign -s /boot/vmlinuz-${kernel} +SECSIGN_MAIN + : + else + stage_fail + fi if [[ "${bootloader}" == "1" && "${uki}" == "y" ]]; then - if arch-chroot /mnt <<-SDBOOT_SEC_SIGN > "${void}" 2>&1 2> "${log}" ; then - pacman -S --noconfirm sbctl || exit - sbctl create-keys || exit - sbctl enroll-keys -m || exit - sbctl sign -s /boot/vmlinuz-${kernel} || exit - sbctl sign -s ${btldr_esp_mount}/EFI/BOOT/${efiname}.EFI || exit - sbctl sign -s ${btldr_esp_mount}/EFI/Linux/arch-${kernel}.efi || exit - sbctl sign -s ${btldr_esp_mount}/EFI/systemd/systemd-bootx${bitness}.efi || exit - sbctl sign -s -o /usr/lib/systemd/boot/efi/systemd-bootx${bitness}.efi.signed /usr/lib/systemd/boot/efi/systemd-bootx${bitness}.efi || exit -SDBOOT_SEC_SIGN + if arch-chroot /mnt <<-SDBOOT_SECSIGN > "${void}" 2>&1 2> "${log}" ; then + sbctl sign -s ${btldr_esp_mount}/EFI/BOOT/${efiname}.EFI + sbctl sign -s ${btldr_esp_mount}/EFI/Linux/arch-${kernel}.efi + sbctl sign -s ${btldr_esp_mount}/EFI/systemd/systemd-bootx${bitness}.efi + sbctl sign -s -o /usr/lib/systemd/boot/efi/systemd-bootx${bitness}.efi.signed /usr/lib/systemd/boot/efi/systemd-bootx${bitness}.efi +SDBOOT_SECSIGN stage_ok else stage_fail fi if [[ "${setrescue}" == "y" ]]; then - local stage_prompt="Rescue Entry Secure-Boot Signing" - if arch-chroot /mnt <<-SDBOOT_RESCUE_SEC_SIGN > "${void}" 2>&1 2> "${log}" ; then - sbctl sign -s ${btldr_esp_mount}/EFI/Linux/rescue.efi || exit -SDBOOT_RESCUE_SEC_SIGN + local stage_prompt="Rescue Entry Secure-Boot Signing" + if arch-chroot /mnt <<-SDBOOT_RESCUE_SECSIGN > "${void}" 2>&1 2> "${log}" ; then + sbctl sign -s ${btldr_esp_mount}/EFI/Linux/rescue.efi +SDBOOT_RESCUE_SECSIGN stage_ok else stage_fail fi fi elif [[ "${bootloader}" == "1" && "${uki}" == "n" ]]; then - if arch-chroot /mnt <<-SD_XBOOTLDR_SEC_SIGN > "${void}" 2>&1 2> "${log}" ; then - pacman -S --noconfirm sbctl || exit - sbctl create-keys || exit - sbctl enroll-keys -m || exit - sbctl sign -s /boot/vmlinuz-${kernel} || exit - sbctl sign -s ${btldr_esp_mount}/EFI/BOOT/${efiname}.EFI || exit - sbctl sign -s ${btldr_esp_mount}/EFI/systemd/systemd-bootx${bitness}.efi || exit - sbctl sign -s -o /usr/lib/systemd/boot/efi/systemd-bootx${bitness}.efi.signed /usr/lib/systemd/boot/efi/systemd-bootx${bitness}.efi || exit -SD_XBOOTLDR_SEC_SIGN + if arch-chroot /mnt <<-SD_XBOOTLDR_SECSIGN > "${void}" 2>&1 2> "${log}" ; then + sbctl sign -s ${btldr_esp_mount}/EFI/BOOT/${efiname}.EFI + sbctl sign -s ${btldr_esp_mount}/EFI/systemd/systemd-bootx${bitness}.efi + sbctl sign -s -o /usr/lib/systemd/boot/efi/systemd-bootx${bitness}.efi.signed /usr/lib/systemd/boot/efi/systemd-bootx${bitness}.efi +SD_XBOOTLDR_SECSIGN stage_ok else stage_fail fi elif [[ "${bootloader}" == "2" ]]; then if [[ "${path}" == "1" ]]; then - if arch-chroot /mnt <<-GRUB_SEC_SIGN > "${void}" 2>&1 2> "${log}" ; then - pacman -S --noconfirm sbctl || exit - sbctl create-keys || exit - sbctl enroll-keys -m || exit - sbctl sign -s /boot/vmlinuz-${kernel} || exit - sbctl sign -s ${btldr_esp_mount}/EFI/GRUB/grubx${bitness}.efi || exit -GRUB_SEC_SIGN + if arch-chroot /mnt <<-GRUB_SECSIGN > "${void}" 2>&1 2> "${log}" ; then + sbctl sign -s ${btldr_esp_mount}/EFI/GRUB/grubx${bitness}.efi +GRUB_SECSIGN stage_ok else stage_fail fi elif [[ "${path}" == "2" ]]; then - if arch-chroot /mnt <<-GRUB_FALLBACK_SEC_SIGN > "${void}" 2>&1 2> "${log}" ; then - pacman -S --noconfirm sbctl || exit - sbctl create-keys || exit - sbctl enroll-keys -m || exit - sbctl sign -s /boot/vmlinuz-${kernel} || exit - sbctl sign -s ${btldr_esp_mount}/EFI/BOOT/${efiname}.EFI || exit -GRUB_FALLBACK_SEC_SIGN + if arch-chroot /mnt <<-GRUB_FALLBACK_SECSIGN > "${void}" 2>&1 2> "${log}" ; then + sbctl sign -s ${btldr_esp_mount}/EFI/BOOT/${efiname}.EFI +GRUB_FALLBACK_SECSIGN stage_ok else stage_fail @@ -7231,194 +4558,99 @@ GRUB_FALLBACK_SEC_SIGN fi fi } -################################################################################################### set_vars() { - if [[ "${multibooting}" == "y" && "${xbootloader}" == "yes" ]]; then uki="n" fi - - ### Mkinitcpio Modules/Binaries/Hooks - MODULES=() - BINARIES=() - HOOKS=() -#-------------------------------------------------------------------------------------------------- - ## BINARIES SETUP - - # Btrfs Mkinitcpio Binary + boot_opts=() # ATTENTION Kernel Cmdline + MODULES=() # ATTENTION Mkinitcpio Modules + BINARIES=() # ATTENTION Mkinitcpio Binaries + HOOKS=() # ATTENTION Mkinitcpio Hooks [[ "${fs}" == "2" ]] && BINARIES+=(/usr/bin/btrfs) - -#-------------------------------------------------------------------------------------------------- - # LUKS ENCRYPTION + # NOTE: Encrypted Setup if [[ "${encrypt}" == "yes" ]]; then - - # Encrypted Root Device + MODULES+=("${fs_mod}") encr_root_dev="/dev/mapper/root" - # Encrypted Root Options encr_root_opts="rd.luks.name=$(blkid -s UUID -o value "${root_dev}")=root" - - # ATTENTION LUKS ROOT KERNEL CMDLINE encr_root_bootopts="${encr_root_opts} root=${encr_root_dev}" - -#-------------------------------------------------------------------------------------------------- - ## LUKS SWAP SETUP - - # Encrypted Swap Partition if [[ "${swapmode}" == "1" ]]; then - # Encrypted Swap Partition Options encr_swap_opts="rd.luks.name=$(blkid -s UUID -o value "${swap_dev}")=swap" - - # ATTENTION LUKS SWAP PARTITION KERNEL CMDLINE encr_swap_bootopts="resume=/dev/mapper/swap ${encr_swap_opts}" - - # Encrypted Swapfile elif [[ "${swapmode}" == "2" ]]; then - # Ext4 Offset calculation if [[ "${fs}" == "1" ]]; then offst="$(filefrag -v /mnt/swapfile | awk '$1=="0:" {print substr($4, 1, length($4)-2)}')" - # Btrfs Offset calculation elif [[ "${fs}" == "2" ]]; then offst="$(btrfs inspect-internal map-swapfile -r /mnt/swap/swapfile)" fi - - # ATTENTION LUKS SWAPFILE KERNEL CMDLINE encr_swap_bootopts="resume=${encr_root_dev} resume_offset=${offst}" fi -#-------------------------------------------------------------------------------------------------- - ## LUKS HOME SETUP - if [[ "${sep_home}" == "y" && "${hometype}" == "1" ]]; then - # ATTENTION LUKS HOME PARTITION KERNEL CMDLINE encr_home_bootopts="rd.luks.name=$(blkid -s UUID -o value "${home_dev}")=home" fi -#-------------------------------------------------------------------------------------------------- - ## LUKS HOOKS SETUP - - # Nvidia Proprietary GFX Hooks if [[ "${nvidiaprop}" == "y" ]]; then HOOKS+=(systemd keyboard autodetect microcode modconf sd-vconsole block sd-encrypt filesystems) - # Open-source GFX Hooks else HOOKS+=(systemd keyboard autodetect microcode modconf kms sd-vconsole block sd-encrypt filesystems) fi - # Add Fsck Hook - [[ "${fs}" == "1" ]] && HOOKS+=(fsck) - -#-------------------------------------------------------------------------------------------------- - ## LUKS MODULES SETUP - - # LUKS Mkinitcpio Modules - MODULES+=("${fs_mod}") - -#-------------------------------------------------------------------------------------------------- - # ATTENTION MAIN KERNEL CMDLINE - boot_opts=("${encr_root_bootopts}") - - # If LUKS Swap: + boot_opts+=("${encr_root_bootopts}") [[ -n "${encr_swap_bootopts}" ]] && boot_opts+=("${encr_swap_bootopts}") - # If LUKS Home: [[ -n "${encr_home_bootopts}" ]] && boot_opts+=("${encr_home_bootopts}") - -#-------------------------------------------------------------------------------------------------- - # NO ENCRYPTION + # NOTE: Unencrypted Setup elif [[ "${encrypt}" == "no" ]]; then - - ## HOOKS SETUP - - # Nvidia Proprietary GFX Hooks if [[ "${nvidiaprop}" == "y" ]]; then HOOKS+=(systemd autodetect microcode modconf keyboard sd-vconsole block filesystems) - # Open-source GFX Hooks else HOOKS+=(systemd autodetect microcode modconf kms keyboard sd-vconsole block filesystems) fi - - # Add Fsck Hook - [[ "${fs}" == "1" ]] && HOOKS+=(fsck) -#-------------------------------------------------------------------------------------------------- - # ATTENTION MAIN KERNEL CMDLINE - boot_opts=() - - # If Multiroot: [[ "${autoroot}" == "y" ]] && boot_opts+=("${multiroot_bootopts}") fi -#-------------------------------------------------------------------------------------------------- - - ## GFX CONFIGURATION - - # Gfx Kernel Cmdline + # NOTE: Graphics gfx_bootopts=() - - # Nvidia Proprietary if [[ "${nvidiaprop}" == "y" ]]; then - # No Hibernation -> EARLY KMS if [[ -z "${swapmode}" ]]; then MODULES+=(nvidia nvidia_modeset nvidia_uvm nvidia_drm) fi gfx_bootopts+=(nvidia.NVreg_UsePageAttributeTable=1) - - # MultiGfx with Intel [[ "${vendors}" =~ "Intel" ]] && MODULES+=(i915) - # MultiGfx with AMD [[ "${vendors}" =~ "AMD" ]] && MODULES+=(amdgpu radeon) - - # Disable GSP Firmware -> NVIDIA 580xx [AUR] DRIVER ONLY [[ "${nogsp}" == "y" ]] && gfx_bootopts+=(nvidia.NVreg_EnableGpuFirmware=0) - # Enable Experimental Low Latency Interrupts [[ "${lowlat}" == "y" ]] && gfx_bootopts+=(nvidia.NVreg_RegistryDwords=RMIntrLockingMode=1) fi - - # AMD if [[ "${vendor}" == "AMD" || "${vendors}" =~ "AMD" ]]; then if [[ -n "${islands}" && -z "${nvidiaprop}" ]]; then MODULES+=(amdgpu radeon) fi - # 'Southern Islands' support if [[ "${islands}" == "1" ]]; then gfx_bootopts+=(amdgpu.dc=1 radeon.si_support=0 amdgpu.si_support=1) - # 'Sea Islands' support elif [[ "${islands}" == "2" ]]; then gfx_bootopts+=(amdgpu.dc=1 radeon.cik_support=0 amdgpu.cik_support=1) fi fi -#-------------------------------------------------------------------------------------------------- - # ATTENTION ADD TO MAIN KERNEL CMDLINE - + # NOTE: Finalizing Configuration + [[ "${fs}" == "1" ]] && HOOKS+=(fsck) [[ -n "${gfx_bootopts[*]}" ]] && boot_opts+=("${gfx_bootopts[*]}") [[ -n "${cust_bootopts}" ]] && boot_opts+=("${cust_bootopts}") [[ -n "${btrfs_bootopts}" ]] && boot_opts+=("${btrfs_bootopts}") [[ "${swapmode}" == "3" ]] && boot_opts+=(zswap.enabled=0) [[ "${kill_watchdog}" == "y" ]] && boot_opts+=(nowatchdog) - -#-------------------------------------------------------------------------------------------------- - # MAIN MKINITCPIO MODULES mkinitcpio_mods="MODULES=(${MODULES[*]})" - # MAIN MKINITCPIO BINARIES mkinitcpio_bins="BINARIES=(${BINARIES[*]})" - # MAIN MKINITCPIO HOOKS mkinitcpio_hooks="HOOKS=(${HOOKS[*]})" } -################################################################################################### chroot_conf() { - if [[ "${swapmode}" == "2" ]]; then - line2 + printf "\n\n" fi - sleep 0.2 - NC " -${magenta}###${nc}--------------------------------${magenta}[ ${bwhite}Chroot & Configure System${nc} ${magenta}]${nc}--------------------------------${magenta}###${nc} - " - - # Desktops Configuration: + title "Chroot & Configure System" + # NOTE: Desktops Configuration: if [[ "${desktop}" != "12" ]]; then cnfg main_chroot - if [[ -f /mnt/etc/lightdm/lightdm.conf ]]; then if [[ "${desktop}" =~ ^(5|8|10)$ ]]; then local stage_prompt="GTK Greeter Configuration" if arch-chroot /mnt <<-GTK > "${void}" 2>&1 2> "${log}" ; then - sed -i 's|^#greeter-session=example-gtk-gnome|greeter-session=lightdm-gtk-greeter|g' /etc/lightdm/lightdm.conf || exit + sed -i 's|^#greeter-session=example-gtk-gnome|greeter-session=lightdm-gtk-greeter|g' /etc/lightdm/lightdm.conf GTK stage_ok else @@ -7427,7 +4659,7 @@ GTK elif [[ "${desktop}" == "6" ]]; then local stage_prompt="Slick Greeter Configuration" if arch-chroot /mnt <<-SLICK > "${void}" 2>&1 2> "${log}" ; then - sed -i 's|^#greeter-session=example-gtk-gnome|greeter-session=lightdm-slick-greeter|g' /etc/lightdm/lightdm.conf || exit + sed -i 's|^#greeter-session=example-gtk-gnome|greeter-session=lightdm-slick-greeter|g' /etc/lightdm/lightdm.conf SLICK stage_ok else @@ -7436,7 +4668,7 @@ SLICK elif [[ "${desktop}" == "7" ]]; then local stage_prompt="Deepin Greeter Configuration" if arch-chroot /mnt <<-DEEPIN > "${void}" 2>&1 2> "${log}" ; then - sed -i 's|^#greeter-session=example-gtk-gnome|greeter-session=lightdm-deepin-greeter|g' /etc/lightdm/lightdm.conf || exit + sed -i 's|^#greeter-session=example-gtk-gnome|greeter-session=lightdm-deepin-greeter|g' /etc/lightdm/lightdm.conf DEEPIN stage_ok else @@ -7445,7 +4677,7 @@ DEEPIN elif [[ "${desktop}" == "14" ]]; then local stage_prompt="Pantheon Greeter Configuration" if arch-chroot /mnt <<-PANTHEON > "${void}" 2>&1 2> "${log}" ; then - sed -i 's|^#greeter-session=example-gtk-gnome|greeter-session=io.elementary.greeter|g' /etc/lightdm/lightdm.conf || exit + sed -i 's|^#greeter-session=example-gtk-gnome|greeter-session=io.elementary.greeter|g' /etc/lightdm/lightdm.conf PANTHEON stage_ok else @@ -7453,33 +4685,30 @@ PANTHEON fi fi fi - if [[ "${vendor}" != "Virtual Machine" && "${desktop}" != "11" ]]; then local stage_prompt="Bluetooth Service Activation" if arch-chroot /mnt <<-BLUETOOTH > "${void}" 2>&1 2> "${log}" ; then - systemctl enable bluetooth || exit + systemctl enable bluetooth BLUETOOTH stage_ok else stage_fail fi fi - if [[ -n "${displaymanager}" ]]; then local stage_prompt="Display Manager Service Activation" if arch-chroot /mnt <<-DM > "${void}" 2>&1 2> "${log}" ; then - systemctl enable ${displaymanager} || exit + systemctl enable ${displaymanager} DM stage_ok else stage_fail fi fi - if [[ "${desktop}" != "12" ]]; then local stage_prompt="Network Manager Service Activation" if arch-chroot /mnt <<-NETWORK > "${void}" 2>&1 2> "${log}" ; then - systemctl enable NetworkManager || exit + systemctl enable NetworkManager NETWORK stage_ok else @@ -7487,56 +4716,14 @@ NETWORK fi fi fi -#-------------------------------------------------------------------------------------------------- - # Custom System Configuration: + # NOTE: Custom System Configuration: if [[ "${desktop}" == "12" ]]; then cnfg main_chroot - - if [[ -f /mnt/etc/lightdm/lightdm.conf ]]; then - if [[ "${greeternmbr}" == "1" ]]; then - local stage_prompt="GTK Greeter Configuration" - if arch-chroot /mnt <<-GTK > "${void}" 2>&1 2> "${log}" ; 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 - local stage_prompt="Slick Greeter Configuration" - if arch-chroot /mnt <<-SLICK > "${void}" 2>&1 2> "${log}" ; 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 - local stage_prompt="Deepin Greeter Configuration" - if arch-chroot /mnt <<-DEEPIN > "${void}" 2>&1 2> "${log}" ; 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 - fi - elif [[ "${greeternmbr}" == "4" ]]; then - local stage_prompt="Pantheon Greeter Configuration" - if arch-chroot /mnt <<-PANTHEON > "${void}" 2>&1 2> "${log}" ; then - sed -i 's|^#greeter-session=example-gtk-gnome|greeter-session=io.elementary.greeter|g' /etc/lightdm/lightdm.conf || exit -PANTHEON - stage_ok - else - stage_fail - fi - fi - fi - if [[ -n "${customservices}" ]]; then local stage_prompt="Custom Service(s) Activation" if arch-chroot /mnt <<-CUSTOM_SRVC > "${void}" 2>&1 2> "${log}" ; then - systemctl enable ${customservices} || exit + systemctl enable ${customservices} CUSTOM_SRVC stage_ok else @@ -7554,38 +4741,42 @@ CUSTOM_SRVC foreign optimizations secboot_sign - completion - installation="ok" - umount -R /mnt - reboot - exit } -# END SYSTEM FUNCTIONS -################################################################################################### - - clear +#END SYSTEM FUNCTIONS + nc="\e[0m" + red="\e[31m" + cyan="\e[36m" + blue="\e[94m" + green="\e[32m" + redl="\e[1;31m" + yellow="\e[33m" + cyanl="\e[1;36m" + redbg="\e[1;41m" + magenta="\e[35m" + bwhite="\e[0;97m" + cyanbg="\e[1;46m" + bluebg="\e[1;44m" + greenl="\e[1;32m" + greenbg="\e[1;42m" + yellowl="\e[1;33m" + magental="\e[1;35m" + magentabg="\e[1;45m" run_as="$(whoami)" - tty="$(tty)" void="/dev/null" log="Amelia.log" - disks="$(lsblk --nodeps --paths --noheadings --output=name,size,model | cat --number)" + tty="$(tty)" trg="" - vars=(LOCALESET="" SETLOCALE="" lcl_slct="" USERNAME="" kernelnmbr="" fs="" gfxcount="" gfxcard="" intelcount="" intelcards="" nvidiacount="" nvidiacards="" amdcount="" amdcards="" vendor="" vendors="" desktop="" terminal="" efi_entr_del="" sanity="" install="" bootldr_pkgs="" devel="" REGDOM="" gfx_bootopts="" btrfs_bootopts="" trim="" swapmode="" greeter="" greeternmbr="" cust_bootopts="" vmpkgs="" vm_services="" perf_stream="" displaymanager="" wireless_reg="" bitness="" bootloader="" gfx_slct="" espsize="" autoroot="" autoesp="" autoxboot="" autohome="" autoswap="" rootprt="" espprt="" xbootprt="" homeprt="" swapprt="" partok="" instl_drive="" sgdsk_nmbr="" part_mode="" preset="" capacity="" cap_gib="" rootsize="" sgdrive="" cgdrive="" smartpart="" presetpart="" prcnt="" roottype="" stage_prompt="" zram="" xbootloader="" multibooting="" hypervisor="" mkinitcpio_mods="" mkinitcpio_bins="" uki="" ukify="" cng_espmnt="" sep_home="" encr_swap_bootopts="" encr_home_bootopts="" uefimode="" luks_encrypt="" nrg_plc="" multilib="" nvname="" nogsp="" luks_root="" luks_swap="" luks_home="" installation="" kill_watchdog="" oomd="" setrescue="" lowlat="" dev="" web="" web_pkg="" web_aur="" web_slct="" printer="" print_pkgs="" shellnmbr="" shell="" shellname="" shellname2="" shell_pkgs="" genoptm="" set_optm="" ask_param="" desk_setup="" irqbalance="" thermald="" rngd="" rtkit="" tlp="" CRYPTPASS="" CRYPTPASS2="" askoptm="" gptslct="" gptok="" gptabort="" nvidiaprop="" nowarning="" efiname="" path="" hometype="" homeform="" LuksParts="" nvidia_aur="" web_aur_url="" session="" alt_session="" session_support="" alt_session_pack="") + disks="$(lsblk --nodeps --paths --noheadings --output=name,size,model | cat --number)" + vars=(LOCALESET="" SETLOCALE="" lcl_slct="" USERNAME="" kernelnmbr="" fs="" gfxcount="" gfxcard="" intelcount="" intelcards="" nvidiacount="" nvidiacards="" amdcount="" amdcards="" vendor="" vendors="" desktop="" terminal="" efi_entr_del="" sanity="" install="" bootldr_pkgs="" devel="" REGDOM="" gfx_bootopts="" btrfs_bootopts="" trim="" swapmode="" greeter="" cust_bootopts="" vmpkgs="" vm_services="" perf_stream="" displaymanager="" wireless_reg="" bitness="" bootloader="" gfx_slct="" espsize="" autoroot="" autoesp="" autoxboot="" autohome="" autoswap="" rootprt="" espprt="" xbootprt="" homeprt="" swapprt="" partok="" instl_drive="" sgdsk_nmbr="" part_mode="" preset="" capacity="" cap_gib="" rootsize="" sgdrive="" cgdrive="" smartpart="" presetpart="" prcnt="" roottype="" stage_prompt="" zram="" xbootloader="" multibooting="" hypervisor="" mkinitcpio_mods="" mkinitcpio_bins="" uki="" ukify="" cng_espmnt="" sep_home="" encr_swap_bootopts="" encr_home_bootopts="" uefimode="" luks_encrypt="" nrg_plc="" multilib="" nvname="" nogsp="" luks_root="" luks_swap="" luks_home="" installation="" kill_watchdog="" oomd="" setrescue="" lowlat="" dev="" web="" web_pkg="" web_aur="" web_slct="" printer="" print_pkgs="" shellnmbr="" shell="" shellname="" shellname2="" shell_pkgs="" sys_optm="" set_ext_opt="" ask_param="" desk_setup="" irqbalance="" thermald="" rngd="" rtkit="" tlp="" CRYPTPASS="" CRYPTPASS2="" show_extopts="" gptslct="" gptok="" gptabort="" nvidiaprop="" nowarning="" efiname="" path="" hometype="" homeform="" LuksParts="" nvidia_aur="" web_aur_url="" session="" alt_session="" session_support="" alt_session_pack="") export "${vars[@]}" validpkgs=() - sleep 0.2 - CYANBG "************************************************************************************************* " - CYANBG " " - CYANBG " ### Amelia Installer ### " - CYANBG " " - CYANBG "************************************************************************************************* " + clear + amelia mode_check - line3 - line3 keypress clear - set_font - arch + check_fonts + banner uefi_check connection_check upd_clock