Changed the way "Swapfile" is managed, to comply with the latest ArchWiki changes.

Changed/Reverted the way Locales are being filtered at "Selecting Locale" Stage.
Unified "KDE Plasma (Optimized) & Gnome (Optimized) configuration into the same code block.
Completely re-written the "Stage-Success" verification mechanism. Now is more elaborate and very detailed/verbose.
Minor aesthetic corrections.
This commit is contained in:
Jane Doe 2024-05-18 16:33:28 +00:00
parent 2c92e181bb
commit 4446db1023

415
Amelia.sh
View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Amelia Installer # Amelia Installer
# Version: 4.4 # Version: 4.5
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
@ -187,20 +187,6 @@ err_reload (){
reload reload
} }
#---------------------------------------------------------- #----------------------------------------------------------
err_instl_abort (){
sleep 0.5
RED "
[!] Warning: Installation errored
[!] Exiting..
"
exit
}
#----------------------------------------------------------
choice (){ choice (){
sleep 0.5 sleep 0.5
RED " RED "
@ -215,6 +201,23 @@ ok (){
==> [${green}${prompt} OK${nc}] " ==> [${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 (){ completion (){
sleep 0.5 sleep 0.5
CYAN " CYAN "
@ -492,7 +495,7 @@ ${purple}###${nc} Locale Selection ${purple}###${nc}
" "
YELLOW " 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] " ### [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 " read -r -p "
==> " SETLOCALE ==> " SETLOCALE
if [[ -z "${SETLOCALE}" ]]; then if [[ -z "${SETLOCALE}" ]]; then
SETLOCALE="en_US.UTF-8 UTF-8" SETLOCALE="en_US.UTF-8"
sleep 0.5 sleep 0.5
YELLOW " YELLOW "
### 'en_US.UTF-8 UTF-8' Locale has been selected ### 'en_US.UTF-8' Locale has been selected
" "
elif [[ "${SETLOCALE}" == "l" ]]; then elif [[ "${SETLOCALE}" == "l" ]]; then
more /usr/share/i18n/SUPPORTED more /usr/share/i18n/SUPPORTED
return 1 return 1
elif ! grep -Fxq "${SETLOCALE}" /usr/share/i18n/SUPPORTED; then elif ! grep -q "^#\?$(sed 's/[].*[]/\\&/g' <<< "${SETLOCALE}") " /usr/share/i18n/SUPPORTED; then
invalid invalid
return 1 return 1
@ -3882,15 +3885,9 @@ ___________________________
${purple}###${nc} Swapfile Activation ${purple}###${nc} ${purple}###${nc} Swapfile Activation ${purple}###${nc}
" "
arch-chroot /mnt <<-SWAP if arch-chroot /mnt <<-SWAP ; then
dd if=/dev/zero of=/swapfile bs=1M count=${swapsize}k status=progress && mkswap -U clear --size ${swapsize}G --file /swapfile
chmod 0600 /swapfile &&
mkswap -U clear /swapfile &&
swapon /swapfile
SWAP SWAP
if swapon /swapfile; then
if cat >> /mnt/etc/fstab <<-FSTAB ; then if cat >> /mnt/etc/fstab <<-FSTAB ; then
/swapfile none swap defaults 0 0 /swapfile none swap defaults 0 0
FSTAB FSTAB
@ -3915,13 +3912,9 @@ _________________________________
${purple}###${nc} Btrfs Swapfile Activation ${purple}###${nc} ${purple}###${nc} Btrfs Swapfile Activation ${purple}###${nc}
" "
arch-chroot /mnt <<-SWAP if arch-chroot /mnt <<-SWAP ; then
btrfs filesystem mkswapfile --size ${swapsize}g --uuid clear /swap/swapfile && btrfs filesystem mkswapfile --size ${swapsize}g --uuid clear /swap/swapfile
swapon /swap/swapfile
SWAP SWAP
if swapon /swap/swapfile; then
if cat >> /mnt/etc/fstab <<-FSTAB ; then if cat >> /mnt/etc/fstab <<-FSTAB ; then
/swap/swapfile none swap defaults 0 0 /swap/swapfile none swap defaults 0 0
FSTAB FSTAB
@ -3932,7 +3925,6 @@ FSTAB
[!] Populating the 'fstab' file has failed " [!] Populating the 'fstab' file has failed "
abort abort
fi fi
else else
err_swapfile err_swapfile
fi fi
@ -4075,9 +4067,8 @@ ${purple}###${nc} Chroot & Configure System ${purple}###${nc}
# NOTE: All Vanilla Desktops Basic Configuration: # NOTE: All Vanilla Desktops Basic Configuration:
if [[ "${packages}" =~ ^(1|3|5|6|7|8|9|10|11)$ ]]; then if [[ "${packages}" =~ ^(1|3|5|6|7|8|9|10|11)$ ]]; then
stage_prompt="Base System"
if arch-chroot /mnt <<-VANILLA_CONF ; then if arch-chroot /mnt <<-VANILLA_CONF ; then
sed -i "/^#${SETLOCALE}/s/^#//" /etc/locale.gen && sed -i "/^#${SETLOCALE}/s/^#//" /etc/locale.gen &&
locale-gen && locale-gen &&
echo LANG=${SETLOCALE} > /etc/locale.conf && echo LANG=${SETLOCALE} > /etc/locale.conf &&
@ -4101,44 +4092,44 @@ ${purple}###${nc} Chroot & Configure System ${purple}###${nc}
%wheel ALL=(ALL) ALL" | tee /etc/sudoers.d/sudoersd && %wheel ALL=(ALL) ALL" | tee /etc/sudoers.d/sudoersd &&
visudo -c /etc/sudoers.d/sudoersd visudo -c /etc/sudoers.d/sudoersd
VANILLA_CONF VANILLA_CONF
stage_1="success" stage_ok
else else
stage_1="fail" stage_fail
fi fi
if [[ -f /mnt/etc/lightdm/lightdm.conf ]]; then 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 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 DEEPIN
stage_2="success" stage_ok
else else
stage_2="fail" stage_fail
fi fi
elif [[ "${packages}" == "8" ]]; then elif [[ "${packages}" == "8" ]]; then
stage_prompt="GTK Greeter"
if arch-chroot /mnt <<-GTK ; then 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 GTK
stage_2="success" stage_ok
else else
stage_2="fail" stage_fail
fi fi
else else
stage_prompt="Slick Greeter"
if arch-chroot /mnt <<-SLICK ; then 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 SLICK
stage_2="success" stage_ok
else else
stage_2="fail" stage_fail
fi fi
fi fi
fi fi
if [[ "${bootloader}" == "1" ]]; then if [[ "${bootloader}" == "1" ]]; then
stage_prompt="Systemd-boot"
if arch-chroot /mnt <<-BOOTCTL ; then if arch-chroot /mnt <<-BOOTCTL ; then
bootctl install --graceful && bootctl install --graceful &&
echo "default arch.conf" > /boot/loader/loader.conf && echo "default arch.conf" > /boot/loader/loader.conf &&
@ -4149,13 +4140,12 @@ SLICK
options rw ${boot_opts}" | tee /boot/loader/entries/arch.conf && options rw ${boot_opts}" | tee /boot/loader/entries/arch.conf &&
systemctl enable systemd-boot-update ${bluetooth} ${displaymanager} ${network} ${trim} ${vm_services} systemctl enable systemd-boot-update ${bluetooth} ${displaymanager} ${network} ${trim} ${vm_services}
BOOTCTL BOOTCTL
stage_3="success" stage_ok
else else
stage_3="fail" stage_fail
fi fi
elif [[ "${bootloader}" == "2" ]]; then elif [[ "${bootloader}" == "2" ]]; then
stage_prompt="Grub"
if arch-chroot /mnt <<-GRUB ; then if arch-chroot /mnt <<-GRUB ; then
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB && grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB &&
sed -i \ sed -i \
@ -4165,37 +4155,38 @@ BOOTCTL
grub-mkconfig -o /boot/grub/grub.cfg && grub-mkconfig -o /boot/grub/grub.cfg &&
systemctl enable ${bluetooth} ${displaymanager} ${network} ${trim} ${vm_services} systemctl enable ${bluetooth} ${displaymanager} ${network} ${trim} ${vm_services}
GRUB GRUB
stage_3="success" stage_ok
else else
stage_3="fail" stage_fail
fi fi
if [[ "${bootloader}" == "2" && "${fs}" == "2" ]]; then if [[ "${bootloader}" == "2" && "${fs}" == "2" ]]; then
stage_prompt="Grub-Btrfsd"
if arch-chroot /mnt <<-GRUBBTRFSD ; then if arch-chroot /mnt <<-GRUBBTRFSD ; then
systemctl enable grub-btrfsd systemctl enable grub-btrfsd
GRUBBTRFSD GRUBBTRFSD
stage_4="success" stage_ok
else else
stage_4="fail" stage_fail
fi fi
fi fi
if [[ "${vgaconf}" == "y" && "${vendor}" == "Nvidia" ]]; then if [[ "${vgaconf}" == "y" && "${vendor}" == "Nvidia" ]]; then
stage_prompt="Grub-Nvidia"
if arch-chroot /mnt <<-NVIDIAGRUB ; then if arch-chroot /mnt <<-NVIDIAGRUB ; then
sed -i "/^#GRUB_TERMINAL_OUTPUT=console/s/^#//" /etc/default/grub && sed -i "/^#GRUB_TERMINAL_OUTPUT=console/s/^#//" /etc/default/grub &&
grub-mkconfig -o /boot/grub/grub.cfg grub-mkconfig -o /boot/grub/grub.cfg
NVIDIAGRUB NVIDIAGRUB
stage_5="success" stage_ok
else else
stage_5="fail" stage_fail
fi fi
fi fi
fi fi
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 [[ "${kernelnmbr}" == "1" ]] || [[ "${kernelnmbr}" == "2" && "${family}" == "1" ]] || [[ "${kernelnmbr}" == "2" && "${family}" == "2" && "${nvdriver}" == "2" ]]; then
stage_prompt="Nvidia-Hook"
if arch-chroot /mnt <<-NVIDIAHOOK ; then if arch-chroot /mnt <<-NVIDIAHOOK ; then
mkdir -p /etc/pacman.d/hooks/ && mkdir -p /etc/pacman.d/hooks/ &&
echo " echo "
@ -4214,26 +4205,28 @@ NVIDIAGRUB
NeedsTargets 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 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 NVIDIAHOOK
stage_6="success" stage_ok
else else
stage_6="fail" stage_fail
fi fi
fi 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 ok
completion completion
fi fi
fi
#------------------------------------------------------------------------------------------ #------------------------------------------------------------------------------------------
# NOTE: Plasma & Systemd-boot Optimized System Configuration: # NOTE: Plasma / Gnome & Systemd-boot Optimized System Configuration:
if [[ "${packages}" == "2" ]] || [[ "${packages}" == "4" ]]; then
stage_prompt="Main System"
if [[ "${packages}" == "2" ]]; then if [[ "${packages}" == "2" ]]; then
displaymanager="sddm"
elif [[ "${packages}" == "4" ]]; then
displaymanager="gdm"
fi
if [[ -n "${nrg_plc}" ]]; then if [[ -n "${nrg_plc}" ]]; then
arch-chroot /mnt <<-NRG arch-chroot /mnt <<-NRG
@ -4241,8 +4234,7 @@ NVIDIAHOOK
NRG NRG
fi fi
if arch-chroot /mnt <<-KOPTIMIZED_CONF ; then if arch-chroot /mnt <<-OPTIMIZED_CONF ; then
sed -i "/^#${SETLOCALE}/s/^#//" /etc/locale.gen && sed -i "/^#${SETLOCALE}/s/^#//" /etc/locale.gen &&
locale-gen && locale-gen &&
echo LANG=${SETLOCALE} > /etc/locale.conf && echo LANG=${SETLOCALE} > /etc/locale.conf &&
@ -4254,7 +4246,7 @@ NRG
${mkinitcpio_mods} ${mkinitcpio_mods}
${mkinitcpio_hooks} ${mkinitcpio_hooks}
COMPRESSION="zstd" COMPRESSION="zstd"
COMPRESSION_OPTIONS=(-c -T$(nproc) -) COMPRESSION_OPTIONS=(-c -T$(nproc) --auto-threads=logical -)
MODULES_DECOMPRESS="yes"' | tee /etc/mkinitcpio.conf.d/mkinitcpiod.conf && MODULES_DECOMPRESS="yes"' | tee /etc/mkinitcpio.conf.d/mkinitcpiod.conf &&
mkinitcpio -P && mkinitcpio -P &&
echo ' echo '
@ -4378,19 +4370,17 @@ NRG
Defaults editor=/usr/bin/nano Defaults editor=/usr/bin/nano
%wheel ALL=(ALL) ALL" | tee /etc/sudoers.d/sudoersd && %wheel ALL=(ALL) ALL" | tee /etc/sudoers.d/sudoersd &&
visudo -c /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} systemctl enable avahi-daemon bluetooth cups ipp-usb NetworkManager rngd systemd-boot-update ${displaymanager} ${trim} ${vm_services}
KOPTIMIZED_CONF OPTIMIZED_CONF
stage_1="success" stage_ok
else else
stage_1="fail" stage_fail
fi fi
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 [[ "${kernelnmbr}" == "1" ]] || [[ "${kernelnmbr}" == "2" && "${family}" == "1" ]] || [[ "${kernelnmbr}" == "2" && "${family}" == "2" && "${nvdriver}" == "2" ]]; then
stage_prompt="Nvidia-Hook"
if arch-chroot /mnt <<-NVIDIAHOOK ; then if arch-chroot /mnt <<-NVIDIAHOOK ; then
mkdir -p /etc/pacman.d/hooks/ && mkdir -p /etc/pacman.d/hooks/ &&
echo " echo "
[Trigger] [Trigger]
@ -4408,222 +4398,23 @@ KOPTIMIZED_CONF
NeedsTargets 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 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 NVIDIAHOOK
stage_2="success" stage_ok
else else
stage_2="fail" stage_fail
fi fi
fi fi
fi fi
if [[ "${stage_1}" == "fail" ]] || [[ "${stage_2}" == "fail" ]] ; then
err_instl_abort
else
ok ok
completion completion
fi 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
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): # NOTE: Custom System Configuration (Add any extra configuration below):
if [[ "${packages}" == "12" ]]; then if [[ "${packages}" == "12" ]]; then
stage_prompt="Base System"
if arch-chroot /mnt <<-CUSTOM_CONF ; then if arch-chroot /mnt <<-CUSTOM_CONF ; then
sed -i "/^#${SETLOCALE}/s/^#//" /etc/locale.gen && sed -i "/^#${SETLOCALE}/s/^#//" /etc/locale.gen &&
locale-gen && locale-gen &&
echo LANG=${SETLOCALE} > /etc/locale.conf && echo LANG=${SETLOCALE} > /etc/locale.conf &&
@ -4647,34 +4438,35 @@ NVIDIAHOOK
%wheel ALL=(ALL) ALL" | tee /etc/sudoers.d/sudoersd && %wheel ALL=(ALL) ALL" | tee /etc/sudoers.d/sudoersd &&
visudo -c /etc/sudoers.d/sudoersd visudo -c /etc/sudoers.d/sudoersd
CUSTOM_CONF CUSTOM_CONF
stage_1="success" stage_ok
else else
stage_1="fail" stage_fail
fi fi
if [[ -f /mnt/etc/lightdm/lightdm.conf ]]; then if [[ -f /mnt/etc/lightdm/lightdm.conf ]]; then
if [[ "${greeternmbr}" == "1" ]]; then if [[ "${greeternmbr}" == "1" ]]; then
stage_prompt="GTK Greeter"
if arch-chroot /mnt <<-GTK ; then 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 GTK
stage_2="success" stage_ok
else else
stage_2="fail" stage_fail
fi fi
elif [[ "${greeternmbr}" == "2" ]]; then elif [[ "${greeternmbr}" == "2" ]]; then
stage_prompt="Slick Greeter"
if arch-chroot /mnt <<-SLICK ; then 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 SLICK
stage_2="success" stage_ok
else else
stage_2="fail" stage_fail
fi fi
fi fi
fi fi
if [[ "${bootloader}" == "1" ]]; then if [[ "${bootloader}" == "1" ]]; then
stage_prompt="Systemd-boot"
if arch-chroot /mnt <<-BOOTCTL ; then if arch-chroot /mnt <<-BOOTCTL ; then
bootctl install --graceful && bootctl install --graceful &&
echo "default arch.conf" > /boot/loader/loader.conf && echo "default arch.conf" > /boot/loader/loader.conf &&
@ -4685,12 +4477,12 @@ SLICK
options rw ${boot_opts}" | tee /boot/loader/entries/arch.conf && options rw ${boot_opts}" | tee /boot/loader/entries/arch.conf &&
systemctl enable systemd-boot-update ${customservices} ${trim} ${vm_services} systemctl enable systemd-boot-update ${customservices} ${trim} ${vm_services}
BOOTCTL BOOTCTL
stage_3="success" stage_ok
else else
stage_3="fail" stage_fail
fi fi
elif [[ "${bootloader}" == "2" ]]; then elif [[ "${bootloader}" == "2" ]]; then
stage_prompt="Grub"
if arch-chroot /mnt <<-GRUB ; then if arch-chroot /mnt <<-GRUB ; then
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB && grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB &&
sed -i \ sed -i \
@ -4699,49 +4491,50 @@ BOOTCTL
/etc/default/grub && /etc/default/grub &&
grub-mkconfig -o /boot/grub/grub.cfg grub-mkconfig -o /boot/grub/grub.cfg
GRUB GRUB
stage_3="success" stage_ok
else else
stage_3="fail" stage_fail
fi fi
if [[ -n "${customservices}" || -n "${trim}" || -n "${vm_services}" ]]; then if [[ -n "${customservices}" || -n "${trim}" || -n "${vm_services}" ]]; then
stage_prompt="Services"
if arch-chroot /mnt <<-SERVICES ; then if arch-chroot /mnt <<-SERVICES ; then
systemctl enable ${customservices} ${trim} ${vm_services} systemctl enable ${customservices} ${trim} ${vm_services}
SERVICES SERVICES
stage_4="success" stage_ok
else else
stage_4="fail" stage_fail
fi fi
fi fi
if [[ "${bootloader}" == "2" && "${fs}" == "2" ]]; then if [[ "${bootloader}" == "2" && "${fs}" == "2" ]]; then
stage_prompt="Grub-Btrfsd"
if arch-chroot /mnt <<-GRUBBTRFSD ; then if arch-chroot /mnt <<-GRUBBTRFSD ; then
systemctl enable grub-btrfsd systemctl enable grub-btrfsd
GRUBBTRFSD GRUBBTRFSD
stage_5="success" stage_ok
else else
stage_5="fail" stage_fail
fi fi
fi fi
if [[ "${vgaconf}" == "y" && "${vendor}" == "Nvidia" ]]; then if [[ "${vgaconf}" == "y" && "${vendor}" == "Nvidia" ]]; then
stage_prompt="Grub-Nvidia"
if arch-chroot /mnt <<-NVIDIAGRUB ; then if arch-chroot /mnt <<-NVIDIAGRUB ; then
sed -i "/^#GRUB_TERMINAL_OUTPUT=console/s/^#//" /etc/default/grub && sed -i "/^#GRUB_TERMINAL_OUTPUT=console/s/^#//" /etc/default/grub &&
grub-mkconfig -o /boot/grub/grub.cfg grub-mkconfig -o /boot/grub/grub.cfg
NVIDIAGRUB NVIDIAGRUB
stage_6="success" stage_ok
else else
stage_6="fail" stage_fail
fi fi
fi fi
fi fi
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 [[ "${kernelnmbr}" == "1" ]] || [[ "${kernelnmbr}" == "2" && "${family}" == "1" ]] || [[ "${kernelnmbr}" == "2" && "${family}" == "2" && "${nvdriver}" == "2" ]]; then
stage_prompt="Nvidia-Hook"
if arch-chroot /mnt <<-NVIDIAHOOK ; then if arch-chroot /mnt <<-NVIDIAHOOK ; then
mkdir -p /etc/pacman.d/hooks/ && mkdir -p /etc/pacman.d/hooks/ &&
echo " echo "
[Trigger] [Trigger]
@ -4759,20 +4552,15 @@ NVIDIAGRUB
NeedsTargets 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 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 NVIDIAHOOK
stage_7="success" stage_ok
else else
stage_7="fail" stage_fail
fi fi
fi 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 ok
completion completion
fi fi
fi
umount -R /mnt umount -R /mnt
exit exit
} }
@ -4812,13 +4600,6 @@ NVIDIAHOOK
wireless_reg="" wireless_reg=""
trg="" trg=""
s="" s=""
stage_1=""
stage_2=""
stage_3=""
stage_4=""
stage_5=""
stage_6=""
stage_7=""
clear clear
first_check first_check