diff --git a/Amelia.sh b/Amelia.sh index 5b44d05..0098dea 100644 --- a/Amelia.sh +++ b/Amelia.sh @@ -1,7 +1,7 @@ #!/bin/bash # Amelia Installer -# Version: 3.6 +# Version: 3.7 set -euo pipefail ########################################################################################### @@ -1344,25 +1344,27 @@ ${purple}###${nc} Desktop Selection ${purple}###${nc} [1] Plasma - [2] Plasma & Systemd-boot & Wayland (System Optimized) + [2] Plasma & Systemd-boot (System Optimized) [3] Gnome + + [4] Gnome & Systemd-boot (System Optimized) - [4] Xfce + [5] Xfce - [5] Cinnamon + [6] Cinnamon - [6] Deepin + [7] Deepin - [7] Budgie + [8] Budgie - [8] Lxqt + [9] Lxqt - [9] Mate + [10] Mate - [10] Base System (No Desktop) + [11] Base System (No Desktop) - [11] Custom System ${red}[!] EXPERTS ONLY [!]" + [12] Custom System ${red}[!] EXPERTS ONLY [!]" BLUE " @@ -1378,8 +1380,10 @@ Enter a number: " 3) desktopname="'Gnome'" ;; 4) - desktopname="'Xfce'" ;; + desktopname="'Gnome (System Optimized)'" ;; 5) + desktopname="'Xfce'" ;; + 6) desktopname="'Cinnamon'" sleep 0.5 YELLOW " @@ -1420,9 +1424,9 @@ Enter [y/n]: " return 1 ;; esac ;; - 6) - desktopname="'Deepin'" ;; 7) + desktopname="'Deepin'" ;; + 8) desktopname="'Budgie'" sleep 0.5 YELLOW " @@ -1463,13 +1467,13 @@ Enter [y/n]: " return 1 ;; esac ;; - 8) - desktopname="'Lxqt'" ;; 9) - desktopname="'Mate'" ;; + desktopname="'Lxqt'" ;; 10) - desktopname="'Base System'" ;; + desktopname="'Mate'" ;; 11) + desktopname="'Base System'" ;; + 12) desktopname="'Custom System'" until cust_sys; do :; done return 0 ;; @@ -3732,7 +3736,7 @@ ${purple}###${nc} Pacstrap System ${purple}###${nc} bluetooth="bluetooth" network="NetworkManager" ;; - 2) # NOTE: Plasma & Systemd-boot & Wayland Desktop: + 2) # NOTE: Plasma & Systemd-boot & Optimized Desktop: deskpkgs=""${basepkgs}" alsa-firmware alsa-utils arj ark bluedevil breeze-gtk ccache cups-pdf cups-pk-helper dolphin-plugins e2fsprogs efibootmgr exfatprogs fdkaac ffmpegthumbs firefox git glibc-locales gst-libav gst-plugin-libcamera gst-plugin-msdk gst-plugin-opencv gst-plugin-pipewire gst-plugin-qmlgl gst-plugin-va gst-plugin-wpe gst-plugins-ugly gstreamer-vaapi icoutils ipp-usb kamera kamoso kate kcalc kde-gtk-config kdegraphics-mobipocket kdegraphics-thumbnailers kdenetwork-filesharing kdeplasma-addons kdesdk-kio kdesdk-thumbnailers kdialog keditbookmarks kget kimageformats kinit kio-admin kio-gdrive kio-zeroconf kompare konsole kscreen kvantum kwrited libappimage libfido2 libktorrent libmms libnfs libva-utils lirc lrzip lua52-socket lzop mac man-db man-pages mesa-demos mesa-utils nano-syntax-highlighting nss-mdns ntfs-3g okular opus-tools p7zip packagekit-qt6 pacman-contrib partitionmanager pdfmixtool pigz pipewire-alsa pipewire-pulse pkgstats plasma-browser-integration plasma-desktop plasma-disks plasma-firewall plasma-nm plasma-pa plasma-wayland-protocols power-profiles-daemon powerdevil powerline powerline-fonts print-manager python-pyqt6 python-reportlab qbittorrent qt6-imageformats qt6-scxml qt6-virtualkeyboard realtime-privileges reflector rng-tools sddm-kcm skanlite sof-firmware sox spectacle sshfs system-config-printer terminus-font timidity++ ttf-ubuntu-font-family ufw-extras unarchiver unrar unzip usb_modeswitch usbutils vdpauinfo vlc vorbis-tools vorbisgain wget xdg-desktop-portal xdg-desktop-portal-gtk xdg-desktop-portal-kde xsane zip zsh zsh-autosuggestions zsh-completions zsh-syntax-highlighting "${nrg_plc}"" ;; @@ -3743,50 +3747,54 @@ ${purple}###${nc} Pacstrap System ${purple}###${nc} bluetooth="bluetooth" network="NetworkManager" ;; - 4) # NOTE: Xfce Desktop: + 4) # NOTE: Gnome & Systemd-boot & Optimized Desktop: + + deskpkgs=""${basepkgs}" evince file-roller gdm gnome-calculator gnome-clocks gnome-console gnome-control-center gnome-disk-utility gnome-keyring gnome-menus gnome-session gnome-shell-extensions gnome-system-monitor gnome-text-editor gnome-tweaks gvfs gvfs-afc gvfs-mtp loupe malcontent nautilus networkmanager power-profiles-daemon simple-scan snapshot sushi system-config-printer xdg-desktop-portal-gnome xdg-user-dirs-gtk alsa-firmware alsa-utils ccache cups-pdf e2fsprogs efibootmgr exfatprogs fdkaac git glibc-locales gst-libav gst-plugin-libcamera gst-plugin-msdk gst-plugin-opencv gst-plugin-pipewire gst-plugin-qmlgl gst-plugin-va gst-plugin-wpe gst-plugins-ugly gstreamer-vaapi icoutils ipp-usb libfido2 libva-utils lrzip mac man-db man-pages mesa-utils nano-syntax-highlighting nss-mdns ntfs-3g p7zip pacman-contrib pdfmixtool pigz pipewire-alsa pipewire-pulse pkgstats powerline powerline-fonts qbittorrent realtime-privileges reflector rng-tools sof-firmware terminus-font ttf-ubuntu-font-family ufw-extras unrar unzip usb_modeswitch usbutils vdpauinfo vlc wget zip zsh zsh-autosuggestions zsh-completions zsh-syntax-highlighting "${nrg_plc}"" ;; + + 5) # NOTE: Xfce Desktop: deskpkgs=""${basepkgs}" xfce4 lightdm-slick-greeter network-manager-applet" displaymanager="lightdm" network="NetworkManager" ;; - 5) # NOTE: Cinnamon Desktop: + 6) # NOTE: Cinnamon Desktop: deskpkgs=""${basepkgs}" cinnamon blueberry lightdm-slick-greeter system-config-printer gnome-keyring "${terminal}"" displaymanager="lightdm" bluetooth="bluetooth" network="NetworkManager" ;; - 6) # NOTE: Deepin Desktop: + 7) # NOTE: Deepin Desktop: deskpkgs=""${basepkgs}" deepin deepin-terminal deepin-kwin networkmanager" displaymanager="lightdm" network="NetworkManager" ;; - 7) # NOTE: Budgie Desktop: + 8) # NOTE: Budgie Desktop: deskpkgs=""${basepkgs}" budgie lightdm-gtk-greeter arc-gtk-theme papirus-icon-theme network-manager-applet "${terminal}"" displaymanager="lightdm" network="NetworkManager" ;; - 8) # NOTE: Lxqt Desktop: + 9) # NOTE: Lxqt Desktop: deskpkgs=""${basepkgs}" lxqt breeze-icons network-manager-applet sddm xscreensaver" displaymanager="sddm" network="NetworkManager" ;; - 9) # NOTE: Mate Desktop: + 10) # NOTE: Mate Desktop: deskpkgs=""${basepkgs}" mate mate-terminal mate-media blueman network-manager-applet mate-power-manager system-config-printer lightdm-slick-greeter" displaymanager="lightdm" bluetooth="bluetooth" network="NetworkManager" ;; - 10) # NOTE: Base System: + 11) # NOTE: Base System: deskpkgs=""${basepkgs}" networkmanager" network="NetworkManager" ;; - 11) # NOTE: Custom System: + 12) # NOTE: Custom System: if [[ "${vendor}" == "Virtual Machine" ]]; then deskpkgs="base sudo "${bootldr_pkgs}" "${custompkgs}" "${fstools}" "${kernel}" "${microcode}" "${vmpkgs}" "${greeter}"" @@ -4012,7 +4020,7 @@ ${purple}###${nc} Chroot & Configure System ${purple}###${nc} # NOTE: All Vanilla Desktops Basic Configuration: - if [[ "${packages}" =~ ^(1|3|4|5|6|7|8|9|10)$ ]]; then + if [[ "${packages}" =~ ^(1|3|5|6|7|8|9|10|11)$ ]]; then arch-chroot /mnt <<-VANILLA_CONF sed -i "/^#${SETLOCALE}/s/^#//" /etc/locale.gen && @@ -4043,11 +4051,11 @@ VANILLA_CONF if [[ -f /mnt/etc/lightdm/lightdm.conf ]]; then - if [[ "${packages}" == "6" ]]; then + if [[ "${packages}" == "7" ]]; then arch-chroot /mnt <<-DEEPIN sed -i 's|^#greeter-session=example-gtk-gnome|greeter-session=lightdm-deepin-greeter|g' /etc/lightdm/lightdm.conf DEEPIN - elif [[ "${packages}" == "7" ]]; then + elif [[ "${packages}" == "8" ]]; then arch-chroot /mnt <<-GTK sed -i 's|^#greeter-session=example-gtk-gnome|greeter-session=lightdm-gtk-greeter|g' /etc/lightdm/lightdm.conf GTK @@ -4130,7 +4138,7 @@ NVIDIAHOOK #------------------------------------------------------------------------------------------ - # NOTE: Plasma & Systemd-boot & Wayland Optimized System Configuration: + # NOTE: Plasma & Systemd-boot Optimized System Configuration: if [[ "${packages}" == "2" ]]; then @@ -4306,12 +4314,191 @@ NVIDIAHOOK err_instl_abort fi fi + +#------------------------------------------------------------------------------------------ + + # NOTE: Gnome & Systemd-boot Optimized System Configuration: + + if [[ "${packages}" == "4" ]]; then + + if [[ -n "${nrg_plc}" ]]; then + arch-chroot /mnt <<-NRG + ${nrg_plc} performance +NRG + fi + + arch-chroot /mnt <<-OPTIMIZED_CONF + sed -i "/^#${SETLOCALE}/s/^#//" /etc/locale.gen && + locale-gen && + echo LANG=${SETLOCALE} > /etc/locale.conf && + export LANG=${SETLOCALE} && + echo KEYMAP=${SETKBD} > /etc/vconsole.conf && + sed -i "/^#Color/s/^#//" /etc/pacman.conf && + update-pciids && + echo ' + ${mkinitcpio_mods} + ${mkinitcpio_hooks} + COMPRESSION_OPTIONS=(-c -T$(nproc) -) + MODULES_DECOMPRESS="yes"' | tee /etc/mkinitcpio.conf.d/custom.conf && + mkinitcpio -P && + cp -v /etc/makepkg.conf /etc/makepkg.conf.bak && + sed -i \ + -e 's|-march=[^ ]* -mtune=[^ ]*|-march=native|g' \ + -e 's|^#RUSTFLAGS.*|RUSTFLAGS="-C opt-level=2"|g' \ + -e 's|^#MAKEFLAGS.*|MAKEFLAGS="-j$(nproc)"|g' \ + -e 's|^BUILDENV.*|BUILDENV=(!distcc color ccache check !sign)|g' \ + -e 's|^OPTIONS.*|OPTIONS=(strip docs !libtool !staticlibs emptydirs zipman purge !debug lto)|g' \ + -e 's|^COMPRESSGZ.*|COMPRESSGZ=(pigz -c -f -n)|g' \ + -e 's|^COMPRESSBZ2.*|COMPRESSBZ2=(pbzip2 -c -f)|g' \ + -e 's|^COMPRESSXZ.*|COMPRESSXZ=(xz -c -z --threads=0 -)|g' /etc/makepkg.conf && + ln -sf /usr/share/zoneinfo/$(curl -s http://ip-api.com/line?fields=timezone) /etc/localtime && + hwclock --systohc && + echo ${HOSTNAME} > /etc/hostname && + echo " + 127.0.0.1 localhost + ::1 localhost + 127.0.1.1 ${HOSTNAME}.localdomain ${HOSTNAME}" >> /etc/hosts && + echo " + net.core.netdev_max_backlog = 16384 + net.core.somaxconn = 8192 + net.core.rmem_default = 1048576 + net.core.rmem_max = 16777216 + net.core.wmem_default = 1048576 + net.core.wmem_max = 16777216 + net.core.optmem_max = 65536 + net.ipv4.tcp_rmem = 4096 1048576 2097152 + net.ipv4.tcp_wmem = 4096 65536 16777216 + net.ipv4.udp_rmem_min = 8192 + net.ipv4.udp_wmem_min = 8192 + net.ipv4.tcp_fastopen = 3 + net.ipv4.tcp_max_syn_backlog = 8192 + net.ipv4.tcp_max_tw_buckets = 2000000 + net.ipv4.tcp_tw_reuse = 1 + net.ipv4.tcp_fin_timeout = 10 + net.ipv4.tcp_slow_start_after_idle = 0 + net.ipv4.tcp_keepalive_time = 60 + net.ipv4.tcp_keepalive_intvl = 10 + net.ipv4.tcp_keepalive_probes = 6 + net.ipv4.tcp_mtu_probing = 1 + net.ipv4.tcp_sack = 1 + net.core.default_qdisc = cake + net.ipv4.tcp_congestion_control = bbr + net.ipv4.ip_local_port_range = 30000 65535 + net.ipv4.conf.default.rp_filter = 1 + net.ipv4.conf.all.rp_filter = 1 + vm.vfs_cache_pressure = 50 + vm.mmap_min_addr = 65536 + kernel.printk = 0 0 0 0 + ${perf_stream}" | tee /etc/sysctl.d/99-performance.conf && + echo " + [defaults] + ntfs:ntfs3_defaults=uid=1000,gid=1000" | tee /etc/udisks2/mount_options.conf && + echo ' + // Original rules: https://github.com/coldfix/udiskie/wiki/Permissions + // Changes: Added org.freedesktop.udisks2.filesystem-mount-system, as this is used by Dolphin. + + polkit.addRule(function(action, subject) { + var YES = polkit.Result.YES; + var permission = { + // required for udisks1: + "org.freedesktop.udisks.filesystem-mount": YES, + "org.freedesktop.udisks.luks-unlock": YES, + "org.freedesktop.udisks.drive-eject": YES, + "org.freedesktop.udisks.drive-detach": YES, + // required for udisks2: + "org.freedesktop.udisks2.filesystem-mount": YES, + "org.freedesktop.udisks2.encrypted-unlock": YES, + "org.freedesktop.udisks2.eject-media": YES, + "org.freedesktop.udisks2.power-off-drive": YES, + // Dolphin specific: + "org.freedesktop.udisks2.filesystem-mount-system": YES, + // required for udisks2 if using udiskie from another seat (e.g. systemd): + "org.freedesktop.udisks2.filesystem-mount-other-seat": YES, + "org.freedesktop.udisks2.filesystem-unmount-others": YES, + "org.freedesktop.udisks2.encrypted-unlock-other-seat": YES, + "org.freedesktop.udisks2.encrypted-unlock-system": YES, + "org.freedesktop.udisks2.eject-media-other-seat": YES, + "org.freedesktop.udisks2.power-off-drive-other-seat": YES + }; + if (subject.isInGroup("wheel")) { + return permission[action.id]; + } + });' | tee /etc/polkit-1/rules.d/99-udisks2.rules && + mkdir -p /etc/systemd/journald.conf.d && + echo " + [Journal] + SystemMaxUse=100M" | tee /etc/systemd/journald.conf.d/00-journald.conf && + mkdir -p /etc/systemd/user.conf.d && + echo " + [Manager] + DefaultTimeoutStopSec=5s + DefaultTimeoutAbortSec=5s" | tee /etc/systemd/user.conf.d/00-user.conf && + sed -i 's|^hosts.*|hosts: mymachines mdns_minimal resolve [!UNAVAIL=return] files myhostname dns|g' /etc/nsswitch.conf && + sed -i 's/ interface = [^ ]*/ interface = all/g' /etc/ipp-usb/ipp-usb.conf && + sed -i "/# set linenumbers/"'s/^#//' /etc/nanorc && + echo tcp_bbr | tee /etc/modules-load.d/modules.conf && + echo " + country=${REGDOM} + wps_cred_add_sae=1 + pmf=2" | tee /etc/wpa_supplicant/wpa_supplicant.conf && + bootctl install --graceful && + echo "default arch.conf" > /boot/loader/loader.conf && + echo " + title ${entrname} + linux /vmlinuz-${kernel} + initrd /initramfs-${kernel}.img + options rw ${boot_opts}" | tee /boot/loader/entries/arch.conf && + echo root:${ROOTPASSWD2} | chpasswd && + chsh -s /bin/zsh && + useradd -m -G wheel,realtime -s /bin/zsh ${USERNAME} && + echo ${USERNAME}:${USERPASSWD2} | chpasswd && + echo " + Defaults env_reset + Defaults pwfeedback + Defaults editor=/usr/bin/nano + %wheel ALL=(ALL) ALL" | tee /etc/sudoers.d/sudoedits && + visudo -c /etc/sudoers.d/sudoedits && + systemctl enable avahi-daemon bluetooth cups gdm ipp-usb NetworkManager rngd systemd-boot-update ufw ${trim} ${vm_services} +OPTIMIZED_CONF + + if [[ "${vgaconf}" == "y" && "${vendor}" == "Nvidia" ]]; then + + if [[ "${kernelnmbr}" == "1" ]] || [[ "${kernelnmbr}" == "2" && "${family}" == "1" ]] || [[ "${kernelnmbr}" == "2" && "${family}" == "2" && ${nvdriver} == "2" ]]; then + arch-chroot /mnt <<-NVIDIAHOOK + sed -i "s|#HookDir = /etc/pacman.d/hooks/|HookDir = /etc/pacman.d/hooks/|g" /etc/pacman.conf && + mkdir -p /etc/pacman.d/hooks/ && + echo " + [Trigger] + Operation=Install + Operation=Upgrade + Operation=Remove + Type=Package + Target=${nvname} + Target=${kernel} + + [Action] + Description=Update NVIDIA module in initcpio + Depends=mkinitcpio + When=PostTransaction + NeedsTargets + Exec=/bin/sh -c 'while read -r trg; do case $trg in linux*) exit 0; esac; done; /usr/bin/mkinitcpio -P' " | tee /etc/pacman.d/hooks/nvidia.hook +NVIDIAHOOK + fi + fi + + if [[ "$?" -eq 0 ]]; then + ok + completion + else + err_instl_abort + fi + fi #------------------------------------------------------------------------------------------ # NOTE: Custom System Configuration (Add any extra configuration below): - if [[ "${packages}" == "11" ]]; then + if [[ "${packages}" == "12" ]]; then arch-chroot /mnt <<-CUSTOM_CONF sed -i "/^#${SETLOCALE}/s/^#//" /etc/locale.gen &&