mirror of
https://gitlab.com/prism7/archery.git
synced 2025-02-15 08:29:17 +01:00
A new mechanism has been added, that scans the partitions on the installation disk and if more than one of each type {root/EFI/home/swap} are detected,
it Auto-Assigns 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
187b84dd63
commit
2c543a2ffd
1 changed files with 256 additions and 28 deletions
246
Amelia.sh
246
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
|
||||||
|
@ -153,7 +153,6 @@ 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 "
|
||||||
|
|
||||||
|
@ -2396,11 +2395,197 @@ 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}"
|
||||||
|
multiroot_opts="root=PARTUUID=$(blkid -s PARTUUID -o value "${root_dev}") "
|
||||||
|
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
|
||||||
|
@ -2756,16 +2949,36 @@ swappart (){
|
||||||
${magenta}###${nc}----------------------------------${magenta}[ ${bwhite}Swap Partition Setup${nc} ${magenta}]${nc}----------------------------------${magenta}###${nc}
|
${magenta}###${nc}----------------------------------${magenta}[ ${bwhite}Swap Partition Setup${nc} ${magenta}]${nc}----------------------------------${magenta}###${nc}
|
||||||
"
|
"
|
||||||
if mkswap "${swap_dev}" > /dev/null 2>&1 ; then
|
if mkswap "${swap_dev}" > /dev/null 2>&1 ; then
|
||||||
swapon "${swap_dev}" > /dev/null 2>&1 || stage_fail
|
|
||||||
stage_ok
|
stage_ok
|
||||||
else
|
else
|
||||||
swapoff "${swap_dev}" > /dev/null 2>&1
|
|
||||||
stage_fail
|
stage_fail
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
###################################################################################################
|
###################################################################################################
|
||||||
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 +3036,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 "
|
||||||
|
|
||||||
|
@ -4186,9 +4403,16 @@ ${magenta}###${nc}--------------------------------${magenta}[ ${bwhite}Chroot &
|
||||||
mkinitcpio_mods="MODULES=()"
|
mkinitcpio_mods="MODULES=()"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
### Kernel Boot Options (No Encryption)
|
|
||||||
|
if [[ "${autoroot}" == "y" ]]; then
|
||||||
|
### Kernel Boot Options [Multi-Root Disk] (No Encryption)
|
||||||
|
boot_opts="${multiroot_opts}${swap_bootopts}${vga_bootopts}${cust_bootopts}${btrfs_bootopts}"
|
||||||
|
else
|
||||||
|
### Kernel Boot Options [Single Root Disk] (No Encryption)
|
||||||
boot_opts="${swap_bootopts}${vga_bootopts}${cust_bootopts}${btrfs_bootopts}"
|
boot_opts="${swap_bootopts}${vga_bootopts}${cust_bootopts}${btrfs_bootopts}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
#--------------------------------------------------------------------------------------------------
|
#--------------------------------------------------------------------------------------------------
|
||||||
# NOTE: All Vanilla Desktops Basic Configuration:
|
# NOTE: All Vanilla Desktops Basic Configuration:
|
||||||
|
|
||||||
|
@ -4851,6 +5075,10 @@ NVIDIA_HOOK
|
||||||
vga_slct=""
|
vga_slct=""
|
||||||
nvidia_services=""
|
nvidia_services=""
|
||||||
nvidia_suspend=""
|
nvidia_suspend=""
|
||||||
|
autoroot=""
|
||||||
|
autoboot=""
|
||||||
|
autohome=""
|
||||||
|
autoswap=""
|
||||||
|
|
||||||
clear
|
clear
|
||||||
first_check
|
first_check
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue