artix

desc
git clone https://git.awy.one/artix.git
Log | Files | Refs | README | LICENSE

commit e4f6d138607880bcc63c555b4041d8fba481547b
parent 2c414663b878a382301d800a64c91f3452f78617
Author: awy <awy@awy.one>
Date:   Wed, 30 Oct 2024 01:04:22 +0300

upload

Diffstat:
Minstall.sh | 107++++++++++++++++++++++++++++++++++++++++++++++---------------------------------
1 file changed, 63 insertions(+), 44 deletions(-)

diff --git a/install.sh b/install.sh @@ -1,71 +1,90 @@ -LIGHTGREEN='\033[1;32m' -LIGHTRED='\033[1;91m' -WHITE='\033[1;97m' -MAGENTA='\033[1;35m' -CYAN='\033[1;96m' -NoColor='\033[0m' +#!/bin/bash +set -e +export red="\033[1;31m" +export green="\033[1;32m" +export cyan="\033[0;36m" +export normal="\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 +dinitctl start ntpd -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" -read partitions -IFS=',' read -r -a partition_array <<< "$partitions" -root_drive="$disk_drive${partition_array[1]}" -boot_drive="$disk_drive${partition_array[0]}" +title() { + clear + echo -ne "${cyan} +################################################################################ +# # +# This is Automated Artix Linux Installer # +# # +# By # +# # +# awy :) # +# # +################################################################################ +${normal} +" +} -printf ${LIGHTGREEN}"Enter the Hostname you want to use:${NoColor}\n" -read _hostname -printf ${LIGHTGREEN}"Enter the Username you want to use:${NoColor}\n" -read _username -printf ${LIGHTRED}"Enter the password for ROOT:${NoColor}\n" -read -s _rootpasswd -printf ${LIGHTGREEN}"Enter the password for $_username:${NoColor}\n" -read -s _userpasswd +diskpart(){ + mkfs.fat -F32 /dev/"$boot_drive" + mkfs.ext4 -F /dev/"$root_drive" + mount /dev/"$root_drive" /mnt + mkdir /mnt/boot + mkdir /mnt/home +} -mkfs.fat -F32 /dev/$boot_drive -mkfs.ext4 -F /dev/$root_drive - -mount /dev/$root_drive /mnt -mkdir /mnt/boot -mkdir /mnt/home - -if [ "$_kernelflag" -eq 1 ]; then +zenKernel(){ mkdir /mnt/boot/efi - mount /dev/$boot_drive /mnt/boot/efi - dinitctl start ntpd + mount /dev/"$boot_drive" /mnt/boot/efi pacman -Sy --confirm basestrap /mnt base dinit seatd-dinit linux-zen linux-zen-headers fstabgen -U /mnt >> /mnt/etc/fstab - cp post_chroot.sh /mnt -elif [ "$_kernelflag" -eq 2 ]; then +} + +customKernel(){ mount /dev/$boot_drive /mnt/boot - dinitctl start ntpd pacman -Sy --confirm basestrap /mnt base dinit seatd-dinit udev intel-ucode UUID_ROOT=$(blkid -s UUID -o value /dev/$root_drive) UUID_BOOT=$(blkid -s UUID -o value /dev/$boot_drive) echo "UUID=$UUID_BOOT /boot vfat defaults,noatime 0 2" > /mnt/etc/fstab echo "UUID=$UUID_ROOT / ext4 defaults,noatime 0 1" >> /mnt/etc/fstab - cp post_chroot.sh /mnt cp .config /mnt/usr/src +} + +getUserData(){ + read -srp "Enter root password: " rootpass + read -rp "Enter username: " username + read -srp "Enter password for $username: " userpass + read -rp "Enter hostname: " hostname + read -rp "Do you want default linux-zen kernel or custom one?\nType 1 for default and 2 for custom:" _kernelflag + read -rp "Enter disk label (e.g. sda, nvme0n1p <- p is mandatory in nvme case):" disk_drive + read -rp "Enter comma-separated partition numbers (e.g., 5,6 for 5 boot 6 root):" partitions + IFS=',' read -r -a partition_array <<< "$partitions" + root_drive="$disk_drive${partition_array[1]}" + boot_drive="$disk_drive${partition_array[0]}" +} + +title +getUserData + +if [ "$_kernelflag" -eq 1 ]; then +zenKernel +elif [ "$_kernelflag" -eq 2 ]; then +customKernel else - printf ${LIGHTRED}"Wrong kernelflag value.${NoColor}\n" - exit 1 + printf "Wrong kernelflag value.\n" + exit 1 fi _numBoot="${partition_array[0]}" export _numBoot - export disk_drive export root_drive export boot_drive -export _hostname -export _username -export _rootpasswd -export _userpasswd +export hostname +export username +export rootpass +export userpass export _kernelflag +cp post_chroot.sh /mnt artix-chroot /mnt ./post_chroot.sh