diff --git a/Amelia.sh b/Amelia.sh index 0fb8332..ef08cc0 100644 --- a/Amelia.sh +++ b/Amelia.sh @@ -1,7 +1,7 @@ #!/bin/bash # Amelia Installer -# Version: 4.6 +# Version: 4.7 set -euo pipefail trap 's=$?; echo "$0: Error on line "$LINENO": $BASH_COMMAND"; exit $s' ERR @@ -940,7 +940,7 @@ Enter a number: " fs_mod="btrfs" fstools="btrfs-progs" roottype="/@" - btrfs_opts="rootflags=subvol=@" + btrfs_bootopts="rootflags=subvol=@ " sleep 0.5 YELLOW " ### ${fsname} has been selected @@ -3951,118 +3951,177 @@ REGDOM ########################################################################################### chroot_conf (){ - local prompt="Arch Linux" sleep 0.5 NC " _________________________________ ${purple}###${nc} Chroot & Configure System ${purple}###${nc} " - - [[ "${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}" + # Linux-Hardened = No Swap + [[ "${kernelnmbr}" == "3" ]] && swapmode="3" + #### 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 + # Swap Partition Options (Encryption) 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 + # Ext4 Offset if [[ "${fs}" == "1" ]]; then offst="$(filefrag -v /mnt/swapfile | awk '$1=="0:" {print substr($4, 1, length($4)-2)}')" + # Btrfs Offset elif [[ "${fs}" == "2" ]]; then offst="$(btrfs inspect-internal map-swapfile -r /mnt/swap/swapfile)" 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 + # No Swap Kernel Boot Options (Encryption) encr_swap_bootopts="" fi - + ### Graphics Setup + ## Configuration = 'Yes' if [[ "${vgaconf}" == "y" ]]; then + # Intel if [[ "${vendor}" == "Intel" ]]; then + # Mkinitcpio Modules (Encryption) 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)" elif [[ "${vendor}" == "Nvidia" ]]; then + # Mkinitcpio Modules (Encryption) 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)" - vga_bootopts="modeset=1" + # Graphics Kernel Boot Options + vga_bootopts="modeset=1 " elif [[ "${vendor}" == "AMD" ]]; then + # Mkinitcpio Modules (Encryption) 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)" + # 'Southern Islands' support 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 - 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 - vga_bootopts="amdgpu.dc=1" + # Graphics Kernel Boot Options + vga_bootopts="amdgpu.dc=1 " fi fi + ## Configuration = 'No' elif [[ "${vgaconf}" == "n" ]]; then + # Mkinitcpio Hooks (Encryption) mkinitcpio_hooks="HOOKS=(systemd keyboard autodetect microcode modconf kms keymap consolefont block sd-encrypt filesystems fsck)" + # Nvidia if [[ "${vendor}" == "Nvidia" ]]; then + # Mkinitcpio Modules (Encryption) mkinitcpio_mods="MODULES=(${fs_mod} nouveau)" + # Other Vendors else + # Mkinitcpio Modules (Encryption) mkinitcpio_mods="MODULES=(${fs_mod})" fi fi - - boot_opts="${encr_root_bootopts} ${encr_swap_bootopts} ${vga_bootopts} ${cust_bootopts} ${btrfs_opts}" - + ### Kernel Boot Options (Encryption) + boot_opts="${encr_root_bootopts}${encr_swap_bootopts}${vga_bootopts}${cust_bootopts}${btrfs_bootopts}" #------------------------------------------------------------------------------------------ - + #### Unencrypted Setup elif [[ "${encrypt}" == "no" ]]; then - + ### Swap Setup + ## Swap Partition 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 + # Ext4 Offset if [[ "${fs}" == "1" ]]; then offst="$(filefrag -v /mnt/swapfile | awk '$1=="0:" {print substr($4, 1, length($4)-2)}')" + # Btrfs Offset elif [[ "${fs}" == "2" ]]; then offst="$(btrfs inspect-internal map-swapfile -r /mnt/swap/swapfile)" 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 + # No Swap Kernel Boot Options swap_bootopts="" fi - + ### Graphics Setup + ## Configuration = 'Yes' if [[ "${vgaconf}" == "y" ]]; then + # Intel if [[ "${vendor}" == "Intel" ]]; then + # Mkinitcpio Modules mkinitcpio_mods="MODULES=(i915)" + # Mkinitcpio Hooks mkinitcpio_hooks="HOOKS=(systemd autodetect microcode modconf kms keyboard keymap consolefont block filesystems fsck)" + # Nvidia elif [[ "${vendor}" == "Nvidia" ]]; then + # Mkinitcpio Modules 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)" - vga_bootopts="modeset=1" + # Graphics Kernel Boot Options + vga_bootopts="modeset=1 " + # Amd elif [[ "${vendor}" == "AMD" ]]; then + # Mkinitcpio Modules mkinitcpio_mods="MODULES=(amdgpu radeon)" + # Mkinitcpio Hooks mkinitcpio_hooks="HOOKS=(systemd autodetect microcode modconf kms keyboard keymap consolefont block filesystems fsck)" + # 'Southern Islands' support 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 - 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 - vga_bootopts="amdgpu.dc=1" + # Graphics Kernel Boot Options + vga_bootopts="amdgpu.dc=1 " fi fi + ## Configuration = 'No' elif [[ "${vgaconf}" == "n" ]]; then + # Mkinitcpio Hooks mkinitcpio_hooks="HOOKS=(systemd autodetect microcode modconf kms keyboard keymap consolefont block filesystems fsck)" - + # Nvidia if [[ "${vendor}" == "Nvidia" ]]; then + # Mkinitcpio Modules mkinitcpio_mods="MODULES=(nouveau)" + # Other Vendors else + # Mkinitcpio Modules mkinitcpio_mods="MODULES=()" fi fi - - boot_opts="${cust_bootopts} ${swap_bootopts} ${vga_bootopts} ${btrfs_opts}" + ### Kernel Boot Options (No Encryption) + boot_opts="${swap_bootopts}${vga_bootopts}${cust_bootopts}${btrfs_bootopts}" fi - #------------------------------------------------------------------------------------------ - # NOTE: All Vanilla Desktops Basic Configuration: - + if [[ "${packages}" =~ ^(1|3|5|6|7|8|9|10|11)$ ]]; then stage_prompt="Base System" if arch-chroot /mnt <<-VANILLA_CONF ; then @@ -4208,13 +4267,10 @@ NVIDIAHOOK fi fi fi - ok completion fi - #------------------------------------------------------------------------------------------ - - # NOTE: Plasma / Gnome & Systemd-boot Optimized System Configuration: + # NOTE: Plasma / Gnome & Systemd-boot Optimized-System Configuration: if [[ "${packages}" == "2" ]] || [[ "${packages}" == "4" ]]; then stage_prompt="Main System" @@ -4401,12 +4457,9 @@ NVIDIAHOOK fi fi fi - ok completion fi - #------------------------------------------------------------------------------------------ - # NOTE: Custom System Configuration (Add any extra configuration below): if [[ "${packages}" == "12" ]]; then @@ -4555,7 +4608,6 @@ NVIDIAHOOK fi fi fi - ok completion fi umount -R /mnt @@ -4581,7 +4633,7 @@ NVIDIAHOOK devel="" REGDOM="" vga_bootopts="" - btrfs_opts="" + btrfs_bootopts="" trim="" swapmode="" homecrypt=""