diff --git a/.gitignore b/.gitignore index 8e189eb..a20aba1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ install.conf installlog.txt -archnikus.code-workspace \ No newline at end of file +archnikus.code-workspace +setup.conf \ No newline at end of file diff --git a/0-preinstall.sh b/0-preinstall.sh index d789a3a..ddc03c9 100755 --- a/0-preinstall.sh +++ b/0-preinstall.sh @@ -8,9 +8,21 @@ # ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝ #------------------------------------------------------------------------- SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" -echo "-------------------------------------------------" -echo "Setting up mirrors for optimal download " -echo "-------------------------------------------------" +echo -ne " +------------------------------------------------------------------------- + █████╗ ██████╗ ██████╗██╗ ██╗████████╗██╗████████╗██╗ ██╗███████╗ + ██╔══██╗██╔══██╗██╔════╝██║ ██║╚══██╔══╝██║╚══██╔══╝██║ ██║██╔════╝ + ███████║██████╔╝██║ ███████║ ██║ ██║ ██║ ██║ ██║███████╗ + ██╔══██║██╔══██╗██║ ██╔══██║ ██║ ██║ ██║ ██║ ██║╚════██║ + ██║ ██║██║ ██║╚██████╗██║ ██║ ██║ ██║ ██║ ╚██████╔╝███████║ + ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝ +------------------------------------------------------------------------- + Automated Arch Linux Installer +------------------------------------------------------------------------- + +Setting up mirrors for optimal download +" +source setup.conf iso=$(curl -4 ifconfig.co/country-iso) timedatectl set-ntp true pacman -S --noconfirm pacman-contrib terminus-font @@ -18,39 +30,24 @@ setfont ter-v22b sed -i 's/^#Para/Para/' /etc/pacman.conf pacman -S --noconfirm reflector rsync grub cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup -echo -e "-------------------------------------------------------------------------" -echo -e " █████╗ ██████╗ ██████╗██╗ ██╗████████╗██╗████████╗██╗ ██╗███████╗" -echo -e " ██╔══██╗██╔══██╗██╔════╝██║ ██║╚══██╔══╝██║╚══██╔══╝██║ ██║██╔════╝" -echo -e " ███████║██████╔╝██║ ███████║ ██║ ██║ ██║ ██║ ██║███████╗" -echo -e " ██╔══██║██╔══██╗██║ ██╔══██║ ██║ ██║ ██║ ██║ ██║╚════██║" -echo -e " ██║ ██║██║ ██║╚██████╗██║ ██║ ██║ ██║ ██║ ╚██████╔╝███████║" -echo -e " ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝" -echo -e "-------------------------------------------------------------------------" -echo -e "-Setting up $iso mirrors for faster downloads" -echo -e "-------------------------------------------------------------------------" - +echo -ne " +------------------------------------------------------------------------- + Setting up $iso mirrors for faster downloads +------------------------------------------------------------------------- +" reflector -a 48 -c $iso -f 5 -l 20 --sort rate --save /etc/pacman.d/mirrorlist -mkdir /mnt - - -echo -e "\nInstalling prereqs...\n$HR" +mkdir /mnt &>/dev/null # Hiding error message if any +echo -ne " +------------------------------------------------------------------------- + Installing Prerequisites +------------------------------------------------------------------------- +" pacman -S --noconfirm gptfdisk btrfs-progs - -echo "-------------------------------------------------" -echo "-------select your disk to format----------------" -echo "-------------------------------------------------" -lsblk -echo "Please enter disk to work on: (example /dev/sda)" -read DISK -echo "THIS WILL FORMAT AND DELETE ALL DATA ON THE DISK" -read -p "are you sure you want to continue (Y/N):" formatdisk -case $formatdisk in - -y|Y|yes|Yes|YES) -echo "--------------------------------------" -echo -e "\nFormatting disk...\n$HR" -echo "--------------------------------------" - +echo -ne " +------------------------------------------------------------------------- + Formating Disk +------------------------------------------------------------------------- +" # disk prep sgdisk -Z ${DISK} # zap all on disk sgdisk -a 2048 -o ${DISK} # new gpt disk 2048 alignment @@ -59,35 +56,91 @@ sgdisk -a 2048 -o ${DISK} # new gpt disk 2048 alignment sgdisk -n 1::+1M --typecode=1:ef02 --change-name=1:'BIOSBOOT' ${DISK} # partition 1 (BIOS Boot Partition) sgdisk -n 2::+100M --typecode=2:ef00 --change-name=2:'EFIBOOT' ${DISK} # partition 2 (UEFI Boot Partition) sgdisk -n 3::-0 --typecode=3:8300 --change-name=3:'ROOT' ${DISK} # partition 3 (Root), default start, remaining -if [[ ! -d "/sys/firmware/efi" ]]; then +if [[ ! -d "/sys/firmware/efi" ]]; then # Checking for bios system sgdisk -A 1:set:2 ${DISK} fi - # make filesystems -echo -e "\nCreating Filesystems...\n$HR" -if [[ ${DISK} =~ "nvme" ]]; then -mkfs.vfat -F32 -n "EFIBOOT" "${DISK}p2" -mkfs.btrfs -L "ROOT" "${DISK}p3" -f -mount -t btrfs "${DISK}p3" /mnt +echo -ne " +------------------------------------------------------------------------- + Creating Filesystems +------------------------------------------------------------------------- +" +createsubvolumes () { + btrfs subvolume create /mnt/@ + btrfs subvolume create /mnt/@home + btrfs subvolume create /mnt/@var + btrfs subvolume create /mnt/@tmp + btrfs subvolume create /mnt/@.snapshots +} + +mountallsubvol () { + mount -o noatime,compress=zstd,space_cache,commit=120,subvol=@home /dev/mapper/ROOT /mnt/home + mount -o noatime,compress=zstd,space_cache,commit=120,subvol=@tmp /dev/mapper/ROOT /mnt/tmp + mount -o noatime,compress=zstd,space_cache,commit=120,subvol=@.snapshots /dev/mapper/ROOT /mnt/.snapshots + mount -o subvol=@var /dev/mapper/ROOT /mnt/var +} +if [[ "${DISK}" == "nvme" ]]; then + if [[ "${FS}" == "btrfs" ]]; then + mkfs.vfat -F32 -n "EFIBOOT" ${DISK}p2 + mkfs.btrfs -L ROOT ${DISK}p3 -f + mount -t btrfs ${DISK}p3 /mnt + elif [[ "${FS}" == "ext4" ]]; then + mkfs.vfat -F32 -n "EFIBOOT" ${DISK}p2 + mkfs.ext4 -L ROOT ${DISK}p3 + mount -t ext4 ${DISK}p3 /mnt + elif [[ "${FS}" == "luks" ]]; then + mkfs.vfat -F32 -n "EFIBOOT" ${DISK}p2 +# enter luks password to cryptsetup and format root partition + echo -n "${luks_password}" | cryptsetup -y -v luksFormat ${DISK}p3 - +# open luks container and ROOT will be place holder + echo -n "${luks_password}" | cryptsetup open ${DISK}p3 ROOT - +# now format that container + mkfs.btrfs -L ROOT /dev/mapper/ROOT +# create subvolumes for btrfs + mount -t btrfs /dev/mapper/ROOT /mnt + createsubvolumes + umount /mnt +# mount @ subvolume + mount -o noatime,compress=zstd,space_cache,commit=120,subvol=@ /dev/mapper/ROOT /mnt +# make directories home, .snapshots, var, tmp + mkdir -p /mnt/{home,var,tmp,.snapshots} +# mount subvolumes + mountallsubvol + fi else -mkfs.vfat -F32 -n "EFIBOOT" "${DISK}2" -mkfs.btrfs -L "ROOT" "${DISK}3" -f -mount -t btrfs "${DISK}3" /mnt + if [[ "${FS}" == "btrfs" ]]; then + mkfs.vfat -F32 -n "EFIBOOT" ${DISK}2 + mkfs.btrfs -f -L ROOT ${DISK}3 + mount -t btrfs ${DISK}3 /mnt + elif [[ "${FS}" == "ext4" ]]; then + mkfs.vfat -F32 -n "EFIBOOT" ${DISK}2 + mkfs.ext4 -L ROOT ${DISK}3 + mount -t ext4 ${DISK}3 /mnt + elif [[ "${FS}" == "luks" ]]; then + mkfs.vfat -F32 -n "EFIBOOT" ${DISK}2 + echo -n "${luks_password}" | cryptsetup -y -v luksFormat ${DISK}3 - + echo -n "${luks_password}" | cryptsetup open ${DISK}3 ROOT - + mkfs.btrfs -L ROOT /dev/mapper/ROOT + mount -t btrfs /dev/mapper/ROOT /mnt + createsubvolumes + umount /mnt +# mount all the subvolumes + mount -o noatime,compress=zstd,space_cache,commit=120,subvol=@ /dev/mapper/ROOT /mnt +# make directories home, .snapshots, var, tmp + mkdir -p /mnt/{home,var,tmp,.snapshots} +# mount subvolumes + mountallsubvol + fi fi +# checking if user selected btrfs +if [[ ${FS} =~ "btrfs" ]]; then ls /mnt | xargs btrfs subvolume delete btrfs subvolume create /mnt/@ umount /mnt -;; -*) -echo "Rebooting in 3 Seconds ..." && sleep 1 -echo "Rebooting in 2 Seconds ..." && sleep 1 -echo "Rebooting in 1 Second ..." && sleep 1 -reboot now -;; -esac +mount -t btrfs -o subvol=@ -L ROOT /mnt +fi # mount target -mount -t btrfs -o subvol=@ -L ROOT /mnt mkdir /mnt/boot mkdir /mnt/boot/efi mount -t vfat -L EFIBOOT /mnt/boot/ @@ -99,24 +152,29 @@ if ! grep -qs '/mnt' /proc/mounts; then echo "Rebooting in 1 Second ..." && sleep 1 reboot now fi - -echo "--------------------------------------" -echo "-- Arch Install on Main Drive --" -echo "--------------------------------------" +echo -ne " +------------------------------------------------------------------------- + Arch Install on Main Drive +------------------------------------------------------------------------- +" pacstrap /mnt base base-devel linux linux-firmware vim nano sudo archlinux-keyring wget libnewt --noconfirm --needed genfstab -U /mnt >> /mnt/etc/fstab echo "keyserver hkp://keyserver.ubuntu.com" >> /mnt/etc/pacman.d/gnupg/gpg.conf cp -R ${SCRIPT_DIR} /mnt/root/ArchTitus cp /etc/pacman.d/mirrorlist /mnt/etc/pacman.d/mirrorlist -echo "--------------------------------------" -echo "--GRUB BIOS Bootloader Install&Check--" -echo "--------------------------------------" +echo -ne " +------------------------------------------------------------------------- + GRUB BIOS Bootloader Install & Check +------------------------------------------------------------------------- +" if [[ ! -d "/sys/firmware/efi" ]]; then grub-install --boot-directory=/mnt/boot ${DISK} fi -echo "--------------------------------------" -echo "-- Check for low memory systems <8G --" -echo "--------------------------------------" +echo -ne " +------------------------------------------------------------------------- + Checking for low memory systems <8G +------------------------------------------------------------------------- +" TOTALMEM=$(cat /proc/meminfo | grep -i 'memtotal' | grep -o '[[:digit:]]*') if [[ $TOTALMEM -lt 8000000 ]]; then #Put swap into the actual system, not into RAM disk, otherwise there is no point in it, it'll cache RAM into RAM. So, /mnt/ everything. @@ -130,6 +188,8 @@ if [[ $TOTALMEM -lt 8000000 ]]; then #The line below is written to /mnt/ but doesn't contain /mnt/, since it's just / for the sysytem itself. echo "/opt/swap/swapfile none swap sw 0 0" >> /mnt/etc/fstab #Add swap to fstab, so it KEEPS working after installation. fi -echo "--------------------------------------" -echo "-- SYSTEM READY FOR 1-setup --" -echo "--------------------------------------" +echo -ne " +------------------------------------------------------------------------- + SYSTEM READY FOR 1-setup.sh +------------------------------------------------------------------------- +" \ No newline at end of file diff --git a/1-setup.sh b/1-setup.sh index ada72c7..1633cda 100755 --- a/1-setup.sh +++ b/1-setup.sh @@ -1,45 +1,59 @@ #!/usr/bin/env bash -#------------------------------------------------------------------------- -# █████╗ ██████╗ ██████╗██╗ ██╗████████╗██╗████████╗██╗ ██╗███████╗ -# ██╔══██╗██╔══██╗██╔════╝██║ ██║╚══██╔══╝██║╚══██╔══╝██║ ██║██╔════╝ -# ███████║██████╔╝██║ ███████║ ██║ ██║ ██║ ██║ ██║███████╗ -# ██╔══██║██╔══██╗██║ ██╔══██║ ██║ ██║ ██║ ██║ ██║╚════██║ -# ██║ ██║██║ ██║╚██████╗██║ ██║ ██║ ██║ ██║ ╚██████╔╝███████║ -# ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝ -#------------------------------------------------------------------------- -echo "--------------------------------------" -echo "-- Network Setup --" -echo "--------------------------------------" +echo -ne " +------------------------------------------------------------------------- + █████╗ ██████╗ ██████╗██╗ ██╗████████╗██╗████████╗██╗ ██╗███████╗ + ██╔══██╗██╔══██╗██╔════╝██║ ██║╚══██╔══╝██║╚══██╔══╝██║ ██║██╔════╝ + ███████║██████╔╝██║ ███████║ ██║ ██║ ██║ ██║ ██║███████╗ + ██╔══██║██╔══██╗██║ ██╔══██║ ██║ ██║ ██║ ██║ ██║╚════██║ + ██║ ██║██║ ██║╚██████╗██║ ██║ ██║ ██║ ██║ ╚██████╔╝███████║ + ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝ +------------------------------------------------------------------------- + Automated Arch Linux Installer +------------------------------------------------------------------------- +" +source setup.conf +echo -ne " +------------------------------------------------------------------------- + Network Setup +------------------------------------------------------------------------- +" pacman -S networkmanager dhclient --noconfirm --needed systemctl enable --now NetworkManager -echo "-------------------------------------------------" -echo "Setting up mirrors for optimal download " -echo "-------------------------------------------------" +echo -ne " +------------------------------------------------------------------------- + Setting up mirrors for optimal download +------------------------------------------------------------------------- +" pacman -S --noconfirm pacman-contrib curl pacman -S --noconfirm reflector rsync cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak nc=$(grep -c ^processor /proc/cpuinfo) -echo "You have " $nc" cores." -echo "-------------------------------------------------" -echo "Changing the makeflags for "$nc" cores." +echo -ne " +------------------------------------------------------------------------- + You have " $nc" cores. And + changing the makeflags for "$nc" cores. Aswell as + changing the compression settings. +------------------------------------------------------------------------- +" TOTALMEM=$(cat /proc/meminfo | grep -i 'memtotal' | grep -o '[[:digit:]]*') if [[ $TOTALMEM -gt 8000000 ]]; then sed -i "s/#MAKEFLAGS=\"-j2\"/MAKEFLAGS=\"-j$nc\"/g" /etc/makepkg.conf -echo "Changing the compression settings for "$nc" cores." sed -i "s/COMPRESSXZ=(xz -c -z -)/COMPRESSXZ=(xz -c -T $nc -z -)/g" /etc/makepkg.conf fi -echo "-------------------------------------------------" -echo " Setup Language to US and set locale " -echo "-------------------------------------------------" +echo -ne " +------------------------------------------------------------------------- + Setup Language to US and set locale +------------------------------------------------------------------------- +" sed -i 's/^#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen locale-gen -timedatectl --no-ask-password set-timezone America/Chicago +timedatectl --no-ask-password set-timezone ${timezone} timedatectl --no-ask-password set-ntp 1 localectl --no-ask-password set-locale LANG="en_US.UTF-8" LC_TIME="en_US.UTF-8" # Set keymaps -localectl --no-ask-password set-keymap us +localectl --no-ask-password set-keymap ${keymap} # Add sudo no password rights sed -i 's/^# %wheel ALL=(ALL) NOPASSWD: ALL/%wheel ALL=(ALL) NOPASSWD: ALL/' /etc/sudoers @@ -50,14 +64,18 @@ sed -i 's/^#Para/Para/' /etc/pacman.conf #Enable multilib sed -i "/\[multilib\]/,/Include/"'s/^#//' /etc/pacman.conf pacman -Sy --noconfirm - -echo -e "\nInstalling Base System\n" - +echo -ne " +------------------------------------------------------------------------- + Installing Base System +------------------------------------------------------------------------- +" sudo pacman -S --noconfirm --needed - < /pkg-files/pacman-pkgs.txt - -# +echo -ne " +------------------------------------------------------------------------- + Installing Microcode +------------------------------------------------------------------------- +" # determine processor type and install microcode -# proc_type=$(lscpu | awk '/Vendor ID:/ {print $3}') case "$proc_type" in GenuineIntel) @@ -70,8 +88,12 @@ case "$proc_type" in pacman -S --noconfirm amd-ucode proc_ucode=amd-ucode.img ;; -esac - +esac +echo -ne " +------------------------------------------------------------------------- + Installing Graphics Drivers +------------------------------------------------------------------------- +" # Graphics Drivers find and install if lspci | grep -E "NVIDIA|GeForce"; then pacman -S nvidia --noconfirm --needed @@ -81,21 +103,31 @@ elif lspci | grep -E "Radeon"; then elif lspci | grep -E "Integrated Graphics Controller"; then pacman -S libva-intel-driver libvdpau-va-gl lib32-vulkan-intel vulkan-intel libva-intel-driver libva-utils --needed --noconfirm fi - -echo -e "\nDone!\n" -if ! source install.conf; then - read -p "Please enter username:" username -echo "username=$username" >> ${HOME}/$SCRIPTHOME/install.conf -fi -if [ $(whoami) = "root" ]; -then +echo -ne " +------------------------------------------------------------------------- + Adding User +------------------------------------------------------------------------- +" +if [ $(whoami) = "root" ]; then useradd -m -G wheel,libvirt -s /bin/bash $username - passwd $username +# use chpasswd to enter $username:$password + echo "$username:$password" | chpasswd cp -R /root/$SCRIPTHOME /home/$username/ chown -R $username: /home/$username/$SCRIPTHOME - read -p "Please name your machine:" nameofmachine - echo $nameofmachine > /etc/hostname +# enter $hostname to /etc/hostname + echo $hostname > /etc/hostname else echo "You are already a user proceed with aur installs" fi - +if [[ ${FS} == "luks" ]]; then +# Making sure to edit mkinitcpio conf if luks is selected +# add encrypt in mkinitcpio.conf before filesystems in hooks + sed -i 's/filesystems/encrypt filesystems/g' /etc/mkinitcpio.conf +# making mkinitcpio with linux kernel + mkinitcpio -p linux +fi +echo -ne " +------------------------------------------------------------------------- + SYSTEM READY FOR 2-user.sh +------------------------------------------------------------------------- +" \ No newline at end of file diff --git a/2-user.sh b/2-user.sh index 7a32541..f583586 100755 --- a/2-user.sh +++ b/2-user.sh @@ -1,17 +1,20 @@ #!/usr/bin/env bash -#------------------------------------------------------------------------- -# █████╗ ██████╗ ██████╗██╗ ██╗████████╗██╗████████╗██╗ ██╗███████╗ -# ██╔══██╗██╔══██╗██╔════╝██║ ██║╚══██╔══╝██║╚══██╔══╝██║ ██║██╔════╝ -# ███████║██████╔╝██║ ███████║ ██║ ██║ ██║ ██║ ██║███████╗ -# ██╔══██║██╔══██╗██║ ██╔══██║ ██║ ██║ ██║ ██║ ██║╚════██║ -# ██║ ██║██║ ██║╚██████╗██║ ██║ ██║ ██║ ██║ ╚██████╔╝███████║ -# ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝ -#------------------------------------------------------------------------- +echo -ne " +------------------------------------------------------------------------- + █████╗ ██████╗ ██████╗██╗ ██╗████████╗██╗████████╗██╗ ██╗███████╗ + ██╔══██╗██╔══██╗██╔════╝██║ ██║╚══██╔══╝██║╚══██╔══╝██║ ██║██╔════╝ + ███████║██████╔╝██║ ███████║ ██║ ██║ ██║ ██║ ██║███████╗ + ██╔══██║██╔══██╗██║ ██╔══██║ ██║ ██║ ██║ ██║ ██║╚════██║ + ██║ ██║██║ ██║╚██████╗██║ ██║ ██║ ██║ ██║ ╚██████╔╝███████║ + ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝ +------------------------------------------------------------------------- + Automated Arch Linux Installer +------------------------------------------------------------------------- -echo -e "\nINSTALLING AUR SOFTWARE\n" +Installing AUR Softwares +" # You can solve users running this script as root with this and then doing the same for the next for statement. However I will leave this up to you. -echo "CLONING: YAY" cd ~ git clone "https://aur.archlinux.org/yay.git" cd ${HOME}/yay @@ -31,5 +34,9 @@ konsave -i $HOME/$SCRIPTHOME/kde.knsv sleep 1 konsave -a kde -echo -e "\nDone!\n" +echo -ne " +------------------------------------------------------------------------- + SYSTEM READY FOR 3-post-setup.sh +------------------------------------------------------------------------- +" exit diff --git a/3-post-setup.sh b/3-post-setup.sh index c230620..f90f9c9 100755 --- a/3-post-setup.sh +++ b/3-post-setup.sh @@ -1,36 +1,45 @@ #!/usr/bin/env bash -#------------------------------------------------------------------------- -# █████╗ ██████╗ ██████╗██╗ ██╗████████╗██╗████████╗██╗ ██╗███████╗ -# ██╔══██╗██╔══██╗██╔════╝██║ ██║╚══██╔══╝██║╚══██╔══╝██║ ██║██╔════╝ -# ███████║██████╔╝██║ ███████║ ██║ ██║ ██║ ██║ ██║███████╗ -# ██╔══██║██╔══██╗██║ ██╔══██║ ██║ ██║ ██║ ██║ ██║╚════██║ -# ██║ ██║██║ ██║╚██████╗██║ ██║ ██║ ██║ ██║ ╚██████╔╝███████║ -# ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝ -#------------------------------------------------------------------------- +echo -ne " +------------------------------------------------------------------------- + █████╗ ██████╗ ██████╗██╗ ██╗████████╗██╗████████╗██╗ ██╗███████╗ + ██╔══██╗██╔══██╗██╔════╝██║ ██║╚══██╔══╝██║╚══██╔══╝██║ ██║██╔════╝ + ███████║██████╔╝██║ ███████║ ██║ ██║ ██║ ██║ ██║███████╗ + ██╔══██║██╔══██╗██║ ██╔══██║ ██║ ██║ ██║ ██║ ██║╚════██║ + ██║ ██║██║ ██║╚██████╗██║ ██║ ██║ ██║ ██║ ╚██████╔╝███████║ + ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝ +------------------------------------------------------------------------- + Automated Arch Linux Installer +------------------------------------------------------------------------- -echo -e "\nFINAL SETUP AND CONFIGURATION" -echo "--------------------------------------" -echo "-- GRUB EFI Bootloader Install&Check--" -echo "--------------------------------------" +Final Setup and Configurations +GRUB EFI Bootloader Install & Check +" if [[ -d "/sys/firmware/efi" ]]; then grub-install --efi-directory=/boot ${DISK} fi grub-mkconfig -o /boot/grub/grub.cfg -# ------------------------------------------------------------------------ - -echo -e "\nEnabling Login Display Manager" +echo -ne " +------------------------------------------------------------------------- + Enabling Login Display Manager +------------------------------------------------------------------------- +" systemctl enable sddm.service -echo -e "\nSetup SDDM Theme" +echo -ne " +------------------------------------------------------------------------- + Setting up SDDM Theme +------------------------------------------------------------------------- +" cat < /etc/sddm.conf [Theme] Current=Nordic EOF -# ------------------------------------------------------------------------ - -echo -e "\nEnabling essential services" - +echo -ne " +------------------------------------------------------------------------- + Enabling Essential Services +------------------------------------------------------------------------- +" systemctl enable cups.service ntpd -qg systemctl enable ntpd.service @@ -38,10 +47,10 @@ systemctl disable dhcpcd.service systemctl stop dhcpcd.service systemctl enable NetworkManager.service systemctl enable bluetooth -echo " -############################################################################### -# Cleaning -############################################################################### +echo -ne " +------------------------------------------------------------------------- + Cleaning +------------------------------------------------------------------------- " # Remove no password sudo rights sed -i 's/^%wheel ALL=(ALL) NOPASSWD: ALL/# %wheel ALL=(ALL) NOPASSWD: ALL/' /etc/sudoers diff --git a/archtitus.sh b/archtitus.sh index c981a50..c6e09e4 100755 --- a/archtitus.sh +++ b/archtitus.sh @@ -2,16 +2,37 @@ # Find the name of the folder the scripts are in export SCRIPTHOME="$(basename -- $PWD)" -echo "Scripts are in dir named $SCRIPTHOME" - +echo -ne " +------------------------------------------------------------------------- + █████╗ ██████╗ ██████╗██╗ ██╗████████╗██╗████████╗██╗ ██╗███████╗ + ██╔══██╗██╔══██╗██╔════╝██║ ██║╚══██╔══╝██║╚══██╔══╝██║ ██║██╔════╝ + ███████║██████╔╝██║ ███████║ ██║ ██║ ██║ ██║ ██║███████╗ + ██╔══██║██╔══██╗██║ ██╔══██║ ██║ ██║ ██║ ██║ ██║╚════██║ + ██║ ██║██║ ██║╚██████╗██║ ██║ ██║ ██║ ██║ ╚██████╔╝███████║ + ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝ +------------------------------------------------------------------------- + Automated Arch Linux Installer +------------------------------------------------------------------------- + Scripts are in directory named $SCRIPTHOME +" + bash startup.sh + source setup.conf bash 0-preinstall.sh arch-chroot /mnt /root/$SCRIPTHOME/1-setup.sh source /mnt/root/$SCRIPTHOME/install.conf arch-chroot /mnt /usr/bin/runuser -u $username -- /home/$username/$SCRIPTHOME/2-user.sh arch-chroot /mnt /root/$SCRIPTHOME/3-post-setup.sh -echo " -############################################################################### -# Done - Please Eject Install Media and Reboot -############################################################################### +echo -ne " +------------------------------------------------------------------------- + █████╗ ██████╗ ██████╗██╗ ██╗████████╗██╗████████╗██╗ ██╗███████╗ + ██╔══██╗██╔══██╗██╔════╝██║ ██║╚══██╔══╝██║╚══██╔══╝██║ ██║██╔════╝ + ███████║██████╔╝██║ ███████║ ██║ ██║ ██║ ██║ ██║███████╗ + ██╔══██║██╔══██╗██║ ██╔══██║ ██║ ██║ ██║ ██║ ██║╚════██║ + ██║ ██║██║ ██║╚██████╗██║ ██║ ██║ ██║ ██║ ╚██████╔╝███████║ + ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝ +------------------------------------------------------------------------- + Automated Arch Linux Installer +------------------------------------------------------------------------- + Done - Please Eject Install Media and Reboot " \ No newline at end of file diff --git a/startup.sh b/startup.sh new file mode 100644 index 0000000..bc5f0c9 --- /dev/null +++ b/startup.sh @@ -0,0 +1,133 @@ +#!/usr/bin/env bash +# This script will ask users about their prefrences like disk, file system, +logo () { +# This will be shown on every set as user is progressing +echo -ne " +------------------------------------------------------------------------- + █████╗ ██████╗ ██████╗██╗ ██╗████████╗██╗████████╗██╗ ██╗███████╗ +██╔══██╗██╔══██╗██╔════╝██║ ██║╚══██╔══╝██║╚══██╔══╝██║ ██║██╔════╝ +███████║██████╔╝██║ ███████║ ██║ ██║ ██║ ██║ ██║███████╗ +██╔══██║██╔══██╗██║ ██╔══██║ ██║ ██║ ██║ ██║ ██║╚════██║ +██║ ██║██║ ██║╚██████╗██║ ██║ ██║ ██║ ██║ ╚██████╔╝███████║ +╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝ +------------------------------------------------------------------------ + Please select presetup settings for your system +------------------------------------------------------------------------ +" +} +filesystem () { +# This function will handle file systems. At this movement we are handling only +# btrfs and ext4. Others will be added in future. +echo -ne " + Please Select your file system for both boot and root + 1) btrfs + 2) ext4 + 3) luks with btrfs + 0) exit +" +read FS +case $FS in +1) echo "FS=btrfs" >> setup.conf;; +2) echo "FS=ext4" >> setup.conf;; +3) +echo -ne "Please enter your luks password: " +read luks_password +echo "luks_password=$luks_password" >> setup.conf +echo "FS=luks" >> setup.conf;; +0) exit ;; +*) echo "Wrong option please select again"; filesystem;; +esac +} +timezone () { +# Added this from arch wiki https://wiki.archlinux.org/title/System_time +time_zone="$(curl --fail https://ipapi.co/timezone)" +echo -ne "System detected your timezone to be '$time_zone'" +echo -ne "Is this correct? yes/no:" +read answer +case $answer in + y|Y|yes|Yes|YES) + echo "timezone=$time_zone" >> setup.conf;; + n|N|no|NO|No) + echo "Please enter your desired timezone e.g. Europe/London :" + read new_timezone + echo "timezone=$new_timezone" >> setup.conf;; + *) echo "Wrong option. Try again";timezone;; +esac +} +keymap () { +# These are default key maps as presented in official arch repo archinstall +echo -ne " +Please select key board layout from this list + -by + -ca + -cf + -cz + -de + -dk + -es + -et + -fa + -fi + -fr + -gr + -hu + -il + -it + -lt + -lv + -mk + -nl + -no + -pl + -ro + -ru + -sg + -ua + -uk + -us + +" +read -p "Your key boards layout:" keymap +echo "keymap=$keymap" >> setup.conf +} +diskpart () { +lsblk +echo -ne " +------------------------------------------------------------------------ + THIS WILL FORMAT AND DELETE ALL DATA ON THE DISK + Please make sure you know what you are doing because + after formating your disk there is no way to get data back +------------------------------------------------------------------------ + +Please enter disk to work on: (example /dev/sda): +" +read option +echo "DISK=$option" >> setup.conf +} +userinfo () { +echo -ne "Please enter username: " +read username +echo "username=$username" >> setup.conf +echo -ne "Please enter your password: " +read password +echo "password=$password" >> setup.conf +echo -ne "Please enter your hostname: " +read hostname +echo "hostname=$hostname" >> setup.conf +} +# More features in future +# language (){} +rm -rf setup.conf &>/dev/null +userinfo +clear +logo +diskpart +clear +logo +filesystem +clear +logo +timezone +clear +logo +keymap \ No newline at end of file