From 7df3b742a57e69e3265dae69c67e1373fcadd3d3 Mon Sep 17 00:00:00 2001 From: Jane Doe Date: Wed, 23 Oct 2024 17:13:03 +0000 Subject: [PATCH] Remove: Some unused color functions have been removed Change: A few variables have been renamed (better description) Change: Some prompts have been edited for better visuals/aesthetics Change: Add a few extra informational prompts at 'Sanity Check' stage --- Amelia.sh | 164 ++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 103 insertions(+), 61 deletions(-) diff --git a/Amelia.sh b/Amelia.sh index bca9911..7b9a34f 100644 --- a/Amelia.sh +++ b/Amelia.sh @@ -1,55 +1,41 @@ #!/bin/bash # Amelia Installer -# Version: 8.0.3 +# https://gitlab.com/prism7/archery +# Version: 8.0.4 set -euo pipefail ################################################################################################### # COLOR FUNCTIONS - redbgbl="\e[5;1;41m" redbg="\e[1;41m" red="\e[31m" - greenbgbl="\e[5;1;42m" greenbg="\e[1;42m" green="\e[32m" - yellowbgbl="\e[5;1;43m" yellowbg="\e[1;43m" yellow="\e[33m" yellowl="\e[93m" - bluebgbl="\e[5;1;44m" bluebg="\e[1;44m" blue="\e[94m" - magentabgbl="\e[5;1;45m" magentabg="\e[1;45m" magenta="\e[35m" - cyanbgbl="\e[5;1;46m" cyanbg="\e[1;46m" cyan="\e[36m" bwhite="\e[0;97m" nc="\e[0m" -REDBGBL() { - echo -e "${redbgbl} $1${nc}" -} REDBG() { echo -e "${redbg} $1${nc}" } RED() { echo -e "${red} $1${nc}" } -GREENBGBL() { - echo -e "${greenbgbl} $1${nc}" -} GREENBG() { echo -e "${greenbg} $1${nc}" } GREEN() { echo -e "${green} $1${nc}" } -YELLOWBGBL() { - echo -e "${yellowbgbl} $1${nc}" -} YELLOWBG() { echo -e "${yellowbg} $1${nc}" } @@ -59,27 +45,18 @@ YELLOW() { YELLOWL() { echo -e "${yellowl} $1${nc}" } -BLUEBGBL() { - echo -e "${bluebgbl} $1${nc}" -} BLUEBG() { echo -e "${bluebg} $1${nc}" } BLUE() { echo -e "${blue} $1${nc}" } -MAGENTABGBL() { - echo -e "${magentabgbl} $1${nc}" -} MAGENTABG() { echo -e "${magentabg} $1${nc}" } MAGENTA() { echo -e "${magenta} $1${nc}" } -CYANBGBL() { - echo -e "${cyanbgbl} $1${nc}" -} CYANBG() { echo -e "${cyanbg} $1${nc}" } @@ -96,6 +73,7 @@ WHITEB() { ################################################################################################### # PROMPT FUNCTIONS + skip() { sleep 0.2 YELLOW " @@ -242,7 +220,7 @@ completion_err() { (*) ${nc}Please complete${yellowl} '${stage_prompt}' ${nc}to continue - "| pv -qL 60 + "| pv -qL 70 } intel() { line2 @@ -336,7 +314,7 @@ first_check() { if [[ "${tty}" == *"tty"* && "${run_as}" == "root" ]]; then until slct_font; do : ; done else - MAGENTABG " 'Terminus Font' detected ==> Log in as 'ROOT' in console & re-run to enable "| pv -qL 60 + MAGENTABG " 'Terminus Font' detected ==> Log in as 'ROOT' in console & re-run to enable "| pv -qL 70 echo fi fi @@ -389,19 +367,19 @@ Enter a number: " ################################################################################################### uefi_check() { - bootmode="$(cat /sys/firmware/efi/fw_platform_size)" - local prompt="UEFI ${bootmode}-bit Mode" + 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}### " - if [[ "${bootmode}" == "64" ]]; then - bitness="x86_64-efi" + if [[ "${bitness}" == "64" ]]; then + uefimode="x86_64-efi" ok - elif [[ "${bootmode}" == "32" ]]; then - bitness="i386-efi" + elif [[ "${bitness}" == "32" ]]; then + uefimode="i386-efi" ok else RED " @@ -491,7 +469,7 @@ ${magenta}###${nc}----------------------------------------${magenta}[ ${bwhite}M CYAN " (*) ${nc}Select ${bwhite}[4] ${nc}to utilize ${yellowl}'Guided Navigation' ${nc}& ${yellowl}'Smart Partitioning' ${nc}functions - " | pv -qL 60 + " | pv -qL 70 NC " [1] Personalization @@ -2377,7 +2355,7 @@ ${magenta}###${nc}-------------------------------------${magenta}[ ${bwhite}Mult YELLOW " - > Are you Dual/Multi-Booting with other OS's ? [y/n]" + > Are you ${nc}Dual/Multi-Booting ${yellow}with other OS's ? [y/n]" BLUE " @@ -2964,7 +2942,7 @@ ${multi_root} ### Only the 1st Linux x86-64 /Root partition on a selected disk can be auto-assigned as a valid /Root partition - ### Partition ${nc}${root_comply} ${yellow}is auto-assigned as such and will be ${red}[!] FORMATTED [!] + ### Partition ${nc}${root_comply} ${yellow}is auto-assigned as such and will be ${red}[!] ${nc}FORMATTED ${red}[!] " BLUE " @@ -3017,7 +2995,7 @@ ${multi_esp} " if [[ "${multibooting}" == "n" ]]; then YELLOW " - ### Partition ${nc}${esp_comply} ${yellow}is auto-assigned as such and will be ${red}[!] FORMATTED [!] + ### Partition ${nc}${esp_comply} ${yellow}is auto-assigned as such and will be ${red}[!] ${nc}FORMATTED ${red}[!] " elif [[ "${multibooting}" == "y" ]]; then YELLOW " @@ -3073,7 +3051,7 @@ ${multi_xboot} ### Only the 1st Linux Extended Boot partition on a selected disk can be auto-assigned as a valid XBOOTLDR partition - ### Partition ${nc}${xboot_comply} ${yellow}is auto-assigned as such and will be ${red}[!] FORMATTED [!] + ### Partition ${nc}${xboot_comply} ${yellow}is auto-assigned as such and will be ${red}[!] ${nc}FORMATTED ${red}[!] " BLUE " @@ -3124,7 +3102,7 @@ ${multi_home} ### Only the 1st Linux /Home partition on a selected disk can be auto-assigned as a valid /Home partition - ### Partition ${nc}${home_comply} ${yellow}is auto-assigned as such and will be ${red}[!] FORMATTED [!] + ### Partition ${nc}${home_comply} ${yellow}is auto-assigned as such and will be ${red}[!] ${nc}FORMATTED ${red}[!] " BLUE " @@ -3175,7 +3153,7 @@ ${multi_swap} ### Only the 1st Linux /Swap partition on a selected disk can be auto-assigned as a valid /Swap partition - ### Partition ${nc}${swap_comply} ${yellow}is auto-assigned as such and will be ${red}[!] FORMATTED [!] + ### Partition ${nc}${swap_comply} ${yellow}is auto-assigned as such and will be ${red}[!] ${nc}FORMATTED ${red}[!] " BLUE " @@ -3201,8 +3179,15 @@ ${multi_swap} if [[ -e "${root_dev}" ]]; then rootprt="ok" if [[ "${autoroot}" == "y" ]]; then - local prompt="Confirm /Root Partition" - ok + if [[ "${presetpart}" == "y" || "${smartpart}" == "y" ]]; then + sleep 0.2 + NC " + +==> [Linux x86-64 /Root ${green}OK${nc}] " + else + local prompt="Confirmed /Root Partition" + ok + fi else sleep 0.2 NC " @@ -3235,10 +3220,22 @@ ${multi_swap} if [[ "${espsize}" -ge "209715200" ]]; then espprt="ok" xbootloader="no" - sleep 0.2 - NC " + if [[ "${autoesp}" == "y" ]]; then + if [[ "${presetpart}" == "y" || "${smartpart}" == "y" ]]; then + sleep 0.2 + NC " ==> [EFI System Partition ${green}OK${nc}] " + else + local prompt="Confirmed /EFI System Partition" + ok + fi + else + sleep 0.2 + NC " + +==> [EFI System Partition ${green}OK${nc}] " + fi fi if [[ -e "${esp_dev}" && "${espsize}" -lt "209715200" ]]; then @@ -3248,13 +3245,32 @@ ${multi_swap} if [[ -e "${xboot_dev}" ]]; then xbootprt="ok" espprt="ok" - sleep 0.2 - NC " + if [[ "${autoesp}" == "y" ]]; then + if [[ "${presetpart}" == "y" || "${smartpart}" == "y" ]]; then + sleep 0.2 + NC " ==> [EFI System Partition ${green}OK${nc}] " + else + local prompt="Confirmed EFI System Partition" + ok + fi + else + sleep 0.2 + NC " + +==> [EFI System Partition ${green}OK${nc}] " + fi if [[ "${autoxboot}" == "y" ]]; then - local prompt="Confirm /XBOOTLDR Partition" - ok + if [[ "${presetpart}" == "y" || "${smartpart}" == "y" ]]; then + sleep 0.2 + NC " + +==> [Linux Extended Boot Partition ${green}OK${nc}] " + else + local prompt="Confirmed /XBOOTLDR Partition" + ok + fi else sleep 0.2 NC " @@ -3296,10 +3312,22 @@ ${multi_swap} elif [[ "${espmnt}" == "1" ]]; then espprt="ok" xbootloader="no" - sleep 0.2 - NC " + if [[ "${autoesp}" == "y" ]]; then + if [[ "${presetpart}" == "y" || "${smartpart}" == "y" ]]; then + sleep 0.2 + NC " ==> [EFI System Partition ${green}OK${nc}] " + else + local prompt="Confirmed EFI System Partition" + ok + fi + else + sleep 0.2 + NC " + +==> [EFI System Partition ${green}OK${nc}] " + fi fi fi fi @@ -3309,14 +3337,21 @@ ${multi_swap} if [[ -e "${home_dev}" ]]; then homeprt="ok" if [[ "${autohome}" == "y" ]]; then - local prompt="Confirm /Home Partition" - ok + if [[ "${presetpart}" == "y" || "${smartpart}" == "y" ]]; then + sleep 0.2 + NC " + +==> [Linux /Home ${green}OK${nc}] " + else + local prompt="Confirmed /Home Partition" + ok + fi else sleep 0.2 NC " ==> [Linux /Home ${green}OK${nc}] " - fi + fi else homeprt="fail" sleep 0.2 @@ -3332,8 +3367,15 @@ ${multi_swap} if [[ -e "${swap_dev}" ]]; then swapprt="ok" if [[ "${autoswap}" == "y" ]]; then - local prompt="Confirm /Swap Partition" - ok + if [[ "${presetpart}" == "y" || "${smartpart}" == "y" ]]; then + sleep 0.2 + NC " + +==> [Linux /Swap ${green}OK${nc}] " + else + local prompt="Confirmed /Swap Partition" + ok + fi else sleep 0.2 NC " @@ -3397,7 +3439,7 @@ ${multi_swap} partok="${partok:-y}" partok="${partok,,}" - local prompt="Confirm Disk" + local prompt="Disk Partitioning" local stage_prompt="Partitioning" if [[ "${partok}" == "y" ]]; then @@ -3683,7 +3725,7 @@ instl() { (*) ${nc}Please complete ${yellowl}'Locale & Keyboard Layout Selection'${nc} to continue - "| pv -qL 60 + "| pv -qL 70 until slct_locale; do : ; done until slct_kbd; do : ; done fi @@ -4677,7 +4719,7 @@ ${magenta}###${nc}-------------------------------${magenta}[ ${bwhite}Confirm In revise() { revision="yes" - reset=(xbootloader="" vgaconf="" vendor_slct="" packages="" custompkgs="" customservices="" cust_bootopts="" REGDOM="" preset="") + reset=(xbootloader="" vgaconf="" vendor_slct="" packages="" custompkgs="" customservices="" cust_bootopts="" REGDOM="" preset="" autoroot="" autoxboot="" autohome="" autoswap="") export "${reset[@]}" until dtct_hyper; do : ; done until slct_krnl; do : ; done @@ -5336,7 +5378,7 @@ GRUB local stage_prompt="Grub Installation" if [[ "${sb_sign}" == "y" ]]; then if arch-chroot /mnt <<-SBGRUBINST > /dev/null 2>&1 ; then - grub-install --target=${bitness} --efi-directory=${btldr_esp_mount} --bootloader-id=GRUB --modules="tpm" --disable-shim-lock --recheck || exit + 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/grubx64.efi || exit grub-mkconfig -o /boot/grub/grub.cfg || exit SBGRUBINST @@ -5346,7 +5388,7 @@ SBGRUBINST fi elif [[ "${sb_sign}" == "n" ]]; then if arch-chroot /mnt <<-GRUBINST > /dev/null 2>&1 ; then - grub-install --target=${bitness} --efi-directory=${btldr_esp_mount} --bootloader-id=GRUB --recheck || exit + grub-install --target=${uefimode} --efi-directory=${btldr_esp_mount} --bootloader-id=GRUB --recheck || exit grub-mkconfig -o /boot/grub/grub.cfg || exit GRUBINST stage_ok @@ -6056,7 +6098,7 @@ OPTIMIZED tty="$(tty)" disks="$(lsblk --nodeps --paths --noheadings --output=name,size,model | cat --number)" trg="" - vars=(LOCALESET="" SETLOCALE="" lcl_slct="" USERNAME="" kernelnmbr="" fs="" vgapkgs="" vgacount="" vgacard="" intelcount="" intelcards="" nvidiacount="" nvidiacards="" amdcount="" amdcards="" vgaconf="" vga_conf="" vga_setup="" vendor="" vendor1="" vendor2="" vendor3="" vendor_slct="" packages="" efi_entr_del="" wrlss_rgd="" sanity="" install="" bootldr_pkgs="" devel="" REGDOM="" vga_bootopts="" btrfs_bootopts="" trim="" swapmode="" homecrypt="" greeter="" revision="" greeternmbr="" cust_bootopts="" bluetooth="" vmpkgs="" vm_services="" perf_stream="" displaymanager="" wireless_reg="" bootmode="" bootloader="" vga_slct="" espsize="" autoroot="" autoesp="" autoxboot="" autohome="" autoswap="" rootprt="" espprt="" xbootprt="" homeprt="" swapprt="" partok="" use_manpreset="" instl_drive="" sgdsk_nmbr="" part_mode="" preset="" capacity="" cap_gib="" rootsize="" sgdrive="" cgdrive="" smartpart="" presetpart="" prcnt="" roottype="" stage_prompt="" zram="" zram_bootopts="" xbootloader="" multibooting="" hypervisor="" mkinitcpio_mods="" uki="" ukify="" slct_autoprt="" cng_espmnt="" sep_home="" encr_swap_bootopts="" bitness="") + vars=(LOCALESET="" SETLOCALE="" lcl_slct="" USERNAME="" kernelnmbr="" fs="" vgapkgs="" vgacount="" vgacard="" intelcount="" intelcards="" nvidiacount="" nvidiacards="" amdcount="" amdcards="" vgaconf="" vga_conf="" vga_setup="" vendor="" vendor1="" vendor2="" vendor3="" vendor_slct="" packages="" efi_entr_del="" wrlss_rgd="" sanity="" install="" bootldr_pkgs="" devel="" REGDOM="" vga_bootopts="" btrfs_bootopts="" trim="" swapmode="" homecrypt="" greeter="" revision="" greeternmbr="" cust_bootopts="" bluetooth="" vmpkgs="" vm_services="" perf_stream="" displaymanager="" wireless_reg="" bitness="" bootloader="" vga_slct="" espsize="" autoroot="" autoesp="" autoxboot="" autohome="" autoswap="" rootprt="" espprt="" xbootprt="" homeprt="" swapprt="" partok="" use_manpreset="" instl_drive="" sgdsk_nmbr="" part_mode="" preset="" capacity="" cap_gib="" rootsize="" sgdrive="" cgdrive="" smartpart="" presetpart="" prcnt="" roottype="" stage_prompt="" zram="" zram_bootopts="" xbootloader="" multibooting="" hypervisor="" mkinitcpio_mods="" uki="" ukify="" slct_autoprt="" cng_espmnt="" sep_home="" encr_swap_bootopts="" uefimode="") export "${vars[@]}" clear first_check