From 05d47511e0e68fe5b0cb031a0510668e026dcc59 Mon Sep 17 00:00:00 2001 From: elementrick Date: Sun, 28 Jul 2024 16:35:23 +0000 Subject: [PATCH] Add: Support for 'Zram Swap' has been added Add: 'Custom Setup' > Add Packages : Added auto-configuration for 'lightdm' if the 'Lightdm GTK/Slick/Deepin Greeter' has been selected Remove: Do not reload the 'Partition Manager' stage after auto-unmounting filesystems and switching to 'Manual Mode' (if formatting or mounting errors have occured) Change: Put code blocks into functions and re-arrange code, for script simplification Change: A few prompts have been edited for aesthetic purposes --- Amelia.sh | 720 ++++++++++++++++++++++++------------------------------ 1 file changed, 319 insertions(+), 401 deletions(-) diff --git a/Amelia.sh b/Amelia.sh index d455eb7..21dc0c6 100644 --- a/Amelia.sh +++ b/Amelia.sh @@ -1,7 +1,7 @@ #!/bin/bash # Amelia Installer -# Version: 6.8 +# Version: 6.9 set -euo pipefail trap 's=$?; echo "$0: Error on line "$LINENO": $BASH_COMMAND"; exit $s' ERR @@ -143,7 +143,7 @@ unmount (){ sleep 0.3 line3 REDBG " ${yellow}------------------------- " - REDBG " ${yellow}[!] Unmount and Retry${redbg} [!] " + REDBG " ${yellow}[!] Unmount and Retry [!] " REDBG " ${yellow}------------------------- " echo reload @@ -257,9 +257,9 @@ arch (){ cnfg (){ sleep 0.3 line3 - YELLOWBG "------------------------------------------------------------------------------------------------- " - YELLOWBG " ### Configuring... ### " - YELLOWBG "------------------------------------------------------------------------------------------------- " + MAGENTABG "------------------------------------------------------------------------------------------------- " + MAGENTABG " ### Configuring... ### " + MAGENTABG "------------------------------------------------------------------------------------------------- " echo sleep 0.3 } @@ -293,13 +293,13 @@ first_check (){ if [[ "${tty}" == *"tty"* && -f /usr/share/kbd/consolefonts/ter-v18b.psf.gz && -f /usr/share/kbd/consolefonts/ter-v32b.psf.gz ]]; then until slct_font; do : ; done elif [[ "${tty}" == *"pts"* && -f /usr/share/kbd/consolefonts/ter-v18b.psf.gz && -f /usr/share/kbd/consolefonts/ter-v32b.psf.gz ]]; then - MAGENTABG " 'Terminus Font' detected. Switch to console (tty) and re-run the installer to activate " + MAGENTABG " 'Terminus Font' detected > Switch to console (tty) and re-run the installer to activate " echo fi if [[ "${run_as}" == "root" ]]; then - REDBGBL " ---------------------------------------- " - REDBGBL " ### The Installer Runs In ROOT Mode ### " - REDBGBL " ---------------------------------------- " + REDBGBL " ${yellow}---------------------------------------- " + REDBGBL " ${yellow}### The Installer Runs In ROOT Mode ### " + REDBGBL " ${yellow}---------------------------------------- " else YELLOWBGBL " ---------------------------------------- " YELLOWBGBL " ### The Installer Runs In DEMO Mode ### " @@ -1099,7 +1099,9 @@ ${magenta}###${nc}-------------------------------------${magenta}[ ${bwhite}Swap [2] Swapfile - [3] None " + [3] Zram Swap + + [4] None " BLUE " @@ -1118,8 +1120,8 @@ Enter a number: " CYAN " [!] Swap type will default to 'None' [!] " - sleep 3 - swapmode="3" + sleep 2 + swapmode="4" skip ok if [[ "${vga_slct}" == "yes" ]]; then @@ -1144,8 +1146,8 @@ Enter a number: " CYAN " [!] Swap type will default to 'None' [!] " - sleep 4 - swapmode="3" + sleep 2 + swapmode="4" skip ok if [[ "${vga_slct}" == "yes" ]]; then @@ -1168,6 +1170,8 @@ Enter a number: " " until set_swapsize; do : ; done ;; 3) + zram="zram-generator" ;; + 4) sleep 0.3 YELLOW " @@ -1668,11 +1672,11 @@ Enter [y/n]: " if [[ "${nvidia_suspend}" == "n" ]]; then skip - elif [[ "${nvidia_suspend}" == "y" && "${swapmode}" == "3" ]]; then + elif [[ "${nvidia_suspend}" == "y" ]] && [[ "${swapmode}" == "3" || "${swapmode}" == "4" ]]; then sleep 0.3 RED " - [!] Incompatible 'No Swap' Setting has been detected " + [!] Incompatible Swap Setting has been detected " CYAN " [!] Nvidia's Video Memory Preserving feature will NOT be enabled [!] " @@ -1998,7 +2002,9 @@ ${magenta}###${nc}--------------------------------${magenta}[ ${bwhite}LightDM G [1] Gtk - [2] Slick " + [2] Slick + + [3] Deepin " BLUE " @@ -2019,6 +2025,12 @@ Enter a number: " NC " ==> [${green}Lightdm Slick Greeter OK${nc}] " ;; + 3) + greeter="lightdm-deepin-greeter" + sleep 0.3 + NC " + +==> [${green}Lightdm Deepin Greeter OK${nc}] " ;; "") sleep 0.3 echo @@ -2418,10 +2430,9 @@ ${magenta}###${nc}---------------------------------${magenta}[ ${bwhite}Automati REDBG " ------------------------------------------------------------ " line2 if [[ -e "${instl_drive}" && "${use_manpreset}" != "yes" ]]; then + sleep 0.3 line2 - YELLOWBG " ------------------------------------------------------- " - YELLOWBG " > Apply 'Smart Partitioning' on disk '${instl_drive}'? [y/n] " - YELLOWBG " ------------------------------------------------------- " + REDBG "${yellow}> Apply 'Smart Partitioning' on disk '${instl_drive}'? [y/n] " echo read -r -p " ==> " smartpart @@ -2467,19 +2478,21 @@ Enter a disk number ${bwhite}(empty to skip)${blue}: " until dsks_submn; do : ; done fi - if [[ -z "${use_manpreset}" ]] ; then - if [[ "${fs}" == "2" && "${swapmode}" == "1" ]]; then - preset="2" - elif [[ "${fs}" == "2" && "${swapmode}" == "2" ]] || [[ "${fs}" == "2" && "${swapmode}" == "3" ]]; then - preset="1" - elif [[ "${fs}" == "1" ]] ; then - if [[ "${sep_home}" == "y" && "${swapmode}" == "1" ]] ; then - preset="4" - elif [[ "${sep_home}" == "y" && "${swapmode}" == "2" ]] || [[ "${sep_home}" == "y" && "${swapmode}" == "3" ]]; then - preset="3" - elif [[ "${sep_home}" == "n" && "${swapmode}" == "1" ]] ; then + if [[ -z "${use_manpreset}" ]]; then + if [[ "${fs}" == "2" ]]; then + if [[ "${swapmode}" == "1" ]]; then preset="2" - elif [[ "${sep_home}" == "n" && "${swapmode}" == "2" ]] || [[ "${sep_home}" == "n" && "${swapmode}" == "3" ]]; then + else + preset="1" + fi + elif [[ "${fs}" == "1" ]] ; then + if [[ "${sep_home}" == "y" && "${swapmode}" == "1" ]]; then + preset="4" + elif [[ "${sep_home}" == "y" && "${swapmode}" != "1" ]]; then + preset="3" + elif [[ "${sep_home}" == "n" && "${swapmode}" == "1" ]]; then + preset="2" + elif [[ "${sep_home}" == "n" && "${swapmode}" != "1" ]]; then preset="1" fi else @@ -3150,6 +3163,7 @@ ${multi_swap} " read -r -p " ==> " partok + echo local prompt="Confirm Disk" local stage_prompt="Partitioning" @@ -3193,6 +3207,7 @@ ${multi_swap} " read -r -p " ==> " partok + echo local prompt="Confirm Disk" local stage_prompt="Partitioning" @@ -3569,7 +3584,6 @@ ${magenta}###${nc}----------------------------------------${magenta}[ ${bwhite}A " else umount_manual - until disk_mngr; do : ; done until form_root; do : ; done until mount_mnt; do : ; done fi @@ -3602,7 +3616,6 @@ ${magenta}###${nc}----------------------------------------${magenta}[ ${bwhite}A " else umount_manual - until disk_mngr; do : ; done until form_root; do : ; done until mount_mnt; do : ; done fi @@ -3617,7 +3630,6 @@ ${magenta}###${nc}----------------------------------------${magenta}[ ${bwhite}A " else umount_manual - until disk_mngr; do : ; done until form_efi; do : ; done until mount_mnt; do : ; done until mount_boot; do : ; done @@ -3654,7 +3666,6 @@ ${magenta}###${nc}----------------------------------------${magenta}[ ${bwhite}A " else umount_manual - until disk_mngr; do : ; done until form_home; do : ; done until mount_mnt; do : ; done until mount_boot; do : ; done @@ -3741,9 +3752,9 @@ Enter a partition number ${bwhite}(empty to skip and proceed)${blue}: " fi fi RED " - - [!] WARNING: PARTITION HAS NOT BEEN FORMATTED [!] - " + ----------------------------------------------------- + ### WARNING: > ${yellow}PARTITION HAS NOT BEEN FORMATTED ${red}< ### + -----------------------------------------------------" sleep 2 skip done @@ -3858,9 +3869,9 @@ Enter a name ${bwhite}(empty to skip and proceed)${blue}: " return 0 else RED " - - [!] WARNING: PARTITION HAS NOT BEEN FORMATTED [!] - " + ----------------------------------------------------- + ### WARNING: > ${yellow}PARTITION HAS NOT BEEN FORMATTED ${red}< ### + -----------------------------------------------------" sleep 2 skip return 0 @@ -3986,6 +3997,10 @@ Enter a name ${bwhite}(empty to skip and proceed)${blue}: " skip return 0 else + RED " + ----------------------------------------------------- + ### WARNING: > ${yellow}PARTITION HAS NOT BEEN FORMATTED ${red}< ### + -----------------------------------------------------" skip return 0 fi @@ -4562,11 +4577,11 @@ ${magenta}###${nc}-------------------------------------${magenta}[ ${bwhite}Pacs fi fi if [[ "${vendor}" == "Virtual Machine" ]]; then - basepkgs="base pkgstats nano sudo vim ${bootldr_pkgs} ${fstools} ${kernel} ${microcode} ${vmpkgs} ${devel}" + basepkgs="base pkgstats nano sudo vim ${bootldr_pkgs} ${fstools} ${kernel} ${microcode} ${vmpkgs} ${devel} ${zram}" elif [[ "${vendor}" == "Nvidia" ]]; then - basepkgs="base linux-firmware pkgstats nano sudo vim ${bootldr_pkgs} ${fstools} ${kernel} ${kernel}-headers ${microcode} ${vgapkgs} ${wireless_reg} ${devel}" + basepkgs="base linux-firmware pkgstats nano sudo vim ${bootldr_pkgs} ${fstools} ${kernel} ${kernel}-headers ${microcode} ${vgapkgs} ${wireless_reg} ${devel} ${zram}" else - basepkgs="base linux-firmware pkgstats nano sudo vim ${bootldr_pkgs} ${fstools} ${kernel} ${microcode} ${vgapkgs} ${wireless_reg} ${devel}" + basepkgs="base linux-firmware pkgstats nano sudo vim ${bootldr_pkgs} ${fstools} ${kernel} ${microcode} ${vgapkgs} ${wireless_reg} ${devel} ${zram}" fi case "${packages}" in @@ -4716,6 +4731,165 @@ ${magenta}###${nc}--------------------------${magenta}[ ${bwhite}Setting Up Wire fi } ################################################################################################### +btldr_conf (){ + + if [[ "${bootloader}" == "1" ]]; then + cnfg + local stage_prompt="Systemd-boot" + if arch-chroot /mnt <<-BOOTCTL > /dev/null 2>&1 ; then + bootctl install || exit + echo "default arch.conf" > /boot/loader/loader.conf || exit + echo " + title ${entrname} + linux /vmlinuz-${kernel} + initrd /initramfs-${kernel}.img + options rw ${boot_opts}" | tee /boot/loader/entries/arch.conf || exit + systemctl enable systemd-boot-update || exit +BOOTCTL + stage_ok + else + stage_fail + fi + elif [[ "${bootloader}" == "2" ]]; then + cnfg + local stage_prompt="Grub" + if arch-chroot /mnt <<-GRUB > /dev/null 2>&1 ; then + grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB || exit + sed -i \ + -e 's|^GRUB_CMDLINE_LINUX_DEFAULT.*|GRUB_CMDLINE_LINUX_DEFAULT="${boot_opts}"|g' \ + -e "/^#GRUB_DISABLE_OS_PROBER=false/s/^#//" \ + /etc/default/grub || exit + grub-mkconfig -o /boot/grub/grub.cfg || exit +GRUB + stage_ok + else + stage_fail + fi + if [[ "${fs}" == "2" ]]; then + cnfg + local stage_prompt="Grub-Btrfsd" + if arch-chroot /mnt <<-GRUB_BTRFSD > /dev/null 2>&1 ; then + systemctl enable grub-btrfsd || exit +GRUB_BTRFSD + stage_ok + else + stage_fail + fi + fi + if [[ "${vgaconf}" == "y" && "${vendor}" == "Nvidia" ]]; then + cnfg + local stage_prompt="Grub-Nvidia" + if arch-chroot /mnt <<-NVIDIA_GRUB > /dev/null 2>&1 ; then + sed -i "/^#GRUB_TERMINAL_OUTPUT=console/s/^#//" /etc/default/grub || exit + grub-mkconfig -o /boot/grub/grub.cfg || exit +NVIDIA_GRUB + stage_ok + else + stage_fail + fi + fi + fi +} +################################################################################################### +trim_conf (){ + + if [[ -n "${trim}" ]]; then + cnfg + local stage_prompt="Trim Service" + if arch-chroot /mnt <<-TRIM > /dev/null 2>&1 ; then + systemctl enable ${trim} || exit +TRIM + stage_ok + else + stage_fail + fi + fi +} +################################################################################################### +vm_serv_conf (){ + + if [[ -n "${vm_services}" ]]; then + cnfg + local stage_prompt="VM Service(s)" + if arch-chroot /mnt <<-VM > /dev/null 2>&1 ; then + systemctl enable ${vm_services} || exit +VM + stage_ok + else + stage_fail + fi + fi +} +################################################################################################### +nvidia_serv_conf (){ + + if [[ -n "${nvidia_services}" ]]; then + cnfg + local stage_prompt="Nvidia Services" + if arch-chroot /mnt <<-NVIDIA_SERV > /dev/null 2>&1 ; then + systemctl enable ${nvidia_services} || exit +NVIDIA_SERV + stage_ok + else + stage_fail + fi + fi +} +################################################################################################### +zram_conf (){ + + if [[ -n "${zram}" ]]; then + cnfg + local stage_prompt="Zram Swap" + zram_service="systemd-zram-setup@zram0.service" + if arch-chroot /mnt <<-ZRAM > /dev/null 2>&1 ; then + mkdir -p /etc/systemd/zram-generator.conf.d + echo " + [zram0] + zram-size = ram / 2 + compression-algorithm = zstd" | tee /etc/systemd/zram-generator.conf.d/zram.conf || exit + systemctl daemon-reload || exit + systemctl start ${zram_service} || exit +ZRAM + stage_ok + else + stage_fail + fi + fi +} +################################################################################################### +nvidia_hook_conf (){ + + if [[ "${vgaconf}" == "y" && "${vendor}" == "Nvidia" ]]; then + if [[ "${kernelnmbr}" == "1" ]] || [[ "${kernelnmbr}" == "2" && "${family}" == "1" ]] || [[ "${kernelnmbr}" == "2" && "${family}" == "2" && "${nvdriver}" == "2" ]]; then + cnfg + local stage_prompt="Nvidia-Hook" + if arch-chroot /mnt <<-NVIDIA_HOOK > /dev/null 2>&1 ; then + mkdir -p /etc/pacman.d/hooks/ || exit + 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 || exit +NVIDIA_HOOK + stage_ok + else + stage_fail + fi + fi + fi +} +################################################################################################### chroot_conf (){ sleep 0.3 @@ -4726,7 +4900,7 @@ ${magenta}###${nc}--------------------------------${magenta}[ ${bwhite}Chroot & " # Linux-Hardened = No Swap if [[ "${kernelnmbr}" == "3" ]]; then - swapmode="3" + swapmode="4" fi #### Encrypted Setup Vars @@ -4756,8 +4930,11 @@ ${magenta}###${nc}--------------------------------${magenta}[ ${bwhite}Chroot & fi # Encrypted Swapfile Kernel Boot Options encr_swap_bootopts="resume=${encr_root_dev} resume_offset=${offst} " - ## No Swap + ## Zram Swap elif [[ "${swapmode}" == "3" ]]; then + zram_bootopts="zswap.enabled=0" + ## No Swap + elif [[ "${swapmode}" == "4" ]]; then # No Swap Kernel Boot Options encr_swap_bootopts="" fi @@ -4829,11 +5006,15 @@ ${magenta}###${nc}--------------------------------${magenta}[ ${bwhite}Chroot & fi fi ### Kernel Boot Options (Encryption) - boot_opts="${encr_root_bootopts}${encr_swap_bootopts}${vga_bootopts}${cust_bootopts}${btrfs_bootopts}" + boot_opts="${encr_root_bootopts}${encr_swap_bootopts}${vga_bootopts}${cust_bootopts}${btrfs_bootopts}${zram_bootopts}" #------------------------------------------------------------------------------------------------------------- #### Unencrypted Setup Vars elif [[ "${encrypt}" == "no" ]]; then + ### Swap Setup + if [[ "${swapmode}" == "3" ]]; then + zram_bootopts="zswap.enabled=0" + fi ### Graphics Setup ## Configuration = 'Yes' if [[ "${vgaconf}" == "y" ]]; then @@ -4903,16 +5084,15 @@ ${magenta}###${nc}--------------------------------${magenta}[ ${bwhite}Chroot & if [[ "${autoroot}" == "y" ]]; then ### Kernel Boot Options [Multi-Root Disk] (No Encryption) - boot_opts="${multiroot_opts}${vga_bootopts}${cust_bootopts}${btrfs_bootopts}" + boot_opts="${multiroot_opts}${vga_bootopts}${cust_bootopts}${btrfs_bootopts}${zram_bootopts}" else ### Kernel Boot Options [Single Root Disk] (No Encryption) - boot_opts="${vga_bootopts}${cust_bootopts}${btrfs_bootopts}" + boot_opts="${vga_bootopts}${cust_bootopts}${btrfs_bootopts}${zram_bootopts}" fi fi #-------------------------------------------------------------------------------------------------- - # NOTE: All Vanilla Desktops Basic Configuration: - + # 'VANILLA Desktops' Configuration: if [[ "${packages}" =~ ^(1|3|5|6|7|8|9|10|11)$ ]]; then cnfg stage_prompt="Basic System" @@ -4943,7 +5123,6 @@ VANILLA_CONF else stage_fail fi - if [[ -f /mnt/etc/lightdm/lightdm.conf ]]; then cnfg if [[ "${packages}" == "7" ]]; then @@ -4975,66 +5154,6 @@ SLICK fi fi fi - - if [[ "${bootloader}" == "1" ]]; then - cnfg - stage_prompt="Systemd-boot" - if arch-chroot /mnt <<-BOOTCTL > /dev/null 2>&1 ; then - bootctl install || exit - echo "default arch.conf" > /boot/loader/loader.conf || exit - echo " - title ${entrname} - linux /vmlinuz-${kernel} - initrd /initramfs-${kernel}.img - options rw ${boot_opts}" | tee /boot/loader/entries/arch.conf || exit - systemctl enable systemd-boot-update || exit -BOOTCTL - stage_ok - else - stage_fail - fi - elif [[ "${bootloader}" == "2" ]]; then - cnfg - stage_prompt="Grub" - if arch-chroot /mnt <<-GRUB > /dev/null 2>&1 ; then - grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB || exit - sed -i \ - -e 's|^GRUB_CMDLINE_LINUX_DEFAULT.*|GRUB_CMDLINE_LINUX_DEFAULT="${boot_opts}"|g' \ - -e "/^#GRUB_DISABLE_OS_PROBER=false/s/^#//" \ - /etc/default/grub || exit - grub-mkconfig -o /boot/grub/grub.cfg || exit -GRUB - stage_ok - else - stage_fail - fi - - if [[ "${fs}" == "2" ]]; then - cnfg - stage_prompt="Grub-Btrfsd" - if arch-chroot /mnt <<-GRUB_BTRFSD > /dev/null 2>&1 ; then - systemctl enable grub-btrfsd || exit -GRUB_BTRFSD - stage_ok - else - stage_fail - fi - fi - - if [[ "${vgaconf}" == "y" && "${vendor}" == "Nvidia" ]]; then - cnfg - stage_prompt="Grub-Nvidia" - if arch-chroot /mnt <<-NVIDIA_GRUB > /dev/null 2>&1 ; then - sed -i "/^#GRUB_TERMINAL_OUTPUT=console/s/^#//" /etc/default/grub || exit - grub-mkconfig -o /boot/grub/grub.cfg || exit -NVIDIA_GRUB - stage_ok - else - stage_fail - fi - fi - fi - if [[ -n "${bluetooth}" ]]; then cnfg stage_prompt="Bluetooth Service" @@ -5046,7 +5165,6 @@ BLUETOOTH stage_fail fi fi - if [[ -n "${displaymanager}" ]]; then cnfg stage_prompt="Display Manager Service" @@ -5058,7 +5176,6 @@ DM_SERVICE stage_fail fi fi - if [[ -n "${network}" ]]; then cnfg stage_prompt="Network Manager Service" @@ -5070,91 +5187,111 @@ NETWORK stage_fail fi fi - if [[ -n "${trim}" ]]; then + btldr_conf + trim_conf + vm_serv_conf + nvidia_serv_conf + zram_conf + nvidia_hook_conf + completion + fi +#-------------------------------------------------------------------------------------------------- + # 'Custom System' Configuration (Add any extra configuration below): + if [[ "${packages}" == "12" ]]; then + cnfg + stage_prompt="Basic System" + if arch-chroot /mnt <<-CUSTOM_CONF > /dev/null 2>&1 ; then + sed -i "/^#${SETLOCALE}/s/^#//" /etc/locale.gen || exit + locale-gen || exit + echo LANG=${SETLOCALE} > /etc/locale.conf || exit + export LANG=${SETLOCALE} || exit + echo KEYMAP=${SETKBD} > /etc/vconsole.conf || exit + echo " + ${mkinitcpio_mods} + ${mkinitcpio_hooks}" | tee /etc/mkinitcpio.conf.d/mkinitcpiod.conf || exit + mkinitcpio -P || exit + ln -sf /usr/share/zoneinfo/$(curl -s http://ip-api.com/line?fields=timezone) /etc/localtime || exit + hwclock --systohc || exit + echo ${HOSTNAME} > /etc/hostname || exit + echo " + 127.0.0.1 localhost + ::1 localhost + 127.0.1.1 ${HOSTNAME}.localdomain ${HOSTNAME}" >> /etc/hosts || exit + echo root:${ROOTPASSWD2} | chpasswd || exit + useradd -m -G wheel -s /bin/bash ${USERNAME} || exit + echo ${USERNAME}:${USERPASSWD2} | chpasswd || exit + echo "%wheel ALL=(ALL) ALL" | tee /etc/sudoers.d/sudoersd || exit + visudo -c /etc/sudoers.d/sudoersd || exit +CUSTOM_CONF + stage_ok + else + stage_fail + fi + if [[ -f /mnt/etc/lightdm/lightdm.conf ]]; then cnfg - stage_prompt="Trim Service" - if arch-chroot /mnt <<-TRIM > /dev/null 2>&1 ; then - systemctl enable ${trim} || exit -TRIM - stage_ok - else - stage_fail - fi - fi - - if [[ -n "${vm_services}" ]]; then - cnfg - stage_prompt="VM Service(s)" - if arch-chroot /mnt <<-VM > /dev/null 2>&1 ; then - systemctl enable ${vm_services} || exit -VM - stage_ok - else - stage_fail - fi - fi - - if [[ -n "${nvidia_services}" ]]; then - cnfg - stage_prompt="Nvidia Services" - if arch-chroot /mnt <<-NVIDIA_SERV > /dev/null 2>&1 ; then - systemctl enable ${nvidia_services} || exit -NVIDIA_SERV - stage_ok - else - stage_fail - fi - fi - - if [[ "${vgaconf}" == "y" && "${vendor}" == "Nvidia" ]]; then - if [[ "${kernelnmbr}" == "1" ]] || [[ "${kernelnmbr}" == "2" && "${family}" == "1" ]] || [[ "${kernelnmbr}" == "2" && "${family}" == "2" && "${nvdriver}" == "2" ]]; then - cnfg - stage_prompt="Nvidia-Hook" - if arch-chroot /mnt <<-NVIDIA_HOOK > /dev/null 2>&1 ; then - mkdir -p /etc/pacman.d/hooks/ || exit - 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 || exit -NVIDIA_HOOK + if [[ "${greeternmbr}" == "1" ]]; then + stage_prompt="GTK Greeter" + 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 +GTK + stage_ok + else + stage_fail + fi + elif [[ "${greeternmbr}" == "2" ]]; then + stage_prompt="Slick Greeter" + if arch-chroot /mnt <<-SLICK > /dev/null 2>&1 ; then + sed -i 's|^#greeter-session=example-gtk-gnome|greeter-session=lightdm-slick-greeter|g' /etc/lightdm/lightdm.conf || exit +SLICK + stage_ok + else + stage_fail + fi + elif [[ "${greeternmbr}" == "3" ]]; then + stage_prompt="Deepin Greeter" + if arch-chroot /mnt <<-DEEPIN > /dev/null 2>&1 ; then + sed -i 's|^#greeter-session=example-gtk-gnome|greeter-session=lightdm-deepin-greeter|g' /etc/lightdm/lightdm.conf || exit +DEEPIN stage_ok else stage_fail fi fi fi + if [[ -n "${customservices}" ]]; then + cnfg + stage_prompt="Custom Service(s)" + if arch-chroot /mnt <<-CUSTOM_SERV > /dev/null 2>&1 ; then + systemctl enable ${customservices} || exit +CUSTOM_SERV + stage_ok + else + stage_fail + fi + fi + btldr_conf + trim_conf + vm_serv_conf + nvidia_serv_conf + zram_conf + nvidia_hook_conf completion fi #-------------------------------------------------------------------------------------------------- # NOTE: Plasma / Gnome & Systemd-boot Optimized-System Configuration: - - if [[ "${packages}" == "2" ]] || [[ "${packages}" == "4" ]]; then + if [[ "${packages}" == "2" || "${packages}" == "4" ]]; then stage_prompt="Custom System" cnfg - if [[ "${packages}" == "2" ]]; then displaymanager="sddm" elif [[ "${packages}" == "4" ]]; then displaymanager="gdm" fi - if [[ -n "${nrg_plc}" ]]; then arch-chroot /mnt <<-NRG > /dev/null 2>&1 ${nrg_plc} performance NRG fi - if arch-chroot /mnt <<-OPTIMIZED_CONF > /dev/null 2>&1 ; then sed -i "/^#${SETLOCALE}/s/^#//" /etc/locale.gen || exit locale-gen || exit @@ -5292,229 +5429,8 @@ OPTIMIZED_CONF else stage_fail fi - - if [[ "${vgaconf}" == "y" && "${vendor}" == "Nvidia" ]]; then - if [[ "${kernelnmbr}" == "1" ]] || [[ "${kernelnmbr}" == "2" && "${family}" == "1" ]] || [[ "${kernelnmbr}" == "2" && "${family}" == "2" && "${nvdriver}" == "2" ]]; then - cnfg - stage_prompt="Nvidia-Hook" - if arch-chroot /mnt <<-NVIDIAHOOK > /dev/null 2>&1 ; then - mkdir -p /etc/pacman.d/hooks/ || exit - 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 || exit -NVIDIAHOOK - stage_ok - else - stage_fail - fi - fi - fi - completion - fi -#-------------------------------------------------------------------------------------------------- - # NOTE: Custom System Configuration (Add any extra configuration below): - - if [[ "${packages}" == "12" ]]; then - cnfg - stage_prompt="Basic System" - if arch-chroot /mnt <<-CUSTOM_CONF > /dev/null 2>&1 ; then - sed -i "/^#${SETLOCALE}/s/^#//" /etc/locale.gen || exit - locale-gen || exit - echo LANG=${SETLOCALE} > /etc/locale.conf || exit - export LANG=${SETLOCALE} || exit - echo KEYMAP=${SETKBD} > /etc/vconsole.conf || exit - echo " - ${mkinitcpio_mods} - ${mkinitcpio_hooks}" | tee /etc/mkinitcpio.conf.d/mkinitcpiod.conf || exit - mkinitcpio -P || exit - ln -sf /usr/share/zoneinfo/$(curl -s http://ip-api.com/line?fields=timezone) /etc/localtime || exit - hwclock --systohc || exit - echo ${HOSTNAME} > /etc/hostname || exit - echo " - 127.0.0.1 localhost - ::1 localhost - 127.0.1.1 ${HOSTNAME}.localdomain ${HOSTNAME}" >> /etc/hosts || exit - echo root:${ROOTPASSWD2} | chpasswd || exit - useradd -m -G wheel -s /bin/bash ${USERNAME} || exit - echo ${USERNAME}:${USERPASSWD2} | chpasswd || exit - echo "%wheel ALL=(ALL) ALL" | tee /etc/sudoers.d/sudoersd || exit - visudo -c /etc/sudoers.d/sudoersd || exit -CUSTOM_CONF - stage_ok - else - stage_fail - fi - - if [[ -f /mnt/etc/lightdm/lightdm.conf ]]; then - cnfg - if [[ "${greeternmbr}" == "1" ]]; then - stage_prompt="GTK Greeter" - 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 -GTK - stage_ok - else - stage_fail - fi - elif [[ "${greeternmbr}" == "2" ]]; then - stage_prompt="Slick Greeter" - if arch-chroot /mnt <<-SLICK > /dev/null 2>&1 ; then - sed -i 's|^#greeter-session=example-gtk-gnome|greeter-session=lightdm-slick-greeter|g' /etc/lightdm/lightdm.conf || exit -SLICK - stage_ok - else - stage_fail - fi - fi - fi - - if [[ "${bootloader}" == "1" ]]; then - cnfg - stage_prompt="Systemd-boot" - if arch-chroot /mnt <<-BOOTCTL > /dev/null 2>&1 ; then - bootctl install || exit - echo "default arch.conf" > /boot/loader/loader.conf || exit - echo " - title ${entrname} - linux /vmlinuz-${kernel} - initrd /initramfs-${kernel}.img - options rw ${boot_opts}" | tee /boot/loader/entries/arch.conf || exit - systemctl enable systemd-boot-update || exit -BOOTCTL - stage_ok - else - stage_fail - fi - elif [[ "${bootloader}" == "2" ]]; then - cnfg - stage_prompt="Grub" - if arch-chroot /mnt <<-GRUB > /dev/null 2>&1 ; then - grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB || exit - sed -i \ - -e 's|^GRUB_CMDLINE_LINUX_DEFAULT.*|GRUB_CMDLINE_LINUX_DEFAULT="${boot_opts}"|g' \ - -e "/^#GRUB_DISABLE_OS_PROBER=false/s/^#//" \ - /etc/default/grub || exit - grub-mkconfig -o /boot/grub/grub.cfg || exit -GRUB - stage_ok - else - stage_fail - fi - - if [[ "${fs}" == "2" ]]; then - cnfg - stage_prompt="Grub-Btrfsd" - if arch-chroot /mnt <<-GRUB_BTRFSD > /dev/null 2>&1 ; then - systemctl enable grub-btrfsd || exit -GRUB_BTRFSD - stage_ok - else - stage_fail - fi - fi - - if [[ "${vgaconf}" == "y" && "${vendor}" == "Nvidia" ]]; then - cnfg - stage_prompt="Grub-Nvidia" - if arch-chroot /mnt <<-NVIDIA_GRUB > /dev/null 2>&1 ; then - sed -i "/^#GRUB_TERMINAL_OUTPUT=console/s/^#//" /etc/default/grub || exit - grub-mkconfig -o /boot/grub/grub.cfg || exit -NVIDIA_GRUB - stage_ok - else - stage_fail - fi - fi - fi - - if [[ -n "${customservices}" ]]; then - cnfg - stage_prompt="Custom Service(s)" - if arch-chroot /mnt <<-CUSTOM_SERV > /dev/null 2>&1 ; then - systemctl enable ${customservices} || exit -CUSTOM_SERV - stage_ok - else - stage_fail - fi - fi - - if [[ -n "${trim}" ]]; then - cnfg - stage_prompt="Trim Service" - if arch-chroot /mnt <<-TRIM > /dev/null 2>&1 ; then - systemctl enable ${trim} || exit -TRIM - stage_ok - else - stage_fail - fi - fi - - if [[ -n "${vm_services}" ]]; then - cnfg - stage_prompt="VM Service(s)" - if arch-chroot /mnt <<-VM > /dev/null 2>&1 ; then - systemctl enable ${vm_services} || exit -VM - stage_ok - else - stage_fail - fi - fi - - if [[ -n "${nvidia_services}" ]]; then - cnfg - stage_prompt="Nvidia Services" - if arch-chroot /mnt <<-NVIDIA_SERV > /dev/null 2>&1 ; then - systemctl enable ${nvidia_services} || exit -NVIDIA_SERV - stage_ok - else - stage_fail - fi - fi - - if [[ "${vgaconf}" == "y" && "${vendor}" == "Nvidia" ]]; then - if [[ "${kernelnmbr}" == "1" ]] || [[ "${kernelnmbr}" == "2" && "${family}" == "1" ]] || [[ "${kernelnmbr}" == "2" && "${family}" == "2" && "${nvdriver}" == "2" ]]; then - cnfg - stage_prompt="Nvidia-Hook" - if arch-chroot /mnt <<-NVIDIA_HOOK > /dev/null 2>&1 ; then - mkdir -p /etc/pacman.d/hooks/ || exit - 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 || exit -NVIDIA_HOOK - stage_ok - else - stage_fail - fi - fi - fi + zram_conf + nvidia_hook_conf completion fi umount -R /mnt @@ -5594,7 +5510,9 @@ NVIDIA_HOOK autopart="" prcnt="" roottype="" - stage_prompt='' + stage_prompt="" + zram="" + zram_bootopts="" clear first_check