mirror of
https://gitlab.com/prism7/archery.git
synced 2025-02-15 08:29:17 +01:00
A new mechanism has been added, to scan the partitions on the selected (installation) disk and if more than one of each type {root/EFI/home/swap} is detected,
to Auto-Assign the 1st partition of each type, to be used by systemd's automation in the installation (as the 'Discoverable Partitions Specifications' dictate). Of course comes with its own menu/prompts, for user interaction.
This commit is contained in:
parent
1c5dad5fec
commit
c322988b4c
1 changed files with 245 additions and 26 deletions
243
Amelia.sh
243
Amelia.sh
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Amelia Installer
|
# Amelia Installer
|
||||||
# Version: 5.1
|
# Version: 5.2
|
||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
trap 's=$?; echo "$0: Error on line "$LINENO": $BASH_COMMAND"; exit $s' ERR
|
trap 's=$?; echo "$0: Error on line "$LINENO": $BASH_COMMAND"; exit $s' ERR
|
||||||
|
@ -133,7 +133,6 @@ vm_skip (){
|
||||||
"
|
"
|
||||||
skip
|
skip
|
||||||
}
|
}
|
||||||
|
|
||||||
line2 (){
|
line2 (){
|
||||||
printf '\n\n'
|
printf '\n\n'
|
||||||
}
|
}
|
||||||
|
@ -154,6 +153,7 @@ unmount (){
|
||||||
${magenta}###${nc}-----------------------------------${magenta}[ ${bwhite}Unmount Filesystems${nc} ${magenta}]${nc}-----------------------------------${magenta}###${nc}
|
${magenta}###${nc}-----------------------------------${magenta}[ ${bwhite}Unmount Filesystems${nc} ${magenta}]${nc}-----------------------------------${magenta}###${nc}
|
||||||
"
|
"
|
||||||
if umount -R /mnt > /dev/null 2>&1 ; then
|
if umount -R /mnt > /dev/null 2>&1 ; then
|
||||||
|
swapoff "${swap_dev}" > /dev/null 2>&1
|
||||||
sleep 0.3
|
sleep 0.3
|
||||||
NC "
|
NC "
|
||||||
|
|
||||||
|
@ -248,7 +248,7 @@ arch (){
|
||||||
line3
|
line3
|
||||||
BLUEBG "************************************************************************************************* "
|
BLUEBG "************************************************************************************************* "
|
||||||
BLUEBG " "
|
BLUEBG " "
|
||||||
BLUEBG " ##### ARCH LINUX INSTALLATION ##### "
|
BLUEBG " ##### Arch Linux Installation ##### "
|
||||||
BLUEBG " "
|
BLUEBG " "
|
||||||
BLUEBG "************************************************************************************************* "
|
BLUEBG "************************************************************************************************* "
|
||||||
line2
|
line2
|
||||||
|
@ -462,7 +462,7 @@ Enter a number: "
|
||||||
3)
|
3)
|
||||||
until dsks_submn; do : ; done ;;
|
until dsks_submn; do : ; done ;;
|
||||||
4)
|
4)
|
||||||
instl ;;
|
until instl; do : ; done ;;
|
||||||
"")
|
"")
|
||||||
sleep 0.3
|
sleep 0.3
|
||||||
RED "
|
RED "
|
||||||
|
@ -2396,11 +2396,196 @@ sanity_check (){
|
||||||
|
|
||||||
${magenta}###${nc}--------------------------------------${magenta}[ ${bwhite}Sanity Check${nc} ${magenta}]${nc}--------------------------------------${magenta}###${nc}
|
${magenta}###${nc}--------------------------------------${magenta}[ ${bwhite}Sanity Check${nc} ${magenta}]${nc}--------------------------------------${magenta}###${nc}
|
||||||
"
|
"
|
||||||
root_dev="$(fdisk -l "${instl_drive}" | grep 'root' | awk "{print \$1}")"
|
rootcount="$(fdisk -l "${instl_drive}" | grep -E -c 'root' | awk "{print \$1}")"
|
||||||
boot_dev="$(fdisk -l "${instl_drive}" | grep 'EFI' | awk "{print \$1}")"
|
root_dev="$(fdisk -l "${instl_drive}" | grep -E 'root' | awk "{print \$1}")"
|
||||||
home_dev="$(fdisk -l "${instl_drive}" | grep 'home' | awk "{print \$1}")"
|
multi_root="$(fdisk -l "${instl_drive}" | grep -E 'root' | awk "{print \$1}" | cat --number)"
|
||||||
swap_dev="$(fdisk -l "${instl_drive}" | grep 'swap' | awk "{print \$1}")"
|
root_comply="$(fdisk -l "${instl_drive}" | grep -E 'root' | awk "{print \$1}" | cat --number | grep -E '1[[:blank:]]' | awk "{print \$2}")"
|
||||||
|
bootcount="$(fdisk -l "${instl_drive}" | grep -E -c 'EFI' | awk "{print \$1}")"
|
||||||
|
boot_dev="$(fdisk -l "${instl_drive}" | grep -E 'EFI' | awk "{print \$1}")"
|
||||||
|
multi_boot="$(fdisk -l "${instl_drive}" | grep -E 'EFI' | awk "{print \$1}" | cat --number)"
|
||||||
|
boot_comply="$(fdisk -l "${instl_drive}" | grep -E 'EFI' | awk "{print \$1}" | cat --number | grep -E '1[[:blank:]]' | awk "{print \$2}")"
|
||||||
|
homecount="$(fdisk -l "${instl_drive}" | grep -E -c 'home' | awk "{print \$1}")"
|
||||||
|
home_dev="$(fdisk -l "${instl_drive}" | grep -E 'home' | awk "{print \$1}")"
|
||||||
|
multi_home="$(fdisk -l "${instl_drive}" | grep -E 'home' | awk "{print \$1}" | cat --number)"
|
||||||
|
home_comply="$(fdisk -l "${instl_drive}" | grep -E 'home' | awk "{print \$1}" | cat --number | grep -E '1[[:blank:]]' | awk "{print \$2}")"
|
||||||
|
swapcount="$(fdisk -l "${instl_drive}" | grep -E -c 'swap' | awk "{print \$1}")"
|
||||||
|
swap_dev="$(fdisk -l "${instl_drive}" | grep -E 'swap' | awk "{print \$1}")"
|
||||||
|
multi_swap="$(fdisk -l "${instl_drive}" | grep -E 'swap' | awk "{print \$1}" | cat --number)"
|
||||||
|
swap_comply="$(fdisk -l "${instl_drive}" | grep -E 'swap' | awk "{print \$1}" | cat --number | grep -E '1[[:blank:]]' | awk "{print \$2}")"
|
||||||
|
|
||||||
|
if [[ "${rootcount}" -gt "1" ]]; then
|
||||||
|
local prompt="Confirm /Root Partition"
|
||||||
|
local stage_prompt="Partition"
|
||||||
|
sleep 0.3
|
||||||
|
RED "
|
||||||
|
|
||||||
|
[!] WARNING: Multiple Linux x86-64 /Root Partitions have been detected
|
||||||
|
|
||||||
|
"
|
||||||
|
NC "
|
||||||
|
Linux x86-64 /Root Partitions:
|
||||||
|
|
||||||
|
------------------------------
|
||||||
|
${multi_root}
|
||||||
|
------------------------------
|
||||||
|
"
|
||||||
|
YELLOW "
|
||||||
|
|
||||||
|
### 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 [!]
|
||||||
|
"
|
||||||
|
BLUE "
|
||||||
|
|
||||||
|
|
||||||
|
> Proceed ? [y/n]"
|
||||||
|
read -r -p "
|
||||||
|
==> " autoroot
|
||||||
|
|
||||||
|
if [[ "${autoroot}" == "y" ]]; then
|
||||||
|
root_dev="${root_comply}"
|
||||||
|
ok
|
||||||
|
line2
|
||||||
|
elif [[ "${autoroot}" == "n" ]]; then
|
||||||
|
stage_fail
|
||||||
|
else
|
||||||
|
invalid
|
||||||
|
echo
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "${bootcount}" -gt "1" ]]; then
|
||||||
|
local prompt="Confirm /Boot Partition"
|
||||||
|
local stage_prompt="Partition"
|
||||||
|
sleep 0.3
|
||||||
|
RED "
|
||||||
|
|
||||||
|
[!] WARNING: Multiple EFI Partitions have been detected
|
||||||
|
|
||||||
|
"
|
||||||
|
NC "
|
||||||
|
Linux EFI System Partitions:
|
||||||
|
|
||||||
|
----------------------------
|
||||||
|
${multi_boot}
|
||||||
|
----------------------------
|
||||||
|
"
|
||||||
|
YELLOW "
|
||||||
|
|
||||||
|
### Only the 1st EFI partition on a selected disk can be auto-assigned as a valid EFI partition
|
||||||
|
|
||||||
|
|
||||||
|
### Partition ${nc}${boot_comply} ${yellow}is auto-assigned as such and will be ${red}[!] FORMATTED [!]
|
||||||
|
"
|
||||||
|
BLUE "
|
||||||
|
|
||||||
|
|
||||||
|
> Proceed ? [y/n]"
|
||||||
|
read -r -p "
|
||||||
|
==> " autoboot
|
||||||
|
|
||||||
|
if [[ "${autoboot}" == "y" ]]; then
|
||||||
|
boot_dev="${boot_comply}"
|
||||||
|
ok
|
||||||
|
line2
|
||||||
|
elif [[ "${autoboot}" == "n" ]]; then
|
||||||
|
stage_fail
|
||||||
|
else
|
||||||
|
invalid
|
||||||
|
echo
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "${homecount}" -gt "1" ]]; then
|
||||||
|
local prompt="Confirm /Home Partition"
|
||||||
|
local stage_prompt="Partition"
|
||||||
|
sleep 0.3
|
||||||
|
RED "
|
||||||
|
|
||||||
|
[!] WARNING: Multiple Linux /Home Partitions have been detected
|
||||||
|
|
||||||
|
"
|
||||||
|
NC "
|
||||||
|
Linux /Home Partitions:
|
||||||
|
|
||||||
|
-----------------------
|
||||||
|
${multi_home}
|
||||||
|
-----------------------
|
||||||
|
"
|
||||||
|
YELLOW "
|
||||||
|
|
||||||
|
### 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 [!]
|
||||||
|
"
|
||||||
|
BLUE "
|
||||||
|
|
||||||
|
|
||||||
|
> Proceed ? [y/n]"
|
||||||
|
read -r -p "
|
||||||
|
==> " autohome
|
||||||
|
|
||||||
|
if [[ "${autohome}" == "y" ]]; then
|
||||||
|
home_dev="${home_comply}"
|
||||||
|
ok
|
||||||
|
line2
|
||||||
|
elif [[ "${autohome}" == "n" ]]; then
|
||||||
|
stage_fail
|
||||||
|
else
|
||||||
|
invalid
|
||||||
|
echo
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "${swapcount}" -gt "1" ]]; then
|
||||||
|
local prompt="Confirm /Swap Partition"
|
||||||
|
local stage_prompt="Partition"
|
||||||
|
sleep 0.3
|
||||||
|
RED "
|
||||||
|
|
||||||
|
[!] WARNING: Multiple Linux /Swap Partitions have been detected
|
||||||
|
|
||||||
|
"
|
||||||
|
NC "
|
||||||
|
Linux /Swap Partitions:
|
||||||
|
|
||||||
|
------------------------
|
||||||
|
${multi_swap}
|
||||||
|
------------------------
|
||||||
|
"
|
||||||
|
YELLOW "
|
||||||
|
|
||||||
|
### 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 [!]
|
||||||
|
"
|
||||||
|
BLUE "
|
||||||
|
|
||||||
|
|
||||||
|
> Proceed ? [y/n]"
|
||||||
|
read -r -p "
|
||||||
|
==> " autoswap
|
||||||
|
|
||||||
|
if [[ "${autoswap}" == "y" ]]; then
|
||||||
|
swap_dev="${swap_comply}"
|
||||||
|
ok
|
||||||
|
line2
|
||||||
|
echo
|
||||||
|
elif [[ "${autoswap}" == "n" ]]; then
|
||||||
|
stage_fail
|
||||||
|
else
|
||||||
|
invalid
|
||||||
|
echo
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
local prompt="Installation Disk"
|
||||||
if [[ ! -e "${root_dev}" && ! -e "${boot_dev}" ]]; then
|
if [[ ! -e "${root_dev}" && ! -e "${boot_dev}" ]]; then
|
||||||
sanity="no"
|
sanity="no"
|
||||||
sleep 0.3
|
sleep 0.3
|
||||||
|
@ -2475,29 +2660,37 @@ ${magenta}###${nc}--------------------------------------${magenta}[ ${bwhite}San
|
||||||
return 0
|
return 0
|
||||||
elif [[ -e "${root_dev}" && -e "${boot_dev}" ]]; then
|
elif [[ -e "${root_dev}" && -e "${boot_dev}" ]]; then
|
||||||
sanity="ok"
|
sanity="ok"
|
||||||
|
if [[ "${autoroot}" != "y" ]]; then
|
||||||
sleep 0.3
|
sleep 0.3
|
||||||
NC "
|
NC "
|
||||||
|
|
||||||
==> [Linux x86-64 /Root ${green}OK${nc}] "
|
==> [Linux x86-64 /Root ${green}OK${nc}] "
|
||||||
|
fi
|
||||||
|
if [[ "${autoboot}" != "y" ]]; then
|
||||||
sleep 0.3
|
sleep 0.3
|
||||||
NC "
|
NC "
|
||||||
|
|
||||||
==> [EFI System Partition ${green}OK${nc}] "
|
==> [EFI System Partition ${green}OK${nc}] "
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ -e "${home_dev}" ]]; then
|
if [[ -e "${home_dev}" ]]; then
|
||||||
|
if [[ "${autohome}" != "y" ]]; then
|
||||||
sleep 0.3
|
sleep 0.3
|
||||||
NC "
|
NC "
|
||||||
|
|
||||||
==> [Linux /Home ${green}OK${nc}] "
|
==> [Linux /Home ${green}OK${nc}] "
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ "${swapmode}" == "1" ]]; then
|
if [[ "${swapmode}" == "1" ]]; then
|
||||||
if [[ -e "${swap_dev}" ]]; then
|
if [[ -e "${swap_dev}" ]]; then
|
||||||
|
if [[ "${autoswap}" != "y" ]]; then
|
||||||
sanity="ok"
|
sanity="ok"
|
||||||
sleep 0.3
|
sleep 0.3
|
||||||
NC "
|
NC "
|
||||||
|
|
||||||
==> [Linux /Swap ${green}OK${nc}] "
|
==> [Linux /Swap ${green}OK${nc}] "
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
sanity="no"
|
sanity="no"
|
||||||
sleep 0.3
|
sleep 0.3
|
||||||
|
@ -2766,6 +2959,28 @@ ${magenta}###${nc}----------------------------------${magenta}[ ${bwhite}Swap P
|
||||||
###################################################################################################
|
###################################################################################################
|
||||||
set_mode (){
|
set_mode (){
|
||||||
|
|
||||||
|
if [[ "${rootcount}" -gt "1" || "${bootcount}" -gt "1" || "${homecount}" -gt "1" || "${swapcount}" -gt "1" ]]; then
|
||||||
|
line2
|
||||||
|
until auto_mode; do : ; done
|
||||||
|
sleep 0.3
|
||||||
|
NC "
|
||||||
|
|
||||||
|
==> [${green}Filesystems OK${nc}]
|
||||||
|
"
|
||||||
|
sleep 0.3
|
||||||
|
YELLOW "
|
||||||
|
###---------------------------------------------[ FILESYSTEM OVERVIEW ]---------------------------------------------###
|
||||||
|
|
||||||
|
"
|
||||||
|
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|$'
|
||||||
|
YELLOW "
|
||||||
|
|
||||||
|
###-----------------------------------------------------------------------------------------------------------------###"
|
||||||
|
echo
|
||||||
|
sleep 1
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
sleep 0.3
|
sleep 0.3
|
||||||
NC "
|
NC "
|
||||||
|
|
||||||
|
@ -2823,6 +3038,10 @@ Enter a Mode number: "
|
||||||
###################################################################################################
|
###################################################################################################
|
||||||
auto_mode (){
|
auto_mode (){
|
||||||
|
|
||||||
|
sleep 0.3
|
||||||
|
NC "
|
||||||
|
${magenta}###${nc}----------------------------------------${magenta}[ ${bwhite}Auto Mode${nc} ${magenta}]${nc}----------------------------------------${magenta}###${nc}
|
||||||
|
"
|
||||||
sleep 0.3
|
sleep 0.3
|
||||||
YELLOW "
|
YELLOW "
|
||||||
|
|
||||||
|
@ -2928,7 +3147,7 @@ auto_mode (){
|
||||||
skip
|
skip
|
||||||
else
|
else
|
||||||
invalid
|
invalid
|
||||||
ask_homepart_form
|
until ask_homepart_form; do : ; done
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -3168,7 +3387,7 @@ ask_homepart_form (){
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
invalid
|
invalid
|
||||||
ask_homepart_form
|
until ask_homepart_form; do : ; done
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -3443,7 +3662,7 @@ ${magenta}###${nc}-------------------------------${magenta}[ ${bwhite}Confirm In
|
||||||
chroot_conf
|
chroot_conf
|
||||||
elif [[ "${agree}" == "no" ]]; then
|
elif [[ "${agree}" == "no" ]]; then
|
||||||
unmount
|
unmount
|
||||||
revise
|
until revise; do : ; done
|
||||||
else
|
else
|
||||||
sleep 0.3
|
sleep 0.3
|
||||||
RED "
|
RED "
|
||||||
|
@ -4878,4 +5097,4 @@ NVIDIA_HOOK
|
||||||
connection_check
|
connection_check
|
||||||
upd_clock
|
upd_clock
|
||||||
dtct_microcode
|
dtct_microcode
|
||||||
main_menu
|
until main_menu; do : ; done
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue