diff --git a/Amelia.sh b/Amelia.sh index 7eb6af6..06259dc 100644 --- a/Amelia.sh +++ b/Amelia.sh @@ -1,7 +1,7 @@ #!/bin/bash # Amelia Installer -# Version: 4.4 +# Version: 4.5 set -euo pipefail trap 's=$?; echo "$0: Error on line "$LINENO": $BASH_COMMAND"; exit $s' ERR @@ -187,20 +187,6 @@ err_reload (){ reload } #---------------------------------------------------------- -err_instl_abort (){ - sleep 0.5 - RED " - - [!] Warning: Installation errored - - - - [!] Exiting.. - - " - exit -} -#---------------------------------------------------------- choice (){ sleep 0.5 RED " @@ -215,6 +201,23 @@ ok (){ ==> [${green}${prompt} OK${nc}] " } #---------------------------------------------------------- +stage_ok (){ + sleep 0.5 + NC " + +==> [${green}${stage_prompt} configuration OK${nc}] " + sleep 3 +} +#---------------------------------------------------------- +stage_fail (){ + sleep 0.5 + RED " + + [!] ${stage_prompt} configuration failed " + sleep 4 + abort +} +#---------------------------------------------------------- completion (){ sleep 0.5 CYAN " @@ -492,7 +495,7 @@ ${purple}###${nc} Locale Selection ${purple}###${nc} " YELLOW " - > Select your Locale + > Select your Locale (e.g. ${nc}en_US.UTF-8${yellow}) ### [Hit ${nc}'l'${yellow} to list locales, then ${nc}'down'${yellow} to search or ${nc}'q'${yellow} to quit] " @@ -500,22 +503,22 @@ ${purple}###${nc} Locale Selection ${purple}###${nc} -Enter your Locale ${bwhite}(empty for 'en_US.UTF-8 UTF-8')${blue}: " +Enter your Locale ${bwhite}(empty for 'en_US.UTF-8')${blue}: " read -r -p " ==> " SETLOCALE if [[ -z "${SETLOCALE}" ]]; then - SETLOCALE="en_US.UTF-8 UTF-8" + SETLOCALE="en_US.UTF-8" sleep 0.5 YELLOW " - ### 'en_US.UTF-8 UTF-8' Locale has been selected + ### 'en_US.UTF-8' Locale has been selected " elif [[ "${SETLOCALE}" == "l" ]]; then more /usr/share/i18n/SUPPORTED return 1 - elif ! grep -Fxq "${SETLOCALE}" /usr/share/i18n/SUPPORTED; then + elif ! grep -q "^#\?$(sed 's/[].*[]/\\&/g' <<< "${SETLOCALE}") " /usr/share/i18n/SUPPORTED; then invalid return 1 @@ -3882,19 +3885,13 @@ ___________________________ ${purple}###${nc} Swapfile Activation ${purple}###${nc} " - arch-chroot /mnt <<-SWAP - dd if=/dev/zero of=/swapfile bs=1M count=${swapsize}k status=progress && - chmod 0600 /swapfile && - mkswap -U clear /swapfile && - swapon /swapfile + if arch-chroot /mnt <<-SWAP ; then + mkswap -U clear --size ${swapsize}G --file /swapfile SWAP - - if swapon /swapfile; then - - if cat >> /mnt/etc/fstab <<-FSTAB ; then - /swapfile none swap defaults 0 0 + if cat >> /mnt/etc/fstab <<-FSTAB ; then + /swapfile none swap defaults 0 0 FSTAB - ok + ok else sleep 0.5 RED " @@ -3915,26 +3912,21 @@ _________________________________ ${purple}###${nc} Btrfs Swapfile Activation ${purple}###${nc} " - arch-chroot /mnt <<-SWAP - btrfs filesystem mkswapfile --size ${swapsize}g --uuid clear /swap/swapfile && - swapon /swap/swapfile + if arch-chroot /mnt <<-SWAP ; then + btrfs filesystem mkswapfile --size ${swapsize}g --uuid clear /swap/swapfile SWAP - - if swapon /swap/swapfile; then - - if cat >> /mnt/etc/fstab <<-FSTAB ; then - /swap/swapfile none swap defaults 0 0 + if cat >> /mnt/etc/fstab <<-FSTAB ; then + /swap/swapfile none swap defaults 0 0 FSTAB - ok - else - sleep 0.5 - RED " + ok + else + sleep 0.5 + RED " [!] Populating the 'fstab' file has failed " - abort - fi - + abort + fi else - err_swapfile + err_swapfile fi } ########################################################################################### @@ -4075,71 +4067,292 @@ ${purple}###${nc} Chroot & Configure System ${purple}###${nc} # 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 - - sed -i "/^#${SETLOCALE}/s/^#//" /etc/locale.gen && - locale-gen && - echo LANG=${SETLOCALE} > /etc/locale.conf && - export LANG=${SETLOCALE} && - echo KEYMAP=${SETKBD} > /etc/vconsole.conf && - echo " - ${mkinitcpio_mods} - ${mkinitcpio_hooks}" | tee /etc/mkinitcpio.conf.d/mkinitcpiod.conf && - mkinitcpio -P && - 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 root:${ROOTPASSWD2} | chpasswd && - useradd -m -G wheel -s /bin/bash ${USERNAME} && - echo ${USERNAME}:${USERPASSWD2} | chpasswd && - echo " - %wheel ALL=(ALL) ALL" | tee /etc/sudoers.d/sudoersd && - visudo -c /etc/sudoers.d/sudoersd + sed -i "/^#${SETLOCALE}/s/^#//" /etc/locale.gen && + locale-gen && + echo LANG=${SETLOCALE} > /etc/locale.conf && + export LANG=${SETLOCALE} && + echo KEYMAP=${SETKBD} > /etc/vconsole.conf && + echo " + ${mkinitcpio_mods} + ${mkinitcpio_hooks}" | tee /etc/mkinitcpio.conf.d/mkinitcpiod.conf && + mkinitcpio -P && + 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 root:${ROOTPASSWD2} | chpasswd && + useradd -m -G wheel -s /bin/bash ${USERNAME} && + echo ${USERNAME}:${USERPASSWD2} | chpasswd && + echo " + %wheel ALL=(ALL) ALL" | tee /etc/sudoers.d/sudoersd && + visudo -c /etc/sudoers.d/sudoersd VANILLA_CONF - stage_1="success" + stage_ok else - stage_1="fail" + stage_fail fi if [[ -f /mnt/etc/lightdm/lightdm.conf ]]; then - - if [[ "${packages}" == "7" ]]; then + if [[ "${packages}" == "7" ]]; then + stage_prompt="Deepin Greeter" if arch-chroot /mnt <<-DEEPIN ; then - sed -i 's|^#greeter-session=example-gtk-gnome|greeter-session=lightdm-deepin-greeter|g' /etc/lightdm/lightdm.conf + sed -i 's|^#greeter-session=example-gtk-gnome|greeter-session=lightdm-deepin-greeter|g' /etc/lightdm/lightdm.conf DEEPIN - stage_2="success" + stage_ok else - stage_2="fail" + stage_fail fi - elif [[ "${packages}" == "8" ]]; then + stage_prompt="GTK Greeter" if arch-chroot /mnt <<-GTK ; then - sed -i 's|^#greeter-session=example-gtk-gnome|greeter-session=lightdm-gtk-greeter|g' /etc/lightdm/lightdm.conf + sed -i 's|^#greeter-session=example-gtk-gnome|greeter-session=lightdm-gtk-greeter|g' /etc/lightdm/lightdm.conf GTK - stage_2="success" + stage_ok else - stage_2="fail" + stage_fail fi - else + stage_prompt="Slick Greeter" if arch-chroot /mnt <<-SLICK ; then - sed -i 's|^#greeter-session=example-gtk-gnome|greeter-session=lightdm-slick-greeter|g' /etc/lightdm/lightdm.conf + sed -i 's|^#greeter-session=example-gtk-gnome|greeter-session=lightdm-slick-greeter|g' /etc/lightdm/lightdm.conf SLICK - stage_2="success" + stage_ok else - stage_2="fail" + stage_fail fi fi fi if [[ "${bootloader}" == "1" ]]; then - + stage_prompt="Systemd-boot" if arch-chroot /mnt <<-BOOTCTL ; then + 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 && + systemctl enable systemd-boot-update ${bluetooth} ${displaymanager} ${network} ${trim} ${vm_services} +BOOTCTL + stage_ok + else + stage_fail + fi + elif [[ "${bootloader}" == "2" ]]; then + stage_prompt="Grub" + if arch-chroot /mnt <<-GRUB ; then + grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB && + 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 && + grub-mkconfig -o /boot/grub/grub.cfg && + systemctl enable ${bluetooth} ${displaymanager} ${network} ${trim} ${vm_services} +GRUB + stage_ok + else + stage_fail + fi + + if [[ "${bootloader}" == "2" && "${fs}" == "2" ]]; then + stage_prompt="Grub-Btrfsd" + if arch-chroot /mnt <<-GRUBBTRFSD ; then + systemctl enable grub-btrfsd +GRUBBTRFSD + stage_ok + else + stage_fail + fi + fi + + if [[ "${vgaconf}" == "y" && "${vendor}" == "Nvidia" ]]; then + stage_prompt="Grub-Nvidia" + if arch-chroot /mnt <<-NVIDIAGRUB ; then + sed -i "/^#GRUB_TERMINAL_OUTPUT=console/s/^#//" /etc/default/grub && + grub-mkconfig -o /boot/grub/grub.cfg +NVIDIAGRUB + stage_ok + else + stage_fail + fi + fi + fi + + if [[ "${vgaconf}" == "y" && "${vendor}" == "Nvidia" ]]; then + if [[ "${kernelnmbr}" == "1" ]] || [[ "${kernelnmbr}" == "2" && "${family}" == "1" ]] || [[ "${kernelnmbr}" == "2" && "${family}" == "2" && "${nvdriver}" == "2" ]]; then + stage_prompt="Nvidia-Hook" + if arch-chroot /mnt <<-NVIDIAHOOK ; then + 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 + stage_ok + else + stage_fail + fi + fi + fi + ok + completion + fi + +#------------------------------------------------------------------------------------------ + + # NOTE: Plasma / Gnome & Systemd-boot Optimized System Configuration: + + if [[ "${packages}" == "2" ]] || [[ "${packages}" == "4" ]]; then + stage_prompt="Main System" + + if [[ "${packages}" == "2" ]]; then + displaymanager="sddm" + elif [[ "${packages}" == "4" ]]; then + displaymanager="gdm" + fi + + if [[ -n "${nrg_plc}" ]]; then + arch-chroot /mnt <<-NRG + ${nrg_plc} performance +NRG + fi + + if arch-chroot /mnt <<-OPTIMIZED_CONF ; then + 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="zstd" + COMPRESSION_OPTIONS=(-c -T$(nproc) --auto-threads=logical -) + MODULES_DECOMPRESS="yes"' | tee /etc/mkinitcpio.conf.d/mkinitcpiod.conf && + mkinitcpio -P && + echo ' + CFLAGS="-march=native -O2 -pipe -fno-plt -fexceptions \ + -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security \ + -fstack-clash-protection -fcf-protection \ + -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer" + LDFLAGS="-Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now \ + -Wl,-z,pack-relative-relocs,-fuse-ld=mold" + RUSTFLAGS="-C force-frame-pointers=yes -C opt-level=3 -C target-cpu=native -C link-arg=-fuse-ld=mold" + MAKEFLAGS="-j$(nproc)" + BUILDENV=(!distcc color ccache check !sign) + OPTIONS=(strip docs !libtool !staticlibs emptydirs zipman purge !debug lto) + COMPRESSGZ=(pigz -c -f -n) + COMPRESSBZ2=(pbzip2 -c -f) + COMPRESSZST=(zstd -c -T0 --ultra -20 --auto-threads=logical -)' | tee /etc/makepkg.conf.d/makepkgd.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-sysctld.conf && + echo " + [defaults] + ntfs:ntfs3_defaults=uid=1000,gid=1000,windows_names" | 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-userd.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/modulesd.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 " @@ -4147,631 +4360,206 @@ SLICK linux /vmlinuz-${kernel} initrd /initramfs-${kernel}.img options rw ${boot_opts}" | tee /boot/loader/entries/arch.conf && - systemctl enable systemd-boot-update ${bluetooth} ${displaymanager} ${network} ${trim} ${vm_services} -BOOTCTL - stage_3="success" - else - stage_3="fail" - fi - - elif [[ "${bootloader}" == "2" ]]; then - - if arch-chroot /mnt <<-GRUB ; then - grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB && - 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 && - grub-mkconfig -o /boot/grub/grub.cfg && - systemctl enable ${bluetooth} ${displaymanager} ${network} ${trim} ${vm_services} -GRUB - stage_3="success" - else - stage_3="fail" - fi - - if [[ "${bootloader}" == "2" && "${fs}" == "2" ]]; then - if arch-chroot /mnt <<-GRUBBTRFSD ; then - systemctl enable grub-btrfsd -GRUBBTRFSD - stage_4="success" - else - stage_4="fail" - fi - fi - - if [[ "${vgaconf}" == "y" && "${vendor}" == "Nvidia" ]]; then - if arch-chroot /mnt <<-NVIDIAGRUB ; then - sed -i "/^#GRUB_TERMINAL_OUTPUT=console/s/^#//" /etc/default/grub && - grub-mkconfig -o /boot/grub/grub.cfg -NVIDIAGRUB - stage_5="success" - else - stage_5="fail" - fi - fi - fi - - if [[ "${vgaconf}" == "y" && "${vendor}" == "Nvidia" ]]; then - - if [[ "${kernelnmbr}" == "1" ]] || [[ "${kernelnmbr}" == "2" && "${family}" == "1" ]] || [[ "${kernelnmbr}" == "2" && "${family}" == "2" && "${nvdriver}" == "2" ]]; then - - if arch-chroot /mnt <<-NVIDIAHOOK ; then - 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 - stage_6="success" - else - stage_6="fail" - fi - fi - fi - - if [[ "${stage_1}" == "fail" ]] || [[ "${stage_2}" == "fail" ]] || [[ "${stage_3}" == "fail" ]] || [[ "${stage_4}" == "fail" ]] || [[ "${stage_5}" == "fail" ]] || [[ "${stage_6}" == "fail" ]]; then - err_instl_abort - else - ok - completion - fi - fi - -#------------------------------------------------------------------------------------------ - - # NOTE: Plasma & Systemd-boot Optimized System Configuration: - - if [[ "${packages}" == "2" ]]; then - - if [[ -n "${nrg_plc}" ]]; then - arch-chroot /mnt <<-NRG - ${nrg_plc} performance -NRG - fi - - if arch-chroot /mnt <<-KOPTIMIZED_CONF ; then - - 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="zstd" - COMPRESSION_OPTIONS=(-c -T$(nproc) -) - MODULES_DECOMPRESS="yes"' | tee /etc/mkinitcpio.conf.d/mkinitcpiod.conf && - mkinitcpio -P && - echo ' - CFLAGS="-march=native -O2 -pipe -fno-plt -fexceptions \ - -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security \ - -fstack-clash-protection -fcf-protection \ - -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer" - LDFLAGS="-Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now \ - -Wl,-z,pack-relative-relocs,-fuse-ld=mold" - RUSTFLAGS="-C force-frame-pointers=yes -C opt-level=3 -C target-cpu=native -C link-arg=-fuse-ld=mold" - MAKEFLAGS="-j$(nproc)" - BUILDENV=(!distcc color ccache check !sign) - OPTIONS=(strip docs !libtool !staticlibs emptydirs zipman purge !debug lto) - COMPRESSGZ=(pigz -c -f -n) - COMPRESSBZ2=(pbzip2 -c -f) - COMPRESSZST=(zstd -c -T0 --ultra -20 --auto-threads=logical -)' | tee /etc/makepkg.conf.d/makepkgd.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-sysctld.conf && - echo " - [defaults] - ntfs:ntfs3_defaults=uid=1000,gid=1000,windows_names" | 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-userd.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/modulesd.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/sudoersd && - visudo -c /etc/sudoers.d/sudoersd && - systemctl enable avahi-daemon bluetooth cups ipp-usb NetworkManager rngd sddm systemd-boot-update ${trim} ${vm_services} -KOPTIMIZED_CONF - stage_1="success" + 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/sudoersd && + visudo -c /etc/sudoers.d/sudoersd && + systemctl enable avahi-daemon bluetooth cups ipp-usb NetworkManager rngd systemd-boot-update ${displaymanager} ${trim} ${vm_services} +OPTIMIZED_CONF + stage_ok else - stage_1="fail" + stage_fail fi if [[ "${vgaconf}" == "y" && "${vendor}" == "Nvidia" ]]; then - if [[ "${kernelnmbr}" == "1" ]] || [[ "${kernelnmbr}" == "2" && "${family}" == "1" ]] || [[ "${kernelnmbr}" == "2" && "${family}" == "2" && "${nvdriver}" == "2" ]]; then - + stage_prompt="Nvidia-Hook" if arch-chroot /mnt <<-NVIDIAHOOK ; then + mkdir -p /etc/pacman.d/hooks/ && + echo " + [Trigger] + Operation=Install + Operation=Upgrade + Operation=Remove + Type=Package + Target=${nvname} + Target=${kernel} - 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 + [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 - stage_2="success" + stage_ok else - stage_2="fail" + stage_fail fi fi fi - - if [[ "${stage_1}" == "fail" ]] || [[ "${stage_2}" == "fail" ]] ; then - err_instl_abort - else - ok - completion - fi + ok + completion 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 - - if arch-chroot /mnt <<-GNOPTIMIZED_CONF ; then - - 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="zstd" - COMPRESSION_OPTIONS=(-c -T$(nproc) -) - MODULES_DECOMPRESS="yes"' | tee /etc/mkinitcpio.conf.d/mkinitcpiod.conf && - mkinitcpio -P && - echo ' - CFLAGS="-march=native -O2 -pipe -fno-plt -fexceptions \ - -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security \ - -fstack-clash-protection -fcf-protection \ - -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer" - LDFLAGS="-Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now \ - -Wl,-z,pack-relative-relocs,-fuse-ld=mold" - RUSTFLAGS="-C force-frame-pointers=yes -C opt-level=3 -C target-cpu=native -C link-arg=-fuse-ld=mold" - MAKEFLAGS="-j$(nproc)" - BUILDENV=(!distcc color ccache check !sign) - OPTIONS=(strip docs !libtool !staticlibs emptydirs zipman purge !debug lto) - COMPRESSGZ=(pigz -c -f -n) - COMPRESSBZ2=(pbzip2 -c -f) - COMPRESSZST=(zstd -c -T0 --ultra -20 --auto-threads=logical -)' | tee /etc/makepkg.conf.d/makepkgd.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-sysctld.conf && - echo " - [defaults] - ntfs:ntfs3_defaults=uid=1000,gid=1000,windows_names" | 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-userd.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/modulesd.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/sudoersd && - visudo -c /etc/sudoers.d/sudoersd && - systemctl enable avahi-daemon bluetooth cups gdm ipp-usb NetworkManager rngd systemd-boot-update ${trim} ${vm_services} -GNOPTIMIZED_CONF - stage_1="success" - else - stage_1="fail" - fi - - if [[ "${vgaconf}" == "y" && "${vendor}" == "Nvidia" ]]; then - - if [[ "${kernelnmbr}" == "1" ]] || [[ "${kernelnmbr}" == "2" && "${family}" == "1" ]] || [[ "${kernelnmbr}" == "2" && "${family}" == "2" && "${nvdriver}" == "2" ]]; then - if arch-chroot /mnt <<-NVIDIAHOOK ; then - - 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 - stage_2="success" - else - stage_2="fail" - fi - fi - fi - - if [[ "${stage_1}" == "fail" ]] || [[ "${stage_2}" == "fail" ]] ; then - err_instl_abort - else - ok - completion - fi - fi - #------------------------------------------------------------------------------------------ # NOTE: Custom System Configuration (Add any extra configuration below): if [[ "${packages}" == "12" ]]; then - + stage_prompt="Base System" if arch-chroot /mnt <<-CUSTOM_CONF ; then - - sed -i "/^#${SETLOCALE}/s/^#//" /etc/locale.gen && - locale-gen && - echo LANG=${SETLOCALE} > /etc/locale.conf && - export LANG=${SETLOCALE} && - echo KEYMAP=${SETKBD} > /etc/vconsole.conf && - echo " - ${mkinitcpio_mods} - ${mkinitcpio_hooks}" | tee /etc/mkinitcpio.conf.d/mkinitcpiod.conf && - mkinitcpio -P && - 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 root:${ROOTPASSWD2} | chpasswd && - useradd -m -G wheel -s /bin/bash ${USERNAME} && - echo ${USERNAME}:${USERPASSWD2} | chpasswd && - echo " - %wheel ALL=(ALL) ALL" | tee /etc/sudoers.d/sudoersd && - visudo -c /etc/sudoers.d/sudoersd + sed -i "/^#${SETLOCALE}/s/^#//" /etc/locale.gen && + locale-gen && + echo LANG=${SETLOCALE} > /etc/locale.conf && + export LANG=${SETLOCALE} && + echo KEYMAP=${SETKBD} > /etc/vconsole.conf && + echo " + ${mkinitcpio_mods} + ${mkinitcpio_hooks}" | tee /etc/mkinitcpio.conf.d/mkinitcpiod.conf && + mkinitcpio -P && + 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 root:${ROOTPASSWD2} | chpasswd && + useradd -m -G wheel -s /bin/bash ${USERNAME} && + echo ${USERNAME}:${USERPASSWD2} | chpasswd && + echo " + %wheel ALL=(ALL) ALL" | tee /etc/sudoers.d/sudoersd && + visudo -c /etc/sudoers.d/sudoersd CUSTOM_CONF - stage_1="success" + stage_ok else - stage_1="fail" + stage_fail fi if [[ -f /mnt/etc/lightdm/lightdm.conf ]]; then - if [[ "${greeternmbr}" == "1" ]]; then + stage_prompt="GTK Greeter" if arch-chroot /mnt <<-GTK ; then - sed -i 's|^#greeter-session=example-gtk-gnome|greeter-session=lightdm-gtk-greeter|g' /etc/lightdm/lightdm.conf + sed -i 's|^#greeter-session=example-gtk-gnome|greeter-session=lightdm-gtk-greeter|g' /etc/lightdm/lightdm.conf GTK - stage_2="success" + stage_ok else - stage_2="fail" - fi - + stage_fail + fi elif [[ "${greeternmbr}" == "2" ]]; then + stage_prompt="Slick Greeter" if arch-chroot /mnt <<-SLICK ; then - sed -i 's|^#greeter-session=example-gtk-gnome|greeter-session=lightdm-slick-greeter|g' /etc/lightdm/lightdm.conf + sed -i 's|^#greeter-session=example-gtk-gnome|greeter-session=lightdm-slick-greeter|g' /etc/lightdm/lightdm.conf SLICK - stage_2="success" + stage_ok else - stage_2="fail" + stage_fail fi fi fi if [[ "${bootloader}" == "1" ]]; then + stage_prompt="Systemd-boot" if arch-chroot /mnt <<-BOOTCTL ; then - 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 && - systemctl enable systemd-boot-update ${customservices} ${trim} ${vm_services} + 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 && + systemctl enable systemd-boot-update ${customservices} ${trim} ${vm_services} BOOTCTL - stage_3="success" + stage_ok else - stage_3="fail" + stage_fail fi - elif [[ "${bootloader}" == "2" ]]; then + stage_prompt="Grub" if arch-chroot /mnt <<-GRUB ; then - grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB && - 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 && - grub-mkconfig -o /boot/grub/grub.cfg + grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB && + 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 && + grub-mkconfig -o /boot/grub/grub.cfg GRUB - stage_3="success" + stage_ok else - stage_3="fail" + stage_fail fi if [[ -n "${customservices}" || -n "${trim}" || -n "${vm_services}" ]]; then + stage_prompt="Services" if arch-chroot /mnt <<-SERVICES ; then - systemctl enable ${customservices} ${trim} ${vm_services} + systemctl enable ${customservices} ${trim} ${vm_services} SERVICES - stage_4="success" + stage_ok else - stage_4="fail" + stage_fail fi fi if [[ "${bootloader}" == "2" && "${fs}" == "2" ]]; then + stage_prompt="Grub-Btrfsd" if arch-chroot /mnt <<-GRUBBTRFSD ; then - systemctl enable grub-btrfsd + systemctl enable grub-btrfsd GRUBBTRFSD - stage_5="success" + stage_ok else - stage_5="fail" + stage_fail fi fi if [[ "${vgaconf}" == "y" && "${vendor}" == "Nvidia" ]]; then + stage_prompt="Grub-Nvidia" if arch-chroot /mnt <<-NVIDIAGRUB ; then - sed -i "/^#GRUB_TERMINAL_OUTPUT=console/s/^#//" /etc/default/grub && - grub-mkconfig -o /boot/grub/grub.cfg + sed -i "/^#GRUB_TERMINAL_OUTPUT=console/s/^#//" /etc/default/grub && + grub-mkconfig -o /boot/grub/grub.cfg NVIDIAGRUB - stage_6="success" + stage_ok else - stage_6="fail" + stage_fail fi fi fi if [[ "${vgaconf}" == "y" && "${vendor}" == "Nvidia" ]]; then - if [[ "${kernelnmbr}" == "1" ]] || [[ "${kernelnmbr}" == "2" && "${family}" == "1" ]] || [[ "${kernelnmbr}" == "2" && "${family}" == "2" && "${nvdriver}" == "2" ]]; then - + stage_prompt="Nvidia-Hook" if arch-chroot /mnt <<-NVIDIAHOOK ; then + mkdir -p /etc/pacman.d/hooks/ && + echo " + [Trigger] + Operation=Install + Operation=Upgrade + Operation=Remove + Type=Package + Target=${nvname} + Target=${kernel} - 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 + [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 - stage_7="success" + stage_ok else - stage_7="fail" + stage_fail fi fi fi - - if [[ "${stage_1}" == "fail" ]] || [[ "${stage_2}" == "fail" ]] || [[ "${stage_3}" == "fail" ]] || [[ "${stage_4}" == "fail" ]] || [[ "${stage_5}" == "fail" ]] || [[ "${stage_6}" == "fail" ]] || [[ "${stage_7}" == "fail" ]] ; then - err_instl_abort - else - ok - completion - fi + ok + completion fi umount -R /mnt exit @@ -4812,13 +4600,6 @@ NVIDIAHOOK wireless_reg="" trg="" s="" - stage_1="" - stage_2="" - stage_3="" - stage_4="" - stage_5="" - stage_6="" - stage_7="" clear first_check