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
This commit is contained in:
Jane Doe 2024-10-23 17:13:03 +00:00
parent 15140d7a47
commit 7df3b742a5

144
Amelia.sh
View file

@ -1,55 +1,41 @@
#!/bin/bash #!/bin/bash
# Amelia Installer # Amelia Installer
# Version: 8.0.3 # https://gitlab.com/prism7/archery
# Version: 8.0.4
set -euo pipefail set -euo pipefail
################################################################################################### ###################################################################################################
# COLOR FUNCTIONS # COLOR FUNCTIONS
redbgbl="\e[5;1;41m"
redbg="\e[1;41m" redbg="\e[1;41m"
red="\e[31m" red="\e[31m"
greenbgbl="\e[5;1;42m"
greenbg="\e[1;42m" greenbg="\e[1;42m"
green="\e[32m" green="\e[32m"
yellowbgbl="\e[5;1;43m"
yellowbg="\e[1;43m" yellowbg="\e[1;43m"
yellow="\e[33m" yellow="\e[33m"
yellowl="\e[93m" yellowl="\e[93m"
bluebgbl="\e[5;1;44m"
bluebg="\e[1;44m" bluebg="\e[1;44m"
blue="\e[94m" blue="\e[94m"
magentabgbl="\e[5;1;45m"
magentabg="\e[1;45m" magentabg="\e[1;45m"
magenta="\e[35m" magenta="\e[35m"
cyanbgbl="\e[5;1;46m"
cyanbg="\e[1;46m" cyanbg="\e[1;46m"
cyan="\e[36m" cyan="\e[36m"
bwhite="\e[0;97m" bwhite="\e[0;97m"
nc="\e[0m" nc="\e[0m"
REDBGBL() {
echo -e "${redbgbl} $1${nc}"
}
REDBG() { REDBG() {
echo -e "${redbg} $1${nc}" echo -e "${redbg} $1${nc}"
} }
RED() { RED() {
echo -e "${red} $1${nc}" echo -e "${red} $1${nc}"
} }
GREENBGBL() {
echo -e "${greenbgbl} $1${nc}"
}
GREENBG() { GREENBG() {
echo -e "${greenbg} $1${nc}" echo -e "${greenbg} $1${nc}"
} }
GREEN() { GREEN() {
echo -e "${green} $1${nc}" echo -e "${green} $1${nc}"
} }
YELLOWBGBL() {
echo -e "${yellowbgbl} $1${nc}"
}
YELLOWBG() { YELLOWBG() {
echo -e "${yellowbg} $1${nc}" echo -e "${yellowbg} $1${nc}"
} }
@ -59,27 +45,18 @@ YELLOW() {
YELLOWL() { YELLOWL() {
echo -e "${yellowl} $1${nc}" echo -e "${yellowl} $1${nc}"
} }
BLUEBGBL() {
echo -e "${bluebgbl} $1${nc}"
}
BLUEBG() { BLUEBG() {
echo -e "${bluebg} $1${nc}" echo -e "${bluebg} $1${nc}"
} }
BLUE() { BLUE() {
echo -e "${blue} $1${nc}" echo -e "${blue} $1${nc}"
} }
MAGENTABGBL() {
echo -e "${magentabgbl} $1${nc}"
}
MAGENTABG() { MAGENTABG() {
echo -e "${magentabg} $1${nc}" echo -e "${magentabg} $1${nc}"
} }
MAGENTA() { MAGENTA() {
echo -e "${magenta} $1${nc}" echo -e "${magenta} $1${nc}"
} }
CYANBGBL() {
echo -e "${cyanbgbl} $1${nc}"
}
CYANBG() { CYANBG() {
echo -e "${cyanbg} $1${nc}" echo -e "${cyanbg} $1${nc}"
} }
@ -96,6 +73,7 @@ WHITEB() {
################################################################################################### ###################################################################################################
# PROMPT FUNCTIONS # PROMPT FUNCTIONS
skip() { skip() {
sleep 0.2 sleep 0.2
YELLOW " YELLOW "
@ -242,7 +220,7 @@ completion_err() {
(*) ${nc}Please complete${yellowl} '${stage_prompt}' ${nc}to continue (*) ${nc}Please complete${yellowl} '${stage_prompt}' ${nc}to continue
"| pv -qL 60 "| pv -qL 70
} }
intel() { intel() {
line2 line2
@ -336,7 +314,7 @@ first_check() {
if [[ "${tty}" == *"tty"* && "${run_as}" == "root" ]]; then if [[ "${tty}" == *"tty"* && "${run_as}" == "root" ]]; then
until slct_font; do : ; done until slct_font; do : ; done
else 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 echo
fi fi
fi fi
@ -389,19 +367,19 @@ Enter a number: "
################################################################################################### ###################################################################################################
uefi_check() { uefi_check() {
bootmode="$(cat /sys/firmware/efi/fw_platform_size)" bitness="$(cat /sys/firmware/efi/fw_platform_size)"
local prompt="UEFI ${bootmode}-bit Mode" local prompt="UEFI ${bitness}-bit Mode"
sleep 0.2 sleep 0.2
NC " NC "
${magenta}###${nc}---------------------------------${magenta}[ ${bwhite}UEFI Mode Verification${nc} ${magenta}]${nc}---------------------------------${magenta}### ${magenta}###${nc}---------------------------------${magenta}[ ${bwhite}UEFI Mode Verification${nc} ${magenta}]${nc}---------------------------------${magenta}###
" "
if [[ "${bootmode}" == "64" ]]; then if [[ "${bitness}" == "64" ]]; then
bitness="x86_64-efi" uefimode="x86_64-efi"
ok ok
elif [[ "${bootmode}" == "32" ]]; then elif [[ "${bitness}" == "32" ]]; then
bitness="i386-efi" uefimode="i386-efi"
ok ok
else else
RED " RED "
@ -491,7 +469,7 @@ ${magenta}###${nc}----------------------------------------${magenta}[ ${bwhite}M
CYAN " CYAN "
(*) ${nc}Select ${bwhite}[4] ${nc}to utilize ${yellowl}'Guided Navigation' ${nc}& ${yellowl}'Smart Partitioning' ${nc}functions (*) ${nc}Select ${bwhite}[4] ${nc}to utilize ${yellowl}'Guided Navigation' ${nc}& ${yellowl}'Smart Partitioning' ${nc}functions
" | pv -qL 60 " | pv -qL 70
NC " NC "
[1] Personalization [1] Personalization
@ -2377,7 +2355,7 @@ ${magenta}###${nc}-------------------------------------${magenta}[ ${bwhite}Mult
YELLOW " 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 " 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 ### 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 " BLUE "
@ -3017,7 +2995,7 @@ ${multi_esp}
" "
if [[ "${multibooting}" == "n" ]]; then if [[ "${multibooting}" == "n" ]]; then
YELLOW " 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 elif [[ "${multibooting}" == "y" ]]; then
YELLOW " 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 ### 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 " 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 ### 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 " 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 ### 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 " BLUE "
@ -3201,8 +3179,15 @@ ${multi_swap}
if [[ -e "${root_dev}" ]]; then if [[ -e "${root_dev}" ]]; then
rootprt="ok" rootprt="ok"
if [[ "${autoroot}" == "y" ]]; then if [[ "${autoroot}" == "y" ]]; then
local prompt="Confirm /Root Partition" if [[ "${presetpart}" == "y" || "${smartpart}" == "y" ]]; then
sleep 0.2
NC "
==> [Linux x86-64 /Root ${green}OK${nc}] "
else
local prompt="Confirmed /Root Partition"
ok ok
fi
else else
sleep 0.2 sleep 0.2
NC " NC "
@ -3235,10 +3220,22 @@ ${multi_swap}
if [[ "${espsize}" -ge "209715200" ]]; then if [[ "${espsize}" -ge "209715200" ]]; then
espprt="ok" espprt="ok"
xbootloader="no" xbootloader="no"
if [[ "${autoesp}" == "y" ]]; then
if [[ "${presetpart}" == "y" || "${smartpart}" == "y" ]]; then
sleep 0.2 sleep 0.2
NC " NC "
==> [EFI System Partition ${green}OK${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
if [[ -e "${esp_dev}" && "${espsize}" -lt "209715200" ]]; then if [[ -e "${esp_dev}" && "${espsize}" -lt "209715200" ]]; then
@ -3248,13 +3245,32 @@ ${multi_swap}
if [[ -e "${xboot_dev}" ]]; then if [[ -e "${xboot_dev}" ]]; then
xbootprt="ok" xbootprt="ok"
espprt="ok" espprt="ok"
if [[ "${autoesp}" == "y" ]]; then
if [[ "${presetpart}" == "y" || "${smartpart}" == "y" ]]; then
sleep 0.2 sleep 0.2
NC " NC "
==> [EFI System Partition ${green}OK${nc}] " ==> [EFI System Partition ${green}OK${nc}] "
if [[ "${autoxboot}" == "y" ]]; then else
local prompt="Confirm /XBOOTLDR Partition" local prompt="Confirmed EFI System Partition"
ok ok
fi
else
sleep 0.2
NC "
==> [EFI System Partition ${green}OK${nc}] "
fi
if [[ "${autoxboot}" == "y" ]]; then
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 else
sleep 0.2 sleep 0.2
NC " NC "
@ -3296,10 +3312,22 @@ ${multi_swap}
elif [[ "${espmnt}" == "1" ]]; then elif [[ "${espmnt}" == "1" ]]; then
espprt="ok" espprt="ok"
xbootloader="no" xbootloader="no"
if [[ "${autoesp}" == "y" ]]; then
if [[ "${presetpart}" == "y" || "${smartpart}" == "y" ]]; then
sleep 0.2 sleep 0.2
NC " NC "
==> [EFI System Partition ${green}OK${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 fi
fi fi
@ -3309,8 +3337,15 @@ ${multi_swap}
if [[ -e "${home_dev}" ]]; then if [[ -e "${home_dev}" ]]; then
homeprt="ok" homeprt="ok"
if [[ "${autohome}" == "y" ]]; then if [[ "${autohome}" == "y" ]]; then
local prompt="Confirm /Home Partition" if [[ "${presetpart}" == "y" || "${smartpart}" == "y" ]]; then
sleep 0.2
NC "
==> [Linux /Home ${green}OK${nc}] "
else
local prompt="Confirmed /Home Partition"
ok ok
fi
else else
sleep 0.2 sleep 0.2
NC " NC "
@ -3332,8 +3367,15 @@ ${multi_swap}
if [[ -e "${swap_dev}" ]]; then if [[ -e "${swap_dev}" ]]; then
swapprt="ok" swapprt="ok"
if [[ "${autoswap}" == "y" ]]; then if [[ "${autoswap}" == "y" ]]; then
local prompt="Confirm /Swap Partition" if [[ "${presetpart}" == "y" || "${smartpart}" == "y" ]]; then
sleep 0.2
NC "
==> [Linux /Swap ${green}OK${nc}] "
else
local prompt="Confirmed /Swap Partition"
ok ok
fi
else else
sleep 0.2 sleep 0.2
NC " NC "
@ -3397,7 +3439,7 @@ ${multi_swap}
partok="${partok:-y}" partok="${partok:-y}"
partok="${partok,,}" partok="${partok,,}"
local prompt="Confirm Disk" local prompt="Disk Partitioning"
local stage_prompt="Partitioning" local stage_prompt="Partitioning"
if [[ "${partok}" == "y" ]]; then if [[ "${partok}" == "y" ]]; then
@ -3683,7 +3725,7 @@ instl() {
(*) ${nc}Please complete ${yellowl}'Locale & Keyboard Layout Selection'${nc} to continue (*) ${nc}Please complete ${yellowl}'Locale & Keyboard Layout Selection'${nc} to continue
"| pv -qL 60 "| pv -qL 70
until slct_locale; do : ; done until slct_locale; do : ; done
until slct_kbd; do : ; done until slct_kbd; do : ; done
fi fi
@ -4677,7 +4719,7 @@ ${magenta}###${nc}-------------------------------${magenta}[ ${bwhite}Confirm In
revise() { revise() {
revision="yes" 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[@]}" export "${reset[@]}"
until dtct_hyper; do : ; done until dtct_hyper; do : ; done
until slct_krnl; do : ; done until slct_krnl; do : ; done
@ -5336,7 +5378,7 @@ GRUB
local stage_prompt="Grub Installation" local stage_prompt="Grub Installation"
if [[ "${sb_sign}" == "y" ]]; then if [[ "${sb_sign}" == "y" ]]; then
if arch-chroot /mnt <<-SBGRUBINST > /dev/null 2>&1 ; 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 sed -i 's/SecureBoot/SecureB00t/' ${btldr_esp_mount}/EFI/GRUB/grubx64.efi || exit
grub-mkconfig -o /boot/grub/grub.cfg || exit grub-mkconfig -o /boot/grub/grub.cfg || exit
SBGRUBINST SBGRUBINST
@ -5346,7 +5388,7 @@ SBGRUBINST
fi fi
elif [[ "${sb_sign}" == "n" ]]; then elif [[ "${sb_sign}" == "n" ]]; then
if arch-chroot /mnt <<-GRUBINST > /dev/null 2>&1 ; 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 grub-mkconfig -o /boot/grub/grub.cfg || exit
GRUBINST GRUBINST
stage_ok stage_ok
@ -6056,7 +6098,7 @@ OPTIMIZED
tty="$(tty)" tty="$(tty)"
disks="$(lsblk --nodeps --paths --noheadings --output=name,size,model | cat --number)" disks="$(lsblk --nodeps --paths --noheadings --output=name,size,model | cat --number)"
trg="" 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[@]}" export "${vars[@]}"
clear clear
first_check first_check