Add: 'Automatic Partitioning' > 'Smart Partitioning' & 'Manual Presets': Now, when an Extended Bootloader Partition is needed the installer will create it without any user interaction

Change: Bootloader configuration (btldr_conf) function revised to comply with latest installer changes
Add: Edited a few prompts for visual/aesthetic purposes
This commit is contained in:
elementrick 2024-09-11 16:49:42 +00:00
parent 076d59db95
commit 4ccce091b5

220
Amelia.sh
View file

@ -1,7 +1,7 @@
#!/bin/bash
# Amelia Installer
# Version: 7.2
# Version: 7.4
set -euo pipefail
trap 's=$?; echo "$0: Error on line "$LINENO": $BASH_COMMAND"; exit $s' ERR
@ -107,6 +107,12 @@ reload() {
--> [${green}Reloading${nc}] "
}
process() {
sleep 0.2
NC "
--> [${green}Processing..${nc}] "
}
invalid() {
sleep 0.2
RED "
@ -489,11 +495,10 @@ ${magenta}###${nc}----------------------------------------${magenta}[ ${bwhite}M
YELLOW "
> Make a selection: "
RED "
CYAN "
---------------------------------------------------------------------
### ${yellow}Select ${bwhite}[4] ${nc}${yellow}for ${nc}'Guided Navigation' ${yellow}and ${nc}'Smart Partitioning' ${red}###
---------------------------------------------------------------------"
*** ${nc}Select ${bwhite}[4] ${nc}to utilize ${yellowl}'Guided Navigation' ${nc}& ${yellowl}'Smart Partitioning' ${nc}functions ${cyan}***
"
NC "
[1] Personalization
@ -1928,7 +1933,7 @@ ${magenta}###${nc}--------------------------------------${magenta}[ ${bwhite}Des
[11] Basic Arch Linux (No GUI)
[12] Custom Arch Linux ${red}[!] EXPERTS ONLY [!] "
[12] Custom Arch Linux ${red}# EXPERTS ONLY # "
BLUE "
@ -2427,10 +2432,12 @@ ${magenta}###${nc}------------------------------------${magenta}[ ${bwhite}Disk
while [[ -n "${gpt_dsk_nmbr}" ]]; do
YELLOW "
> Select a disk to manage its GPT:
### [Type ${nc}'?'${yellow} for help, ${nc}'x'${yellow} for extra functionality or ${nc}'q'${yellow} to quit]"
> Select a disk to manage its GPT:
### Select disk and:
### Type ${nc}'?'${yellow} for help, ${nc}'x'${yellow} for extra functionality or ${nc}'q'${yellow} to quit "
NC "
${disks}"
@ -2604,6 +2611,7 @@ Enter a Preset number ${bwhite}(empty to skip)${blue}: "
###################################################################################################
auto_part() {
slct_autoprt="yes"
local prompt="Disk Partitions"
local stage_prompt="Auto-Partitioning"
sleep 0.2
@ -2634,24 +2642,25 @@ ${magenta}###${nc}---------------------------------${magenta}[ ${bwhite}Automati
elif [[ "${smartpart}" == "n" ]]; then
sgdsk_nmbr="${instl_dsk_nmbr}"
use_manpreset="yes"
process
until man_preset; do : ; done
else
y_n
return 1
fi
else
YELLOW "
YELLOW "
> Select a disk for Auto-Partitioning: "
NC "
NC "
${disks}"
BLUE "
BLUE "
Enter a disk number ${bwhite}(empty to skip)${blue}: "
read -r -p "
read -r -p "
==> " sgdsk_nmbr
echo
echo
fi
if [[ -n "${sgdsk_nmbr}" ]]; then
@ -2691,6 +2700,7 @@ Enter a disk number ${bwhite}(empty to skip)${blue}: "
until man_preset; do : ; done
fi
elif [[ -z "${preset}" ]] ; then
process
until manual_part; do : ; done
return 0
fi
@ -2755,10 +2765,18 @@ Enter a Custom Percentage number ${nc}e.g. 30 ${bwhite}(empty to skip)${blue}: "
case "${preset}" in
1)
sgdisk -o "${sgdrive}" > /dev/null 2>&1 || stage_fail
sgdisk -I -n1:0:+512M -t1:ef00 -c1:ESP "${sgdrive}" > /dev/null 2>&1 || stage_fail
sgdisk -I -n2:0:0 -t2:8304 -c2:Root "${sgdrive}" > /dev/null 2>&1 || stage_fail
partprobe -s "${sgdrive}" > /dev/null 2>&1 || stage_fail
if [[ "${xbootloader}" == "yes" ]]; then
sgdisk -o "${sgdrive}" > /dev/null 2>&1 || stage_fail
sgdisk -I -n1:0:+200M -t1:ef00 -c1:ESP "${sgdrive}" > /dev/null 2>&1 || stage_fail
sgdisk -I -n2:0:+300M -t2:ea00 -c2:XBOOTLDR "${sgdrive}" > /dev/null 2>&1 || stage_fail
sgdisk -I -n3:0:0 -t3:8304 -c3:ROOT "${sgdrive}" > /dev/null 2>&1 || stage_fail
partprobe -s "${sgdrive}" > /dev/null 2>&1 || stage_fail
else
sgdisk -o "${sgdrive}" > /dev/null 2>&1 || stage_fail
sgdisk -I -n1:0:+512M -t1:ef00 -c1:ESP "${sgdrive}" > /dev/null 2>&1 || stage_fail
sgdisk -I -n2:0:0 -t2:8304 -c2:ROOT "${sgdrive}" > /dev/null 2>&1 || stage_fail
partprobe -s "${sgdrive}" > /dev/null 2>&1 || stage_fail
fi
if [[ "${install}" == "yes" ]]; then
autopart="yes"
until sanity_check; do : ; done
@ -2766,12 +2784,22 @@ Enter a Custom Percentage number ${nc}e.g. 30 ${bwhite}(empty to skip)${blue}: "
ok
fi ;;
2)
until set_swapsize; do : ; done
sgdisk -o "${sgdrive}" > /dev/null 2>&1 || stage_fail
sgdisk -I -n1:0:+512M -t1:ef00 -c1:ESP "${sgdrive}" > /dev/null 2>&1 || stage_fail
sgdisk -I -n2:0:+"${swapsize}"G -t2:8200 -c2:Swap "${sgdrive}" > /dev/null 2>&1 || stage_fail
sgdisk -I -n3:0:0 -t3:8304 -c3:Root "${sgdrive}" > /dev/null 2>&1 || stage_fail
partprobe -s "${sgdrive}" > /dev/null 2>&1 || stage_fail
if [[ "${xbootloader}" == "yes" ]]; then
until set_swapsize; do : ; done
sgdisk -o "${sgdrive}" > /dev/null 2>&1 || stage_fail
sgdisk -I -n1:0:+200M -t1:ef00 -c1:ESP "${sgdrive}" > /dev/null 2>&1 || stage_fail
sgdisk -I -n2:0:+300M -t2:ea00 -c2:XBOOTLDR "${sgdrive}" > /dev/null 2>&1 || stage_fail
sgdisk -I -n3:0:+"${swapsize}"G -t3:8200 -c3:SWAP "${sgdrive}" > /dev/null 2>&1 || stage_fail
sgdisk -I -n4:0:0 -t4:8304 -c4:ROOT "${sgdrive}" > /dev/null 2>&1 || stage_fail
partprobe -s "${sgdrive}" > /dev/null 2>&1 || stage_fail
else
until set_swapsize; do : ; done
sgdisk -o "${sgdrive}" > /dev/null 2>&1 || stage_fail
sgdisk -I -n1:0:+512M -t1:ef00 -c1:ESP "${sgdrive}" > /dev/null 2>&1 || stage_fail
sgdisk -I -n2:0:+"${swapsize}"G -t2:8200 -c2:SWAP "${sgdrive}" > /dev/null 2>&1 || stage_fail
sgdisk -I -n3:0:0 -t3:8304 -c3:ROOT "${sgdrive}" > /dev/null 2>&1 || stage_fail
partprobe -s "${sgdrive}" > /dev/null 2>&1 || stage_fail
fi
if [[ "${install}" == "yes" ]]; then
autopart="yes"
until sanity_check; do : ; done
@ -2779,11 +2807,20 @@ Enter a Custom Percentage number ${nc}e.g. 30 ${bwhite}(empty to skip)${blue}: "
ok
fi ;;
3)
sgdisk -o "${sgdrive}" > /dev/null 2>&1 || stage_fail
sgdisk -I -n1:0:+512M -t1:ef00 -c1:ESP "${sgdrive}" > /dev/null 2>&1 || stage_fail
sgdisk -I -n2:0:+"${rootsize}"G -t2:8304 -c2:Root "${sgdrive}" > /dev/null 2>&1 || stage_fail
sgdisk -I -n3:0:0 -t3:8302 -c3:Home "${sgdrive}" > /dev/null 2>&1 || stage_fail
partprobe -s "${sgdrive}" > /dev/null 2>&1 || stage_fail
if [[ "${xbootloader}" == "yes" ]]; then
sgdisk -o "${sgdrive}" > /dev/null 2>&1 || stage_fail
sgdisk -I -n1:0:+200M -t1:ef00 -c1:ESP "${sgdrive}" > /dev/null 2>&1 || stage_fail
sgdisk -I -n2:0:+300M -t2:ea00 -c2:XBOOTLDR "${sgdrive}" > /dev/null 2>&1 || stage_fail
sgdisk -I -n3:0:+"${rootsize}"G -t3:8304 -c3:ROOT "${sgdrive}" > /dev/null 2>&1 || stage_fail
sgdisk -I -n4:0:0 -t4:8302 -c4:HOME "${sgdrive}" > /dev/null 2>&1 || stage_fail
partprobe -s "${sgdrive}" > /dev/null 2>&1 || stage_fail
else
sgdisk -o "${sgdrive}" > /dev/null 2>&1 || stage_fail
sgdisk -I -n1:0:+512M -t1:ef00 -c1:ESP "${sgdrive}" > /dev/null 2>&1 || stage_fail
sgdisk -I -n2:0:+"${rootsize}"G -t2:8304 -c2:ROOT "${sgdrive}" > /dev/null 2>&1 || stage_fail
sgdisk -I -n3:0:0 -t3:8302 -c3:HOME "${sgdrive}" > /dev/null 2>&1 || stage_fail
partprobe -s "${sgdrive}" > /dev/null 2>&1 || stage_fail
fi
if [[ "${install}" == "yes" ]]; then
autopart="yes"
until sanity_check; do : ; done
@ -2791,13 +2828,24 @@ Enter a Custom Percentage number ${nc}e.g. 30 ${bwhite}(empty to skip)${blue}: "
ok
fi ;;
4)
until set_swapsize; do : ; done
sgdisk -o "${sgdrive}" > /dev/null 2>&1 || stage_fail
sgdisk -I -n1:0:+512M -t1:ef00 -c1:ESP "${sgdrive}" > /dev/null 2>&1 || stage_fail
sgdisk -I -n2:0:+"${swapsize}"G -t2:8200 -c2:Swap "${sgdrive}" > /dev/null 2>&1 || stage_fail
sgdisk -I -n3:0:+"${rootsize}"G -t3:8304 -c3:Root "${sgdrive}" > /dev/null 2>&1 || stage_fail
sgdisk -I -n4:0:0 -t4:8302 -c4:Home "${sgdrive}" > /dev/null 2>&1 || stage_fail
partprobe -s "${sgdrive}" > /dev/null 2>&1 || stage_fail
if [[ "${xbootloader}" == "yes" ]]; then
until set_swapsize; do : ; done
sgdisk -o "${sgdrive}" > /dev/null 2>&1 || stage_fail
sgdisk -I -n1:0:+512M -t1:ef00 -c1:ESP "${sgdrive}" > /dev/null 2>&1 || stage_fail
sgdisk -I -n2:0:+300M -t2:ea00 -c2:XBOOTLDR "${sgdrive}" > /dev/null 2>&1 || stage_fail
sgdisk -I -n3:0:+"${swapsize}"G -t3:8200 -c3:SWAP "${sgdrive}" > /dev/null 2>&1 || stage_fail
sgdisk -I -n4:0:+"${rootsize}"G -t4:8304 -c4:ROOT "${sgdrive}" > /dev/null 2>&1 || stage_fail
sgdisk -I -n5:0:0 -t5:8302 -c5:HOME "${sgdrive}" > /dev/null 2>&1 || stage_fail
partprobe -s "${sgdrive}" > /dev/null 2>&1 || stage_fail
else
until set_swapsize; do : ; done
sgdisk -o "${sgdrive}" > /dev/null 2>&1 || stage_fail
sgdisk -I -n1:0:+512M -t1:ef00 -c1:ESP "${sgdrive}" > /dev/null 2>&1 || stage_fail
sgdisk -I -n2:0:+"${swapsize}"G -t2:8200 -c2:SWAP "${sgdrive}" > /dev/null 2>&1 || stage_fail
sgdisk -I -n3:0:+"${rootsize}"G -t3:8304 -c3:ROOT "${sgdrive}" > /dev/null 2>&1 || stage_fail
sgdisk -I -n4:0:0 -t4:8302 -c4:HOME "${sgdrive}" > /dev/null 2>&1 || stage_fail
partprobe -s "${sgdrive}" > /dev/null 2>&1 || stage_fail
fi
if [[ "${install}" == "yes" ]]; then
autopart="yes"
until sanity_check; do : ; done
@ -2805,11 +2853,16 @@ Enter a Custom Percentage number ${nc}e.g. 30 ${bwhite}(empty to skip)${blue}: "
ok
fi ;;
"")
if [[ "${smartpart}" == "n" ]]; then
if [[ "${smartpart}" == "n" ]]; then
reload
until disk_mngr; do : ; done
return 0
fi
if [[ "${slct_autoprt}" == "yes" ]]; then
reload
until dsks_submn; do : ; done
return 0
fi
sleep 0.2
RED "
--------------------------------
@ -3306,23 +3359,8 @@ ${multi_swap}
---------------------------------------------------"
fi
#..................................................................................................
if [[ -e "${esp_dev}" ]]; then
espsize="$(lsblk -dno SIZE --bytes "${esp_dev}")"
if [[ "${multibooting}" == "y" && "${bootloader}" == "1" && "${espmnt}" == "1" && "${espsize}" -lt "209715200" ]]; then
xbootloader="yes"
if [[ ! -e "${xboot_dev}" ]]; then
sleep 0.2
RED "
------------------------------------------------------
### ${yellow}A Linux Extended Boot Partition is mandatory ${red}###
------------------------------------------------------"
fi
else
xbootloader="no"
fi
fi
if [[ ${xbootloader} == "yes" ]]; then
if [[ "${bootloader}" == "1" && "${espmnt}" == "1" ]]; then
xbootloader="yes"
if [[ -e "${xboot_dev}" ]]; then
xbootprt="ok"
if [[ "${autoxboot}" == "y" ]]; then
@ -3338,13 +3376,24 @@ ${multi_swap}
xbootprt="fail"
sleep 0.2
RED "
------------------------------------------------------
### ${yellow}A Linux Extended Boot Partition is mandatory ${red}###
------------------------------------------------------"
sleep 0.2
RED "
----------------------------------------------------
### ${yellow}Linux Extended Boot Partition not detected ${red}###
----------------------------------------------------"
fi
fi
else
xbootloader="no"
fi
#..................................................................................................
if [[ -e "${esp_dev}" ]]; then
espsize="$(lsblk -dno SIZE --bytes "${esp_dev}")"
fi
if [[ ! -e "${esp_dev}" ]]; then
espprt="fail"
sleep 0.2
@ -3361,7 +3410,7 @@ ${multi_swap}
==> [EFI System Partition ${green}OK${nc}] "
elif [[ "${xbootprt}" == "fail" ]]; then
espprt="fail"
fi
fi
elif [[ -e "${esp_dev}" && "${espsize}" -lt "209715200" && "${xbootloader}" == "no" ]]; then
if [[ "${bootloader}" == "1" ]]; then
espprt="fail"
@ -3485,14 +3534,14 @@ ${multi_swap}
elif [[ "${partok}" == "n" ]]; then
if [[ "${multibooting}" == "n" ]]; then
if [[ "${smartpart}" == "y" ]]; then
reload
process
until manual_part; do : ; done
else
reload
process
until auto_part; do : ; done
fi
elif [[ "${multibooting}" == "y" ]]; then
reload
process
until manual_part; do : ; done
fi
else
@ -3563,14 +3612,14 @@ ${multi_swap}
fi
elif [[ "${multibooting}" == "n" ]]; then
if [[ "${smartpart}" == "n" && -z "${preset}" ]] ; then
reload
process
until manual_part; do : ; done
elif [[ "${smartpart}" == "n" && -n "${preset}" ]] ; then
local stage_prompt="Partitioning"
line2
stage_fail
else
reload
process
until auto_part; do : ; done
fi
fi
@ -5312,9 +5361,9 @@ btldr_conf() {
if [[ "${bootloader}" == "1" ]]; then
cnfg
local stage_prompt="Systemd-boot"
if [[ "${espmnt}" == "1" && "${xbootloader}" == "yes" ]]; then
if [[ "${espmnt}" == "1" ]]; then
if [[ "${uki}" == "n" ]]; then
if arch-chroot /mnt <<-XBOOTCTL_NOUKI > /dev/null 2>&1 ; then
if arch-chroot /mnt <<-XBOOTCTL > /dev/null 2>&1 ; then
bootctl --esp-path=/efi --boot-path=/boot install || exit
echo "default arch.conf" > /boot/loader/loader.conf || exit
cat <<-SDBOOT_CONF > /boot/loader/entries/arch.conf || exit
@ -5324,51 +5373,24 @@ btldr_conf() {
options rw ${boot_opts}
SDBOOT_CONF
systemctl enable systemd-boot-update || exit
XBOOTCTL_NOUKI
XBOOTCTL
stage_ok
else
stage_fail
fi
elif [[ "${uki}" == "y" ]]; then
if arch-chroot /mnt <<-XBOOTCTL_UKI > /dev/null 2>&1 ; then
if arch-chroot /mnt <<-XBOOTCTL > /dev/null 2>&1 ; then
bootctl --esp-path=/efi --boot-path=/boot install || exit
systemctl enable systemd-boot-update || exit
XBOOTCTL_UKI
XBOOTCTL
stage_ok
else
stage_fail
fi
fi
elif [[ "${espmnt}" == "1" && "${xbootloader}" == "no" ]]; then
elif [[ "${espmnt}" == "2" ]]; then
if [[ "${uki}" == "n" ]]; then
if arch-chroot /mnt <<-BOOTCTL_NOUKI > /dev/null 2>&1 ; then
bootctl --esp-path=/efi install || exit
echo "default arch.conf" > /boot/loader/loader.conf || exit
cat <<-SDBOOT_CONF > /boot/loader/entries/arch.conf || exit
title ${entrname}
linux /vmlinuz-${kernel}
initrd /initramfs-${kernel}.img
options rw ${boot_opts}
SDBOOT_CONF
systemctl enable systemd-boot-update || exit
BOOTCTL_NOUKI
stage_ok
else
stage_fail
fi
elif [[ "${uki}" == "y" ]]; then
if arch-chroot /mnt <<-BOOTCTL_UKI > /dev/null 2>&1 ; then
bootctl --esp-path=/efi install || exit
systemctl enable systemd-boot-update || exit
BOOTCTL_UKI
stage_ok
else
stage_fail
fi
fi
else
if [[ "${uki}" == "n" ]]; then
if arch-chroot /mnt <<-BOOTCTL_NOUKI > /dev/null 2>&1 ; then
if arch-chroot /mnt <<-BOOTCTL > /dev/null 2>&1 ; then
bootctl install || exit
echo "default arch.conf" > /boot/loader/loader.conf || exit
cat <<-SDBOOT_CONF > /boot/loader/entries/arch.conf || exit
@ -5378,16 +5400,16 @@ BOOTCTL_UKI
options rw ${boot_opts}
SDBOOT_CONF
systemctl enable systemd-boot-update || exit
BOOTCTL_NOUKI
BOOTCTL
stage_ok
else
stage_fail
fi
elif [[ "${uki}" == "y" ]]; then
if arch-chroot /mnt <<-BOOTCTL_UKI > /dev/null 2>&1 ; then
if arch-chroot /mnt <<-BOOTCTL > /dev/null 2>&1 ; then
bootctl install || exit
systemctl enable systemd-boot-update || exit
BOOTCTL_UKI
BOOTCTL
stage_ok
else
stage_fail