Add comments

This commit is contained in:
Jane Doe 2024-05-19 10:14:29 +00:00
parent b8d370d882
commit f4a7447805

140
Amelia.sh
View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Amelia Installer # Amelia Installer
# Version: 4.6 # Version: 4.7
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
@ -940,7 +940,7 @@ Enter a number: "
fs_mod="btrfs" fs_mod="btrfs"
fstools="btrfs-progs" fstools="btrfs-progs"
roottype="/@" roottype="/@"
btrfs_opts="rootflags=subvol=@" btrfs_bootopts="rootflags=subvol=@ "
sleep 0.5 sleep 0.5
YELLOW " YELLOW "
### ${fsname} has been selected ### ${fsname} has been selected
@ -3951,118 +3951,177 @@ REGDOM
########################################################################################### ###########################################################################################
chroot_conf (){ chroot_conf (){
local prompt="Arch Linux"
sleep 0.5 sleep 0.5
NC " NC "
_________________________________ _________________________________
${purple}###${nc} Chroot & Configure System ${purple}###${nc} ${purple}###${nc} Chroot & Configure System ${purple}###${nc}
" "
# Linux-Hardened = No Swap
[[ "${kernelnmbr}" == "3" ]] && swapmode="3" [[ "${kernelnmbr}" == "3" ]] && swapmode="3"
if [[ "${encrypt}" == "yes" ]]; then
encr_root_dev="/dev/mapper/${ENCROOT}"
encr_root_opts="rd.luks.name=$(blkid -s UUID -o value "${root_dev}")=${ENCROOT}"
encr_root_bootopts="root=${encr_root_dev} ${encr_root_opts}"
#### Encrypted Setup
if [[ "${encrypt}" == "yes" ]]; then
# Encrypted Root Device
encr_root_dev="/dev/mapper/${ENCROOT}"
# Encrypted Root Options
encr_root_opts="rd.luks.name=$(blkid -s UUID -o value "${root_dev}")=${ENCROOT}"
# Encrypted Kernel Boot Options
encr_root_bootopts="root=${encr_root_dev} ${encr_root_opts} "
### Swap Setup
## Swap Partition (Encryption)
if [[ "${swapmode}" == "1" ]]; then if [[ "${swapmode}" == "1" ]]; then
# Swap Partition Options (Encryption)
encr_swap_opts="rd.luks.name=$(blkid -s UUID -o value "${swap_dev}")=swap" encr_swap_opts="rd.luks.name=$(blkid -s UUID -o value "${swap_dev}")=swap"
encr_swap_bootopts="resume=/dev/mapper/swap ${encr_swap_opts}" # Swap Partition Kernel Main Boot Options (Encryption)
encr_swap_bootopts="resume=/dev/mapper/swap ${encr_swap_opts} "
## Swapfile (Encryption)
elif [[ "${swapmode}" == "2" ]]; then elif [[ "${swapmode}" == "2" ]]; then
# Ext4 Offset
if [[ "${fs}" == "1" ]]; then if [[ "${fs}" == "1" ]]; then
offst="$(filefrag -v /mnt/swapfile | awk '$1=="0:" {print substr($4, 1, length($4)-2)}')" offst="$(filefrag -v /mnt/swapfile | awk '$1=="0:" {print substr($4, 1, length($4)-2)}')"
# Btrfs Offset
elif [[ "${fs}" == "2" ]]; then elif [[ "${fs}" == "2" ]]; then
offst="$(btrfs inspect-internal map-swapfile -r /mnt/swap/swapfile)" offst="$(btrfs inspect-internal map-swapfile -r /mnt/swap/swapfile)"
fi fi
encr_swap_bootopts="resume=${encr_root_dev} resume_offset=${offst}" # Swapfile Kernel Boot Options (Encryption)
encr_swap_bootopts="resume=${encr_root_dev} resume_offset=${offst} "
## No Swap
elif [[ "${swapmode}" == "3" ]]; then elif [[ "${swapmode}" == "3" ]]; then
# No Swap Kernel Boot Options (Encryption)
encr_swap_bootopts="" encr_swap_bootopts=""
fi fi
### Graphics Setup
## Configuration = 'Yes'
if [[ "${vgaconf}" == "y" ]]; then if [[ "${vgaconf}" == "y" ]]; then
# Intel
if [[ "${vendor}" == "Intel" ]]; then if [[ "${vendor}" == "Intel" ]]; then
# Mkinitcpio Modules (Encryption)
mkinitcpio_mods="MODULES=(i915 ${fs_mod})" mkinitcpio_mods="MODULES=(i915 ${fs_mod})"
# Mkinitcpio Hooks (Encryption)
mkinitcpio_hooks="HOOKS=(systemd keyboard autodetect microcode modconf kms keymap consolefont block sd-encrypt filesystems fsck)" mkinitcpio_hooks="HOOKS=(systemd keyboard autodetect microcode modconf kms keymap consolefont block sd-encrypt filesystems fsck)"
elif [[ "${vendor}" == "Nvidia" ]]; then elif [[ "${vendor}" == "Nvidia" ]]; then
# Mkinitcpio Modules (Encryption)
mkinitcpio_mods="MODULES=(nvidia nvidia_modeset nvidia_uvm nvidia_drm ${fs_mod})" mkinitcpio_mods="MODULES=(nvidia nvidia_modeset nvidia_uvm nvidia_drm ${fs_mod})"
# Mkinitcpio Hooks (Encryption)
mkinitcpio_hooks="HOOKS=(systemd keyboard autodetect microcode modconf keymap consolefont block sd-encrypt filesystems fsck)" mkinitcpio_hooks="HOOKS=(systemd keyboard autodetect microcode modconf keymap consolefont block sd-encrypt filesystems fsck)"
vga_bootopts="modeset=1" # Graphics Kernel Boot Options
vga_bootopts="modeset=1 "
elif [[ "${vendor}" == "AMD" ]]; then elif [[ "${vendor}" == "AMD" ]]; then
# Mkinitcpio Modules (Encryption)
mkinitcpio_mods="MODULES=(amdgpu radeon ${fs_mod})" mkinitcpio_mods="MODULES=(amdgpu radeon ${fs_mod})"
# Mkinitcpio Hooks (Encryption)
mkinitcpio_hooks="HOOKS=(systemd keyboard autodetect microcode modconf kms keymap consolefont block sd-encrypt filesystems fsck)" mkinitcpio_hooks="HOOKS=(systemd keyboard autodetect microcode modconf kms keymap consolefont block sd-encrypt filesystems fsck)"
# 'Southern Islands' support
if [[ "${islands}" == "1" ]]; then if [[ "${islands}" == "1" ]]; then
vga_bootopts="radeon.si_support=0 amdgpu.si_support=1 amdgpu.dc=1" # Graphics Kernel Boot Options
vga_bootopts="radeon.si_support=0 amdgpu.si_support=1 amdgpu.dc=1 "
# 'Sea Islands' support
elif [[ "${islands}" == "2" ]]; then elif [[ "${islands}" == "2" ]]; then
vga_bootopts="radeon.cik_support=0 amdgpu.cik_support=1 amdgpu.dc=1" # Graphics Kernel Boot Options
vga_bootopts="radeon.cik_support=0 amdgpu.cik_support=1 amdgpu.dc=1 "
elif [[ -z "${islands}" ]]; then elif [[ -z "${islands}" ]]; then
vga_bootopts="amdgpu.dc=1" # Graphics Kernel Boot Options
vga_bootopts="amdgpu.dc=1 "
fi fi
fi fi
## Configuration = 'No'
elif [[ "${vgaconf}" == "n" ]]; then elif [[ "${vgaconf}" == "n" ]]; then
# Mkinitcpio Hooks (Encryption)
mkinitcpio_hooks="HOOKS=(systemd keyboard autodetect microcode modconf kms keymap consolefont block sd-encrypt filesystems fsck)" mkinitcpio_hooks="HOOKS=(systemd keyboard autodetect microcode modconf kms keymap consolefont block sd-encrypt filesystems fsck)"
# Nvidia
if [[ "${vendor}" == "Nvidia" ]]; then if [[ "${vendor}" == "Nvidia" ]]; then
# Mkinitcpio Modules (Encryption)
mkinitcpio_mods="MODULES=(${fs_mod} nouveau)" mkinitcpio_mods="MODULES=(${fs_mod} nouveau)"
# Other Vendors
else else
# Mkinitcpio Modules (Encryption)
mkinitcpio_mods="MODULES=(${fs_mod})" mkinitcpio_mods="MODULES=(${fs_mod})"
fi fi
fi fi
### Kernel Boot Options (Encryption)
boot_opts="${encr_root_bootopts} ${encr_swap_bootopts} ${vga_bootopts} ${cust_bootopts} ${btrfs_opts}" boot_opts="${encr_root_bootopts}${encr_swap_bootopts}${vga_bootopts}${cust_bootopts}${btrfs_bootopts}"
#------------------------------------------------------------------------------------------ #------------------------------------------------------------------------------------------
#### Unencrypted Setup
elif [[ "${encrypt}" == "no" ]]; then elif [[ "${encrypt}" == "no" ]]; then
### Swap Setup
## Swap Partition
if [[ "${swapmode}" == "1" ]]; then if [[ "${swapmode}" == "1" ]]; then
swap_bootopts="resume=UUID=$(blkid -s UUID -o value "${swap_dev}")" # Swap Partition Kernel Boot Options
swap_bootopts="resume=UUID=$(blkid -s UUID -o value "${swap_dev}") "
## Swapfile
elif [[ "${swapmode}" == "2" ]]; then elif [[ "${swapmode}" == "2" ]]; then
# Ext4 Offset
if [[ "${fs}" == "1" ]]; then if [[ "${fs}" == "1" ]]; then
offst="$(filefrag -v /mnt/swapfile | awk '$1=="0:" {print substr($4, 1, length($4)-2)}')" offst="$(filefrag -v /mnt/swapfile | awk '$1=="0:" {print substr($4, 1, length($4)-2)}')"
# Btrfs Offset
elif [[ "${fs}" == "2" ]]; then elif [[ "${fs}" == "2" ]]; then
offst="$(btrfs inspect-internal map-swapfile -r /mnt/swap/swapfile)" offst="$(btrfs inspect-internal map-swapfile -r /mnt/swap/swapfile)"
fi fi
swap_bootopts="resume=UUID=$(blkid -s UUID -o value "${root_dev}") resume_offset=${offst}" # Swapfile Kernel Boot Options
swap_bootopts="resume=UUID=$(blkid -s UUID -o value "${root_dev}") resume_offset=${offst} "
## No Swap
elif [[ "${swapmode}" == "3" ]]; then elif [[ "${swapmode}" == "3" ]]; then
# No Swap Kernel Boot Options
swap_bootopts="" swap_bootopts=""
fi fi
### Graphics Setup
## Configuration = 'Yes'
if [[ "${vgaconf}" == "y" ]]; then if [[ "${vgaconf}" == "y" ]]; then
# Intel
if [[ "${vendor}" == "Intel" ]]; then if [[ "${vendor}" == "Intel" ]]; then
# Mkinitcpio Modules
mkinitcpio_mods="MODULES=(i915)" mkinitcpio_mods="MODULES=(i915)"
# Mkinitcpio Hooks
mkinitcpio_hooks="HOOKS=(systemd autodetect microcode modconf kms keyboard keymap consolefont block filesystems fsck)" mkinitcpio_hooks="HOOKS=(systemd autodetect microcode modconf kms keyboard keymap consolefont block filesystems fsck)"
# Nvidia
elif [[ "${vendor}" == "Nvidia" ]]; then elif [[ "${vendor}" == "Nvidia" ]]; then
# Mkinitcpio Modules
mkinitcpio_mods="MODULES=(nvidia nvidia_modeset nvidia_uvm nvidia_drm)" mkinitcpio_mods="MODULES=(nvidia nvidia_modeset nvidia_uvm nvidia_drm)"
# Mkinitcpio Hooks
mkinitcpio_hooks="HOOKS=(systemd autodetect microcode modconf keyboard keymap consolefont block filesystems fsck)" mkinitcpio_hooks="HOOKS=(systemd autodetect microcode modconf keyboard keymap consolefont block filesystems fsck)"
vga_bootopts="modeset=1" # Graphics Kernel Boot Options
vga_bootopts="modeset=1 "
# Amd
elif [[ "${vendor}" == "AMD" ]]; then elif [[ "${vendor}" == "AMD" ]]; then
# Mkinitcpio Modules
mkinitcpio_mods="MODULES=(amdgpu radeon)" mkinitcpio_mods="MODULES=(amdgpu radeon)"
# Mkinitcpio Hooks
mkinitcpio_hooks="HOOKS=(systemd autodetect microcode modconf kms keyboard keymap consolefont block filesystems fsck)" mkinitcpio_hooks="HOOKS=(systemd autodetect microcode modconf kms keyboard keymap consolefont block filesystems fsck)"
# 'Southern Islands' support
if [[ "${islands}" == "1" ]]; then if [[ "${islands}" == "1" ]]; then
vga_bootopts="radeon.si_support=0 amdgpu.si_support=1 amdgpu.dc=1" # Graphics Kernel Boot Options
vga_bootopts="radeon.si_support=0 amdgpu.si_support=1 amdgpu.dc=1 "
# 'Sea Islands' support
elif [[ "${islands}" == "2" ]]; then elif [[ "${islands}" == "2" ]]; then
vga_bootopts="radeon.cik_support=0 amdgpu.cik_support=1 amdgpu.dc=1" # Graphics Kernel Boot Options
vga_bootopts="radeon.cik_support=0 amdgpu.cik_support=1 amdgpu.dc=1 "
elif [[ -z "${islands}" ]]; then elif [[ -z "${islands}" ]]; then
vga_bootopts="amdgpu.dc=1" # Graphics Kernel Boot Options
vga_bootopts="amdgpu.dc=1 "
fi fi
fi fi
## Configuration = 'No'
elif [[ "${vgaconf}" == "n" ]]; then elif [[ "${vgaconf}" == "n" ]]; then
# Mkinitcpio Hooks
mkinitcpio_hooks="HOOKS=(systemd autodetect microcode modconf kms keyboard keymap consolefont block filesystems fsck)" mkinitcpio_hooks="HOOKS=(systemd autodetect microcode modconf kms keyboard keymap consolefont block filesystems fsck)"
# Nvidia
if [[ "${vendor}" == "Nvidia" ]]; then if [[ "${vendor}" == "Nvidia" ]]; then
# Mkinitcpio Modules
mkinitcpio_mods="MODULES=(nouveau)" mkinitcpio_mods="MODULES=(nouveau)"
# Other Vendors
else else
# Mkinitcpio Modules
mkinitcpio_mods="MODULES=()" mkinitcpio_mods="MODULES=()"
fi fi
fi fi
### Kernel Boot Options (No Encryption)
boot_opts="${cust_bootopts} ${swap_bootopts} ${vga_bootopts} ${btrfs_opts}" boot_opts="${swap_bootopts}${vga_bootopts}${cust_bootopts}${btrfs_bootopts}"
fi fi
#------------------------------------------------------------------------------------------ #------------------------------------------------------------------------------------------
# NOTE: All Vanilla Desktops Basic Configuration: # NOTE: All Vanilla Desktops Basic Configuration:
if [[ "${packages}" =~ ^(1|3|5|6|7|8|9|10|11)$ ]]; then if [[ "${packages}" =~ ^(1|3|5|6|7|8|9|10|11)$ ]]; then
stage_prompt="Base System" stage_prompt="Base System"
if arch-chroot /mnt <<-VANILLA_CONF ; then if arch-chroot /mnt <<-VANILLA_CONF ; then
@ -4208,13 +4267,10 @@ NVIDIAHOOK
fi fi
fi fi
fi fi
ok
completion completion
fi fi
#------------------------------------------------------------------------------------------ #------------------------------------------------------------------------------------------
# NOTE: Plasma / Gnome & Systemd-boot Optimized-System Configuration:
# NOTE: Plasma / Gnome & Systemd-boot Optimized System Configuration:
if [[ "${packages}" == "2" ]] || [[ "${packages}" == "4" ]]; then if [[ "${packages}" == "2" ]] || [[ "${packages}" == "4" ]]; then
stage_prompt="Main System" stage_prompt="Main System"
@ -4401,12 +4457,9 @@ NVIDIAHOOK
fi fi
fi fi
fi fi
ok
completion completion
fi fi
#------------------------------------------------------------------------------------------ #------------------------------------------------------------------------------------------
# NOTE: Custom System Configuration (Add any extra configuration below): # NOTE: Custom System Configuration (Add any extra configuration below):
if [[ "${packages}" == "12" ]]; then if [[ "${packages}" == "12" ]]; then
@ -4555,7 +4608,6 @@ NVIDIAHOOK
fi fi
fi fi
fi fi
ok
completion completion
fi fi
umount -R /mnt umount -R /mnt
@ -4581,7 +4633,7 @@ NVIDIAHOOK
devel="" devel=""
REGDOM="" REGDOM=""
vga_bootopts="" vga_bootopts=""
btrfs_opts="" btrfs_bootopts=""
trim="" trim=""
swapmode="" swapmode=""
homecrypt="" homecrypt=""