Change: 'Graphics Setup' stage > Major code revision in order to comply with the latest Nvidia drivers changes

Change: Some minor indentation
This commit is contained in:
Jane Doe 2024-09-21 23:08:13 +00:00
parent 2d9bde1332
commit 6d65c6f030

451
Amelia.sh
View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Amelia Installer # Amelia Installer
# Version: 7.5 # Version: 7.6
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
@ -1718,9 +1718,9 @@ Enter a number ${bwhite}(empty to skip)${blue}: "
> Select Nvidia architecture: " > Select Nvidia architecture: "
NC " NC "
[1] NV110 (Maxwell) Graphics or newer [1] NV160 (Turing) Graphics or newer
[2] NV160 (Turing) Graphics or newer " [2] NV110 (Maxwell) Graphics or newer "
BLUE " BLUE "
@ -1732,132 +1732,58 @@ Enter a number: "
sleep 0.2 sleep 0.2
NC " NC "
==> [${green}Maxwell+ OK${nc}] ==> [${green}Turing+ OK${nc}]
" "
elif [[ "${family}" == "2" ]]; then elif [[ "${family}" == "2" ]]; then
sleep 0.2 sleep 0.2
YELLOW "
> Select Nvidia driver: "
NC " NC "
[1] 'Nvidia-Open' driver ==> [${green}Maxwell+ OK${nc}]
"
[2] 'Nvidia' driver "
BLUE "
Enter a number: "
read -r -p "
==> " nvdriver
if [[ "${nvdriver}" == "1" ]]; then
if [[ -n "${vendor2}" ]]; then
sleep 0.2
YELLOW "
### AMD Graphics have also been detected "
RED "
----------------------------------------------------------------------
### ${yellow}There may be incompatibilities with the ${nc}'Nvidia-Open' ${yellow}driver ${red}###
----------------------------------------------------------------------"
YELLOW "
> Please confirm your selection: "
NC "
[1] 'Nvidia-Open' driver
[2] 'Nvidia' driver "
BLUE "
Enter a number: "
read -r -p "
==> " nvdriver
if [[ "${nvdriver}" == "1" || "${nvdriver}" == "2" ]]; then
sleep 0.2
NC "
==> [${green}Driver Confirmed OK${nc}] "
else
echo
invalid
return 1
fi
fi
sleep 0.2
NC "
==> [${green}Turing+ OK${nc}]
"
elif [[ "${nvdriver}" == "2" ]]; then
sleep 0.2
NC "
==> [${green}Turing+ OK${nc}]
"
else
echo
invalid
return 1
fi
else else
echo echo
invalid invalid
return 1 return 1
fi fi
if [[ "${kernelnmbr}" == "1" ]]; then
if [[ "${family}" == "1" ]]; then # Turing+ Family
vgapkgs="libva-nvidia-driver libvdpau-va-gl nvidia nvidia-settings nvidia-utils opencl-nvidia" if [[ "${family}" == "1" ]]; then
# Linux Kernel
if [[ "${kernelnmbr}" == "1" ]]; then
nvname="nvidia-open"
vgapkgs="libva-nvidia-driver libvdpau-va-gl nvidia-open nvidia-settings nvidia-utils opencl-nvidia"
# Other Kernels
else
vgapkgs="libva-nvidia-driver libvdpau-va-gl nvidia-open-dkms nvidia-settings nvidia-utils opencl-nvidia"
fi
# Maxwell+ Family
elif [[ "${family}" == "2" ]]; then
# Linux Kernel
if [[ "${kernelnmbr}" == "1" ]]; then
nvname="nvidia" nvname="nvidia"
elif [[ "${family}" == "2" ]]; then vgapkgs="libva-nvidia-driver libvdpau-va-gl nvidia nvidia-settings nvidia-utils opencl-nvidia"
if [[ "${nvdriver}" == "1" ]]; then # Linux LTS Kernel
vgapkgs="libva-nvidia-driver libvdpau-va-gl nvidia-open nvidia-settings nvidia-utils opencl-nvidia" elif [[ "${kernelnmbr}" == "2" ]]; then
nvname="nvidia-open"
elif [[ "${nvdriver}" == "2" ]]; then
vgapkgs="libva-nvidia-driver libvdpau-va-gl nvidia nvidia-settings nvidia-utils opencl-nvidia"
nvname="nvidia"
fi
fi
elif [[ "${kernelnmbr}" == "2" ]]; then
if [[ "${family}" == "1" ]]; then
vgapkgs="libva-nvidia-driver libvdpau-va-gl nvidia-lts nvidia-settings nvidia-utils opencl-nvidia"
nvname="nvidia-lts" nvname="nvidia-lts"
elif [[ "${family}" == "2" ]]; then vgapkgs="libva-nvidia-driver libvdpau-va-gl nvidia-lts nvidia-settings nvidia-utils opencl-nvidia"
if [[ "${nvdriver}" == "1" ]]; then # Other Kernels
vgapkgs="libva-nvidia-driver libvdpau-va-gl nvidia-open-dkms nvidia-settings nvidia-utils opencl-nvidia" else
elif [[ "${nvdriver}" == "2" ]]; then
vgapkgs="libva-nvidia-driver libvdpau-va-gl nvidia-lts nvidia-settings nvidia-utils opencl-nvidia"
nvname="nvidia-lts"
fi
fi
else
if [[ "${family}" == "1" ]]; then
vgapkgs="libva-nvidia-driver libvdpau-va-gl nvidia-dkms nvidia-settings nvidia-utils opencl-nvidia" vgapkgs="libva-nvidia-driver libvdpau-va-gl nvidia-dkms nvidia-settings nvidia-utils opencl-nvidia"
elif [[ "${family}" == "2" ]]; then
if [[ "${nvdriver}" == "1" ]]; then
vgapkgs="libva-nvidia-driver libvdpau-va-gl nvidia-open-dkms nvidia-settings nvidia-utils opencl-nvidia"
elif [[ "${nvdriver}" == "2" ]]; then
vgapkgs="libva-nvidia-driver libvdpau-va-gl nvidia-dkms nvidia-settings nvidia-utils opencl-nvidia"
fi
fi fi
fi fi
sleep 0.2
YELLOW " sleep 0.2
YELLOW "
> Enable Nvidia's 'Suspend-Hibernate-Resume' Video Memory Preserving feature ? [y/n] " > Enable Nvidia's 'Suspend-Hibernate-Resume' Video Memory Preserving feature ? [y/n] "
BLUE " BLUE "
Enter [y/n]: " Enter [y/n]: "
read -r -p " read -r -p "
==> " nvidia_suspend ==> " nvidia_suspend
echo echo
if [[ "${nvidia_suspend}" == "n" ]]; then if [[ "${nvidia_suspend}" == "n" ]]; then
skip skip
@ -1884,6 +1810,7 @@ Enter [y/n]: "
return 1 return 1
fi fi
fi fi
sleep 0.2 sleep 0.2
YELLOW " YELLOW "
@ -5349,17 +5276,17 @@ main_chroot() {
export LANG=${SETLOCALE} || exit export LANG=${SETLOCALE} || exit
echo KEYMAP=${SETKBD} > /etc/vconsole.conf || exit echo KEYMAP=${SETKBD} > /etc/vconsole.conf || exit
cat <<-MKINIT_CONF > /etc/mkinitcpio.conf.d/mkinitcpiod.conf || exit cat <<-MKINIT_CONF > /etc/mkinitcpio.conf.d/mkinitcpiod.conf || exit
${mkinitcpio_mods} ${mkinitcpio_mods}
${mkinitcpio_hooks} ${mkinitcpio_hooks}
MKINIT_CONF MKINIT_CONF
mkinitcpio -P || exit mkinitcpio -P || exit
ln -sf /usr/share/zoneinfo/$(curl -s http://ip-api.com/line?fields=timezone) /etc/localtime || exit ln -sf /usr/share/zoneinfo/$(curl -s http://ip-api.com/line?fields=timezone) /etc/localtime || exit
hwclock --systohc || exit hwclock --systohc || exit
echo ${HOSTNAME} > /etc/hostname || exit echo ${HOSTNAME} > /etc/hostname || exit
cat <<-HOSTS > /etc/hosts || exit cat <<-HOSTS > /etc/hosts || exit
127.0.0.1 localhost 127.0.0.1 localhost
::1 localhost ::1 localhost
127.0.1.1 ${HOSTNAME}.localdomain ${HOSTNAME} 127.0.1.1 ${HOSTNAME}.localdomain ${HOSTNAME}
HOSTS HOSTS
echo root:${ROOTPASSWD2} | chpasswd || exit echo root:${ROOTPASSWD2} | chpasswd || exit
useradd -m -G wheel -s /bin/bash ${USERNAME} || exit useradd -m -G wheel -s /bin/bash ${USERNAME} || exit
@ -5384,10 +5311,10 @@ btldr_conf() {
bootctl --esp-path=/efi --boot-path=/boot install || exit bootctl --esp-path=/efi --boot-path=/boot install || exit
echo "default arch.conf" > /boot/loader/loader.conf || exit echo "default arch.conf" > /boot/loader/loader.conf || exit
cat <<-SDBOOT_CONF > /boot/loader/entries/arch.conf || exit cat <<-SDBOOT_CONF > /boot/loader/entries/arch.conf || exit
title ${entrname} title ${entrname}
linux /vmlinuz-${kernel} linux /vmlinuz-${kernel}
initrd /initramfs-${kernel}.img initrd /initramfs-${kernel}.img
options rw ${boot_opts} options rw ${boot_opts}
SDBOOT_CONF SDBOOT_CONF
systemctl enable systemd-boot-update || exit systemctl enable systemd-boot-update || exit
XBOOTCTL XBOOTCTL
@ -5411,10 +5338,10 @@ XBOOTCTL
bootctl install || exit bootctl install || exit
echo "default arch.conf" > /boot/loader/loader.conf || exit echo "default arch.conf" > /boot/loader/loader.conf || exit
cat <<-SDBOOT_CONF > /boot/loader/entries/arch.conf || exit cat <<-SDBOOT_CONF > /boot/loader/entries/arch.conf || exit
title ${entrname} title ${entrname}
linux /vmlinuz-${kernel} linux /vmlinuz-${kernel}
initrd /initramfs-${kernel}.img initrd /initramfs-${kernel}.img
options rw ${boot_opts} options rw ${boot_opts}
SDBOOT_CONF SDBOOT_CONF
systemctl enable systemd-boot-update || exit systemctl enable systemd-boot-update || exit
BOOTCTL BOOTCTL
@ -5455,7 +5382,7 @@ BOOTCTL
GRUB_DISABLE_OS_PROBER=false GRUB_DISABLE_OS_PROBER=false
#GRUB_TERMINAL_OUTPUT=console #GRUB_TERMINAL_OUTPUT=console
GRUB_CONF GRUB_CONF
grub-mkconfig -o /boot/grub/grub.cfg grub-mkconfig -o /boot/grub/grub.cfg
GRUB GRUB
stage_ok stage_ok
else else
@ -5468,12 +5395,12 @@ GRUB
esp_dev_uuid="$(lsblk -dno UUID "${esp_dev}")" esp_dev_uuid="$(lsblk -dno UUID "${esp_dev}")"
if arch-chroot /mnt <<-GRUB_UKI > /dev/null 2>&1 ; then if arch-chroot /mnt <<-GRUB_UKI > /dev/null 2>&1 ; then
cat <<-GRUB_UKI_ENTRY >> /boot/grub/custom.cfg cat <<-GRUB_UKI_ENTRY >> /boot/grub/custom.cfg
menuentry "Arch Linux" { menuentry "Arch Linux" {
insmod fat insmod fat
insmod chain insmod chain
search --no-floppy --set=root --fs-uuid ${esp_dev_uuid} search --no-floppy --set=root --fs-uuid ${esp_dev_uuid}
chainloader /EFI/Linux/arch-${kernel}.efi chainloader /EFI/Linux/arch-${kernel}.efi
} }
GRUB_UKI_ENTRY GRUB_UKI_ENTRY
GRUB_UKI GRUB_UKI
stage_ok stage_ok
@ -5563,9 +5490,9 @@ zram_conf() {
if arch-chroot /mnt <<-ZRAM > /dev/null 2>&1 ; then if arch-chroot /mnt <<-ZRAM > /dev/null 2>&1 ; then
mkdir -p /etc/systemd/zram-generator.conf.d mkdir -p /etc/systemd/zram-generator.conf.d
cat <<-ZRAM_CONF > /etc/systemd/zram-generator.conf.d/zram.conf || exit cat <<-ZRAM_CONF > /etc/systemd/zram-generator.conf.d/zram.conf || exit
[zram0] [zram0]
zram-size = ram / 2 zram-size = ram / 2
compression-algorithm = zstd compression-algorithm = zstd
ZRAM_CONF ZRAM_CONF
systemctl daemon-reload || exit systemctl daemon-reload || exit
systemctl start ${zram_service} || exit systemctl start ${zram_service} || exit
@ -5580,26 +5507,26 @@ ZRAM
nvidia_hook_conf() { nvidia_hook_conf() {
if [[ "${vgaconf}" == "y" && "${vendor}" == "Nvidia" ]]; then if [[ "${vgaconf}" == "y" && "${vendor}" == "Nvidia" ]]; then
if [[ "${kernelnmbr}" == "1" ]] || [[ "${kernelnmbr}" == "2" && "${family}" == "1" ]] || [[ "${kernelnmbr}" == "2" && "${family}" == "2" && "${nvdriver}" == "2" ]]; then if [[ "${nvname}" == "nvidia-open" ]] || [[ "${nvname}" == "nvidia" ]] || [[ "${nvname}" == "nvidia-lts" ]]; then
cnfg cnfg
local stage_prompt="Nvidia-Hook" local stage_prompt="Nvidia-Hook"
if arch-chroot /mnt <<-NVIDIA_HOOK > /dev/null 2>&1 ; then if arch-chroot /mnt <<-NVIDIA_HOOK > /dev/null 2>&1 ; then
mkdir -p /etc/pacman.d/hooks/ || exit mkdir -p /etc/pacman.d/hooks/ || exit
cat <<-HOOK > /etc/pacman.d/hooks/nvidia.hook || exit cat <<-HOOK > /etc/pacman.d/hooks/nvidia.hook || exit
[Trigger] [Trigger]
Operation=Install Operation=Install
Operation=Upgrade Operation=Upgrade
Operation=Remove Operation=Remove
Type=Package Type=Package
Target=${nvname} Target=${nvname}
Target=${kernel} Target=${kernel}
[Action] [Action]
Description=Update NVIDIA module in initcpio Description=Update NVIDIA module in initcpio
Depends=mkinitcpio Depends=mkinitcpio
When=PostTransaction When=PostTransaction
NeedsTargets NeedsTargets
Exec=/bin/sh -c 'while read -r trg; do case $trg in linux*) exit 0; esac; done; /usr/bin/mkinitcpio -P' Exec=/bin/sh -c 'while read -r trg; do case $trg in linux*) exit 0; esac; done; /usr/bin/mkinitcpio -P'
HOOK HOOK
NVIDIA_HOOK NVIDIA_HOOK
stage_ok stage_ok
@ -5615,45 +5542,50 @@ uki_conf() {
if [[ "${uki}" == "y" ]]; then if [[ "${uki}" == "y" ]]; then
cnfg cnfg
local stage_prompt="UKI" local stage_prompt="UKI"
if [[ ! -e "${esp_mount}"/EFI/Linux ]]; then if [[ ! -e "${esp_mount}"/EFI/Linux ]]; then
mkdir -p "${esp_mount}"/EFI/Linux || exit mkdir -p "${esp_mount}"/EFI/Linux || exit
fi fi
if [[ "${bootloader}" == "1" ]]; then
if arch-chroot /mnt <<- UKI > /dev/null 2>&1 ; then if [[ "${bootloader}" == "1" ]]; then
mkdir /etc/cmdline.d || exit if arch-chroot /mnt <<- UKI > /dev/null 2>&1 ; then
echo "rw ${boot_opts}" | tee /etc/cmdline.d/cmdline.conf || exit mkdir /etc/cmdline.d || exit
cp /etc/mkinitcpio.d/${kernel}.preset /etc/mkinitcpio.d/${kernel}.preset.bak echo "rw ${boot_opts}" | tee /etc/cmdline.d/cmdline.conf || exit
cat <<-MKINITCPIO_PRESET > /etc/mkinitcpio.d/${kernel}.preset || exit cp /etc/mkinitcpio.d/${kernel}.preset /etc/mkinitcpio.d/${kernel}.preset.bak
ALL_kver="/boot/vmlinuz-${kernel}" cat <<-MKINITCPIO_PRESET > /etc/mkinitcpio.d/${kernel}.preset || exit
PRESETS=('default') ALL_kver="/boot/vmlinuz-${kernel}"
default_config="/etc/mkinitcpio.conf.d/mkinitcpiod.conf" PRESETS=('default')
default_uki="${btldr_esp_mount}/EFI/Linux/arch-${kernel}.efi" default_config="/etc/mkinitcpio.conf.d/mkinitcpiod.conf"
default_uki="${btldr_esp_mount}/EFI/Linux/arch-${kernel}.efi"
MKINITCPIO_PRESET MKINITCPIO_PRESET
mkinitcpio -P || exit mkinitcpio -P || exit
UKI UKI
stage_ok stage_ok
else else
stage_fail stage_fail
fi fi
if [[ -e /mnt/boot/initramfs-"${kernel}".img ]]; then
rm /mnt/boot/initramfs-"${kernel}".img || exit if [[ -e /mnt/boot/initramfs-"${kernel}".img ]]; then
fi rm /mnt/boot/initramfs-"${kernel}".img || exit
if [[ -e /mnt/boot/initramfs-"${kernel}"-fallback.img ]]; then fi
rm /mnt/boot/initramfs-"${kernel}"-fallback.img || exit
fi if [[ -e /mnt/boot/initramfs-"${kernel}"-fallback.img ]]; then
rm /mnt/boot/initramfs-"${kernel}"-fallback.img || exit
fi
elif [[ "${bootloader}" == "2" ]]; then elif [[ "${bootloader}" == "2" ]]; then
if arch-chroot /mnt <<- UKI > /dev/null 2>&1 ; then if arch-chroot /mnt <<- UKI > /dev/null 2>&1 ; then
mkdir /etc/cmdline.d || exit mkdir /etc/cmdline.d || exit
echo "rw ${boot_opts}" | tee /etc/cmdline.d/cmdline.conf || exit echo "rw ${boot_opts}" | tee /etc/cmdline.d/cmdline.conf || exit
cp /etc/mkinitcpio.d/${kernel}.preset /etc/mkinitcpio.d/${kernel}.preset.bak cp /etc/mkinitcpio.d/${kernel}.preset /etc/mkinitcpio.d/${kernel}.preset.bak
cat <<-MKINITCPIO_PRESET > /etc/mkinitcpio.d/${kernel}.preset || exit cat <<-MKINITCPIO_PRESET > /etc/mkinitcpio.d/${kernel}.preset || exit
ALL_kver="/boot/vmlinuz-${kernel}" ALL_kver="/boot/vmlinuz-${kernel}"
PRESETS=('default') PRESETS=('default')
default_config="/etc/mkinitcpio.conf.d/mkinitcpiod.conf" default_config="/etc/mkinitcpio.conf.d/mkinitcpiod.conf"
default_image="/boot/initramfs-${kernel}.img" default_image="/boot/initramfs-${kernel}.img"
default_uki="${btldr_esp_mount}/EFI/Linux/arch-${kernel}.efi" default_uki="${btldr_esp_mount}/EFI/Linux/arch-${kernel}.efi"
MKINITCPIO_PRESET MKINITCPIO_PRESET
mkinitcpio -P || exit mkinitcpio -P || exit
UKI UKI
stage_ok stage_ok
else else
@ -5733,7 +5665,7 @@ set_vars() {
# Set Default '/Temp' path # Set Default '/Temp' path
vga_bootopts="nvidia_drm.modeset=1 nvidia_drm.fbdev=1 nvidia.NVreg_UsePageAttributeTable=1 nvidia.NVreg_PreserveVideoMemoryAllocations=1 " vga_bootopts="nvidia_drm.modeset=1 nvidia_drm.fbdev=1 nvidia.NVreg_UsePageAttributeTable=1 nvidia.NVreg_PreserveVideoMemoryAllocations=1 "
fi fi
# No Preserve-Nvidia-Video-Memory after suspend/hibernate/resume # No-Preserve-Nvidia-Video-Memory after suspend/hibernate/resume
else else
# Mkinitcpio Modules (Encryption) [Early Nvidia KMS] # Mkinitcpio Modules (Encryption) [Early Nvidia KMS]
mkinitcpio_mods="MODULES=(nvidia nvidia_modeset nvidia_uvm nvidia_drm ${fs_mod})" mkinitcpio_mods="MODULES=(nvidia nvidia_modeset nvidia_uvm nvidia_drm ${fs_mod})"
@ -5762,8 +5694,8 @@ set_vars() {
## Configuration = 'No' ## Configuration = 'No'
elif [[ "${vgaconf}" == "n" ]]; then elif [[ "${vgaconf}" == "n" ]]; then
# Mkinitcpio Hooks (Encryption) # Mkinitcpio Hooks (Encryption)
mkinitcpio_hooks="HOOKS=(systemd keyboard autodetect microcode modconf kms sd-vconsole block sd-encrypt filesystems fsck)" mkinitcpio_hooks="HOOKS=(systemd keyboard autodetect microcode modconf kms sd-vconsole block sd-encrypt filesystems fsck)"
# Nvidia # Nvidia
if [[ "${vendor}" == "Nvidia" ]]; then if [[ "${vendor}" == "Nvidia" ]]; then
# Mkinitcpio Modules (Encryption) # Mkinitcpio Modules (Encryption)
mkinitcpio_mods="MODULES=(${fs_mod} nouveau)" mkinitcpio_mods="MODULES=(${fs_mod} nouveau)"
@ -5840,8 +5772,8 @@ set_vars() {
## Configuration = 'No' ## Configuration = 'No'
elif [[ "${vgaconf}" == "n" ]]; then elif [[ "${vgaconf}" == "n" ]]; then
# Mkinitcpio Hooks # Mkinitcpio Hooks
mkinitcpio_hooks="HOOKS=(systemd autodetect microcode modconf kms keyboard sd-vconsole block filesystems fsck)" mkinitcpio_hooks="HOOKS=(systemd autodetect microcode modconf kms keyboard sd-vconsole block filesystems fsck)"
# Nvidia # Nvidia
if [[ "${vendor}" == "Nvidia" ]]; then if [[ "${vendor}" == "Nvidia" ]]; then
# Mkinitcpio Modules # Mkinitcpio Modules
mkinitcpio_mods="MODULES=(nouveau)" mkinitcpio_mods="MODULES=(nouveau)"
@ -5876,6 +5808,7 @@ ${magenta}###${nc}--------------------------------${magenta}[ ${bwhite}Chroot &
if [[ "${packages}" =~ ^(1|3|5|6|7|8|9|10|11)$ ]]; then if [[ "${packages}" =~ ^(1|3|5|6|7|8|9|10|11)$ ]]; then
cnfg cnfg
main_chroot main_chroot
if [[ -f /mnt/etc/lightdm/lightdm.conf ]]; then if [[ -f /mnt/etc/lightdm/lightdm.conf ]]; then
cnfg cnfg
if [[ "${packages}" == "7" ]]; then if [[ "${packages}" == "7" ]]; then
@ -5907,6 +5840,7 @@ SLICK
fi fi
fi fi
fi fi
if [[ -n "${bluetooth}" ]]; then if [[ -n "${bluetooth}" ]]; then
cnfg cnfg
stage_prompt="Bluetooth Service" stage_prompt="Bluetooth Service"
@ -5918,6 +5852,7 @@ BLUETOOTH
stage_fail stage_fail
fi fi
fi fi
if [[ -n "${displaymanager}" ]]; then if [[ -n "${displaymanager}" ]]; then
cnfg cnfg
stage_prompt="Display Manager Service" stage_prompt="Display Manager Service"
@ -5929,6 +5864,7 @@ DM_SERVICE
stage_fail stage_fail
fi fi
fi fi
if [[ -n "${network}" ]]; then if [[ -n "${network}" ]]; then
cnfg cnfg
stage_prompt="Network Manager Service" stage_prompt="Network Manager Service"
@ -5940,6 +5876,7 @@ NETWORK
stage_fail stage_fail
fi fi
fi fi
btldr_conf btldr_conf
trim_conf trim_conf
vm_serv_conf vm_serv_conf
@ -5954,10 +5891,11 @@ NETWORK
if [[ "${packages}" == "12" ]]; then if [[ "${packages}" == "12" ]]; then
cnfg cnfg
main_chroot main_chroot
if [[ -f /mnt/etc/lightdm/lightdm.conf ]]; then if [[ -f /mnt/etc/lightdm/lightdm.conf ]]; then
cnfg cnfg
if [[ "${greeternmbr}" == "1" ]]; then if [[ "${greeternmbr}" == "1" ]]; then
stage_prompt="GTK Greeter" stage_prompt="GTK Greeter"
if arch-chroot /mnt <<-GTK > /dev/null 2>&1 ; then if arch-chroot /mnt <<-GTK > /dev/null 2>&1 ; then
sed -i 's|^#greeter-session=example-gtk-gnome|greeter-session=lightdm-gtk-greeter|g' /etc/lightdm/lightdm.conf || exit sed -i 's|^#greeter-session=example-gtk-gnome|greeter-session=lightdm-gtk-greeter|g' /etc/lightdm/lightdm.conf || exit
GTK GTK
@ -5985,6 +5923,7 @@ DEEPIN
fi fi
fi fi
fi fi
if [[ -n "${customservices}" ]]; then if [[ -n "${customservices}" ]]; then
cnfg cnfg
stage_prompt="Custom Service(s)" stage_prompt="Custom Service(s)"
@ -5996,6 +5935,7 @@ CUSTOM_SERV
stage_fail stage_fail
fi fi
fi fi
btldr_conf btldr_conf
trim_conf trim_conf
vm_serv_conf vm_serv_conf
@ -6010,16 +5950,19 @@ CUSTOM_SERV
if [[ "${packages}" == "2" || "${packages}" == "4" ]]; then if [[ "${packages}" == "2" || "${packages}" == "4" ]]; then
stage_prompt="Optimized System" stage_prompt="Optimized System"
cnfg cnfg
if [[ "${packages}" == "2" ]]; then if [[ "${packages}" == "2" ]]; then
displaymanager="sddm" displaymanager="sddm"
elif [[ "${packages}" == "4" ]]; then elif [[ "${packages}" == "4" ]]; then
displaymanager="gdm" displaymanager="gdm"
fi fi
if [[ -n "${nrg_plc}" ]]; then if [[ -n "${nrg_plc}" ]]; then
arch-chroot /mnt <<-NRG > /dev/null 2>&1 arch-chroot /mnt <<-NRG > /dev/null 2>&1
${nrg_plc} performance ${nrg_plc} performance
NRG NRG
fi fi
if arch-chroot /mnt <<-OPTIMIZED_CONF > /dev/null 2>&1 ; then if arch-chroot /mnt <<-OPTIMIZED_CONF > /dev/null 2>&1 ; then
sed -i "/^#${SETLOCALE}/s/^#//" /etc/locale.gen || exit sed -i "/^#${SETLOCALE}/s/^#//" /etc/locale.gen || exit
locale-gen || exit locale-gen || exit
@ -6029,77 +5972,77 @@ NRG
sed -i "/^#Color/s/^#//" /etc/pacman.conf || exit sed -i "/^#Color/s/^#//" /etc/pacman.conf || exit
update-pciids || exit update-pciids || exit
cat <<-MKINITCPIO_CONF > /etc/mkinitcpio.conf.d/mkinitcpiod.conf || exit cat <<-MKINITCPIO_CONF > /etc/mkinitcpio.conf.d/mkinitcpiod.conf || exit
${mkinitcpio_mods} ${mkinitcpio_mods}
${mkinitcpio_hooks} ${mkinitcpio_hooks}
COMPRESSION="zstd" COMPRESSION="zstd"
COMPRESSION_OPTIONS=(-c -T$(nproc) --auto-threads=logical -) COMPRESSION_OPTIONS=(-c -T$(nproc) --auto-threads=logical -)
MODULES_DECOMPRESS="yes" MODULES_DECOMPRESS="yes"
MKINITCPIO_CONF MKINITCPIO_CONF
mkinitcpio -P || exit mkinitcpio -P || exit
cat <<-MAKEPKG_CONF > /etc/makepkg.conf.d/makepkgd.conf || exit cat <<-MAKEPKG_CONF > /etc/makepkg.conf.d/makepkgd.conf || exit
CFLAGS="-march=native -O2 -pipe -fno-plt -fexceptions \ CFLAGS="-march=native -O2 -pipe -fno-plt -fexceptions \
-Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security \ -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security \
-fstack-clash-protection -fcf-protection \ -fstack-clash-protection -fcf-protection \
-fno-omit-frame-pointer -mno-omit-leaf-frame-pointer" -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer"
MAKEFLAGS="-j4" MAKEFLAGS="-j4"
BUILDENV=(!distcc color ccache check !sign) BUILDENV=(!distcc color ccache check !sign)
OPTIONS=(strip docs !libtool !staticlibs emptydirs zipman purge !debug lto) OPTIONS=(strip docs !libtool !staticlibs emptydirs zipman purge !debug lto)
COMPRESSGZ=(pigz -c -f -n) COMPRESSGZ=(pigz -c -f -n)
COMPRESSBZ2=(pbzip2 -c -f) COMPRESSBZ2=(pbzip2 -c -f)
COMPRESSZST=(zstd -c -T0 --auto-threads=logical -) COMPRESSZST=(zstd -c -T0 --auto-threads=logical -)
MAKEPKG_CONF MAKEPKG_CONF
ln -sf /usr/share/zoneinfo/$(curl -s http://ip-api.com/line?fields=timezone) /etc/localtime || exit ln -sf /usr/share/zoneinfo/$(curl -s http://ip-api.com/line?fields=timezone) /etc/localtime || exit
hwclock --systohc || exit hwclock --systohc || exit
echo ${HOSTNAME} > /etc/hostname || exit echo ${HOSTNAME} > /etc/hostname || exit
cat <<-HOSTS >> /etc/hosts || exit cat <<-HOSTS >> /etc/hosts || exit
127.0.0.1 localhost 127.0.0.1 localhost
::1 localhost ::1 localhost
127.0.1.1 ${HOSTNAME}.localdomain ${HOSTNAME} 127.0.1.1 ${HOSTNAME}.localdomain ${HOSTNAME}
HOSTS HOSTS
cat <<-SYSCTL_CONF > /etc/sysctl.d/99-sysctld.conf || exit cat <<-SYSCTL_CONF > /etc/sysctl.d/99-sysctld.conf || exit
net.core.netdev_max_backlog = 16384 net.core.netdev_max_backlog = 16384
net.core.somaxconn = 8192 net.core.somaxconn = 8192
net.core.rmem_default = 1048576 net.core.rmem_default = 1048576
net.core.rmem_max = 16777216 net.core.rmem_max = 16777216
net.core.wmem_default = 1048576 net.core.wmem_default = 1048576
net.core.wmem_max = 16777216 net.core.wmem_max = 16777216
net.core.optmem_max = 65536 net.core.optmem_max = 65536
net.ipv4.tcp_rmem = 4096 1048576 2097152 net.ipv4.tcp_rmem = 4096 1048576 2097152
net.ipv4.tcp_wmem = 4096 65536 16777216 net.ipv4.tcp_wmem = 4096 65536 16777216
net.ipv4.udp_rmem_min = 8192 net.ipv4.udp_rmem_min = 8192
net.ipv4.udp_wmem_min = 8192 net.ipv4.udp_wmem_min = 8192
net.ipv4.tcp_fastopen = 3 net.ipv4.tcp_fastopen = 3
net.ipv4.tcp_max_syn_backlog = 8192 net.ipv4.tcp_max_syn_backlog = 8192
net.ipv4.tcp_max_tw_buckets = 2000000 net.ipv4.tcp_max_tw_buckets = 2000000
net.ipv4.tcp_tw_reuse = 1 net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_fin_timeout = 10 net.ipv4.tcp_fin_timeout = 10
net.ipv4.tcp_slow_start_after_idle = 0 net.ipv4.tcp_slow_start_after_idle = 0
net.ipv4.tcp_keepalive_time = 60 net.ipv4.tcp_keepalive_time = 60
net.ipv4.tcp_keepalive_intvl = 10 net.ipv4.tcp_keepalive_intvl = 10
net.ipv4.tcp_keepalive_probes = 6 net.ipv4.tcp_keepalive_probes = 6
net.ipv4.tcp_mtu_probing = 1 net.ipv4.tcp_mtu_probing = 1
net.ipv4.tcp_sack = 1 net.ipv4.tcp_sack = 1
net.core.default_qdisc = cake net.core.default_qdisc = cake
net.ipv4.tcp_congestion_control = bbr net.ipv4.tcp_congestion_control = bbr
net.ipv4.ip_local_port_range = 30000 65535 net.ipv4.ip_local_port_range = 30000 65535
net.ipv4.conf.default.rp_filter = 1 net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.all.rp_filter = 1 net.ipv4.conf.all.rp_filter = 1
vm.vfs_cache_pressure = 50 vm.vfs_cache_pressure = 50
vm.mmap_min_addr = 65536 vm.mmap_min_addr = 65536
kernel.printk = 0 0 0 0 kernel.printk = 0 0 0 0
${perf_stream} ${perf_stream}
SYSCTL_CONF SYSCTL_CONF
cat <<-UDISKS2_CONF > /etc/udisks2/mount_options.conf || exit cat <<-UDISKS2_CONF > /etc/udisks2/mount_options.conf || exit
[defaults] [defaults]
ntfs:ntfs3_defaults=uid=1000,gid=1000,windows_names ntfs:ntfs3_defaults=uid=1000,gid=1000,windows_names
ntfs:ntfs3_allow=uid=1000,gid=1000,umask,dmask,fmask,iocharset,discard,nodiscard,sparse,nosparse,hidden,nohidden,sys_immutable,nosys_immutable,showmeta,noshowmeta,prealloc,noprealloc,hide_dot_files,nohide_dot_files,windows_names,nocase,case ntfs:ntfs3_allow=uid=1000,gid=1000,umask,dmask,fmask,iocharset,discard,nodiscard,sparse,nosparse,hidden,nohidden,sys_immutable,nosys_immutable,showmeta,noshowmeta,prealloc,noprealloc,hide_dot_files,nohide_dot_files,windows_names,nocase,case
UDISKS2_CONF UDISKS2_CONF
cat <<-POLKIT_CONF > /etc/polkit-1/rules.d/99-udisks2.rules || exit cat <<-POLKIT_CONF > /etc/polkit-1/rules.d/99-udisks2.rules || exit
// Original rules: https://github.com/coldfix/udiskie/wiki/Permissions // Original rules: https://github.com/coldfix/udiskie/wiki/Permissions
// Changes: Added org.freedesktop.udisks2.filesystem-mount-system, as this is used by Dolphin. // Changes: Added org.freedesktop.udisks2.filesystem-mount-system, as this is used by Dolphin.
polkit.addRule(function(action, subject) { polkit.addRule(function(action, subject) {
var YES = polkit.Result.YES; var YES = polkit.Result.YES;
var permission = { var permission = {
// required for udisks1: // required for udisks1:
"org.freedesktop.udisks.filesystem-mount": YES, "org.freedesktop.udisks.filesystem-mount": YES,
"org.freedesktop.udisks.luks-unlock": YES, "org.freedesktop.udisks.luks-unlock": YES,
@ -6119,40 +6062,40 @@ UDISKS2_CONF
"org.freedesktop.udisks2.encrypted-unlock-system": YES, "org.freedesktop.udisks2.encrypted-unlock-system": YES,
"org.freedesktop.udisks2.eject-media-other-seat": YES, "org.freedesktop.udisks2.eject-media-other-seat": YES,
"org.freedesktop.udisks2.power-off-drive-other-seat": YES "org.freedesktop.udisks2.power-off-drive-other-seat": YES
}; };
if (subject.isInGroup("wheel")) { if (subject.isInGroup("wheel")) {
return permission[action.id]; return permission[action.id];
} }
}); });
POLKIT_CONF POLKIT_CONF
mkdir -p /etc/systemd/journald.conf.d > /dev/null 2>&1 || exit mkdir -p /etc/systemd/journald.conf.d > /dev/null 2>&1 || exit
cat <<-JOURNAL_CONF > /etc/systemd/journald.conf.d/00-journald.conf || exit cat <<-JOURNAL_CONF > /etc/systemd/journald.conf.d/00-journald.conf || exit
[Journal] [Journal]
SystemMaxUse=100M SystemMaxUse=100M
JOURNAL_CONF JOURNAL_CONF
mkdir -p /etc/systemd/user.conf.d > /dev/null 2>&1 || exit mkdir -p /etc/systemd/user.conf.d > /dev/null 2>&1 || exit
cat <<-USER_CONF > /etc/systemd/user.conf.d/00-userd.conf || exit cat <<-USER_CONF > /etc/systemd/user.conf.d/00-userd.conf || exit
[Manager] [Manager]
DefaultTimeoutStopSec=5s DefaultTimeoutStopSec=5s
DefaultTimeoutAbortSec=5s DefaultTimeoutAbortSec=5s
USER_CONF USER_CONF
sed -i 's|^hosts.*|hosts: mymachines mdns_minimal resolve [!UNAVAIL=return] files myhostname dns|g' /etc/nsswitch.conf || exit sed -i 's|^hosts.*|hosts: mymachines mdns_minimal resolve [!UNAVAIL=return] files myhostname dns|g' /etc/nsswitch.conf || exit
sed -i 's/ interface = [^ ]*/ interface = all/g' /etc/ipp-usb/ipp-usb.conf || exit sed -i 's/ interface = [^ ]*/ interface = all/g' /etc/ipp-usb/ipp-usb.conf || exit
sed -i "/# set linenumbers/"'s/^#//' /etc/nanorc || exit sed -i "/# set linenumbers/"'s/^#//' /etc/nanorc || exit
echo tcp_bbr | tee /etc/modules-load.d/modulesd.conf || exit echo tcp_bbr | tee /etc/modules-load.d/modulesd.conf || exit
cat <<-SUPPLICANT_CONF > /etc/wpa_supplicant/wpa_supplicant.conf || exit cat <<-SUPPLICANT_CONF > /etc/wpa_supplicant/wpa_supplicant.conf || exit
country=${REGDOM} country=${REGDOM}
wps_cred_add_sae=1 wps_cred_add_sae=1
pmf=2 pmf=2
SUPPLICANT_CONF SUPPLICANT_CONF
echo root:${ROOTPASSWD2} | chpasswd || exit echo root:${ROOTPASSWD2} | chpasswd || exit
chsh -s /bin/zsh || exit chsh -s /bin/zsh || exit
useradd -m -G wheel,realtime -s /bin/zsh ${USERNAME} || exit useradd -m -G wheel,realtime -s /bin/zsh ${USERNAME} || exit
echo ${USERNAME}:${USERPASSWD2} | chpasswd || exit echo ${USERNAME}:${USERPASSWD2} | chpasswd || exit
cat <<-SUDOERS_CONF > /etc/sudoers.d/sudoersd || exit cat <<-SUDOERS_CONF > /etc/sudoers.d/sudoersd || exit
Defaults pwfeedback Defaults pwfeedback
Defaults editor=/usr/bin/nano Defaults editor=/usr/bin/nano
%wheel ALL=(ALL) ALL %wheel ALL=(ALL) ALL
SUDOERS_CONF SUDOERS_CONF
visudo -c /etc/sudoers.d/sudoersd visudo -c /etc/sudoers.d/sudoersd
systemctl enable avahi-daemon bluetooth cups ipp-usb NetworkManager rngd ${displaymanager} ${trim} ${vm_services} ${nvidia_services} || exit systemctl enable avahi-daemon bluetooth cups ipp-usb NetworkManager rngd ${displaymanager} ${trim} ${vm_services} ${nvidia_services} || exit
@ -6161,12 +6104,14 @@ OPTIMIZED_CONF
else else
stage_fail stage_fail
fi fi
btldr_conf btldr_conf
zram_conf zram_conf
nvidia_hook_conf nvidia_hook_conf
uki_conf uki_conf
completion completion
fi fi
umount -R /mnt umount -R /mnt
exit exit
} }