aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorawy <awy@tutamail.com>2024-08-02 21:32:23 +0300
committerawy <awy@tutamail.com>2024-08-02 21:32:23 +0300
commitf6e5784a2a132509fefa43b28f70dd8230d0e3c5 (patch)
tree56d143e268de0d1edd9a8ce215306a42b2405e88
parentf25f5b92b6fcef040f87296549bfdd17bb76386d (diff)
custom kernel feature
-rwxr-xr-xinstall.sh32
-rwxr-xr-xpost_chroot.sh28
2 files changed, 43 insertions, 17 deletions
diff --git a/install.sh b/install.sh
index cb76c6a..37f0665 100755
--- a/install.sh
+++ b/install.sh
@@ -5,6 +5,9 @@ MAGENTA='\033[1;35m'
CYAN='\033[1;96m'
NoColor='\033[0m'
+printf ${LIGHTGREEN}"Do you want default linux-zen kernel or custom one?\nType 1 for default and 2 for custom:${NoColor}\n"
+read _kernelflag
+
printf ${LIGHTGREEN}"Enter disk label (e.g. sda, nvme0n1p <- p is mandatory in nvme case):${NoColor}\n"
read disk_drive
printf ${LIGHTGREEN}"Enter comma-separated partition numbers (e.g., 5,6 for 5 boot 6 root):${NoColor}\n"
@@ -28,16 +31,26 @@ mkfs.ext4 -F /dev/$root_drive
mount /dev/$root_drive /mnt
mkdir /mnt/boot
mkdir /mnt/home
-mkdir /mnt/boot/efi
-mount /dev/$boot_drive /mnt/boot/efi
-
-sv up ntpd
-pacman -Sy --confirm
-
-basestrap /mnt base runit seatd-runit linux-zen linux-zen-headers
-fstabgen -U /mnt >> /mnt/etc/fstab
-cp post_chroot.sh /mnt
+if [ "$_kernelflag" -eq 1 ]; then
+ mkdir /mnt/boot/efi
+ mount /dev/$boot_drive /mnt/boot/efi
+ sv up ntpd
+ pacman -Sy --confirm
+ basestrap /mnt base runit seatd-runit linux-zen linux-zen-headers
+ fstabgen -U /mnt >> /mnt/etc/fstab
+ cp post_chroot.sh /mnt
+elif [ "$_kernelflag" -eq 2 ]; then
+ mount /dev/$boot_drive /mnt/boot
+ sv up ntpd
+ pacman -Sy --confirm
+ basestrap /mnt base runit seatd-runit
+ fstabgen -U /mnt >> /mnt/etc/fstab
+ cp post_chroot.sh /mnt
+else
+ printf ${LIGHTRED}"Wrong kernelflag value.${NoColor}\n"
+ exit 1
+fi
export root_drive
export boot_drive
@@ -45,5 +58,6 @@ export _hostname
export _username
export _rootpasswd
export _userpasswd
+export _kernelflag
artix-chroot /mnt ./post_chroot.sh
diff --git a/post_chroot.sh b/post_chroot.sh
index a67df2f..15c8b51 100755
--- a/post_chroot.sh
+++ b/post_chroot.sh
@@ -2,7 +2,6 @@ ln -sf /usr/share/zoneinfo/Europe/Moscow /etc/localtime
hwclock --systohc
mkdir -p /etc/modprobe.d/
-echo "options hid_apple fnmode=0" > /etc/modprobe.d/hid_apple.conf
cat <<EOL >> /etc/modprobe.d/nvidia.conf
options nvidia NVreg_UsePageAttributeTable=1
options nvidia-drm fbdev=1
@@ -11,15 +10,32 @@ EOL
sed -i -e "/^#"en_US.UTF-8"/s/^#//" /etc/locale.gen
locale-gen
-
echo LANG=en_US.UTF-8 > /etc/locale.conf
export LANG="en_US.UTF-8"
export LC_COLLATE="C"
echo $_hostname > /etc/hostname
+PARTUUID_ROOT=$(blkid -s PARTUUID -o value /dev/$root_drive)
-pacman -S grub os-prober efibootmgr --noconfirm
-grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=grub
+if [ "$_kernelflag" -eq 1 ]; then
+ echo "options hid_apple fnmode=0" > /etc/modprobe.d/hid_apple.conf
+ pacman -S grub os-prober efibootmgr --noconfirm
+ grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=grub
+ GRUB_MODIFIED_LINE='GRUB_CMDLINE_LINUX_DEFAULT="loglevel=3 quiet options root=PARTUUID='$PARTUUID_ROOT' rw nvidia-drm.modeset=1 modeset=1 fbdev=1 intel_iommu=on"'
+ sed -i "s/GRUB_CMDLINE_LINUX_DEF\(.*\)/$GRUB_MODIFIED_LINE/g" /etc/default/grub
+elif [ "$_kernelflag" -eq 2 ]; then
+ pacman -S efibootmgr --noconfirm
+ cd /usr/src/
+ curl -LO "https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.10.2.tar.xz"
+ tar -xf "linux-6.10.2.tar.xz"
+ rm -f "linux-6.10.2.tar.xz"
+ cd "linux-6.10.2"
+ curl -LO "https://codeberg.org/awy/artix/raw/branch/minimal/.config"
+ sed -i -e '/^CONFIG_CMDLINE="root=PARTUUID=.*/c\' -e "CONFIG_CMDLINE=\"root=PARTUUID=$PARTUUID_ROOT\"" .config
+else
+ printf ${LIGHTRED}"Wrong kernelflag value.${NoColor}\n"
+ exit 1
+fi
useradd -m -g users -G wheel,storage,power -s /bin/bash $_username
@@ -42,10 +58,6 @@ EOL
pacman -S dhcpcd dhcpcd-runit --noconfirm
ln -s /etc/runit/sv/dhcpcd /etc/runit/runsvdir/default
-SMFSUWER=$(blkid -s PARTUUID -o value /dev/$root_drive)
-POWERSMFSUWER='GRUB_CMDLINE_LINUX_DEFAULT="loglevel=3 quiet options root=PARTUUID='$SMFSUWER' rw nvidia-drm.modeset=1 modeset=1 fbdev=1 intel_iommu=on"'
-sed -i "s/GRUB_CMDLINE_LINUX_DEF\(.*\)/$POWERSMFSUWER/g" /etc/default/grub
-
pacman -S linux-zen-headers --noconfirm
pacman -S nvidia-open-dkms nvidia-utils intel-ucode trizen --noconfirm
sed -i -e 's/MODULES=()/MODULES=(nvidia nvidia_modeset nvidia_uvm nvidia_drm)/g' /etc/mkinitcpio.conf