Files
archinstallscript/setup
2025-07-09 15:17:09 +00:00

223 lines
6.2 KiB
Bash
Executable File

#!/bin/sh
# == MY ARCH SETUP INSTALLER == #
#part1
# Restoring Terminal Defaults
printf '\033c'
echo "Welcome to Arch Linux installer script!"
# Increasing pacman's download streams to 5
sed -i "s/^#ParallelDownloads = 5$/ParallelDownloads = 5/" /etc/pacman.conf
# Printing out conneted drives and asking which drive to partition and how, then mounting them.
lsblk
echo "Enter the drive you want to install the OS on: "
read drive
cfdisk $drive
echo "Enter the partition for your root: "
read rootpartition
mkfs.ext4 $rootpartition
echo "Enter the partition for your home: "
read homepartition
mkfs.ext4 $homepartition
read -p "Did you also create efi partition? [y/n]" answer
if [[ $answer = y ]] ; then
echo "Enter EFI partition: "
read efipartition
mkfs.fat -F32 $efipartition
fi
mount $rootpartition /mnt
mkdir /mnt/home
mount $homepartition /mnt/home
# Generating fstab file so the system can find our filesystem on reboot
mkdir /mnt/etc
genfstab -U -p /mnt >> /mnt/etc/fstab
# Downloading the core system utilities
pacstrap -i /mnt base
# Generating the second part of the script from the current one and then chrooting into our live installion and executing the new script.
sed '1,/^#part2$/d' `basename $0` > /mnt/arch_install2.sh
chmod +x /mnt/arch_install2.sh
arch-chroot /mnt ./arch_install2.sh
exit
#part2
# Restoring Terminal Defaults
printf '\033c'
# Downloading the kernel base developement and network packages and starting thier services
pacman -S --noconfirm sed linux linux-headers linux-firmware base-devel networkmanager wpa_supplicant wireless_tools netctl dialog
systemctl enable NetworkManager
# Increasing pacman's download streams to 5
sed -i "s/^#ParallelDownloads = 5$/ParallelDownloads = 15/" /etc/pacman.conf
# Enabling multilib support
echo "[multilib]" >> /etc/pacman.conf
echo "Include = /etc/pacman.d/mirrorlist" >> /etc/pacman.conf
# Setting up locales keymap and language settings
ln -sf /usr/share/zoneinfo/Asia/Kolkata /etc/localtime
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
locale-gen
echo "LANG=en_US.UTF-8" > /etc/locale.conf
echo "KEYMAP=us" > /etc/vconsole.conf
# Setting up system name hosts bootloader and the users
echo "Hostname: "
read hostname
echo $hostname > /etc/hostname
echo "127.0.0.1 localhost" >> /etc/hosts
echo "127.0.1.1 $hostname.localdomain $hostname" >> /etc/hosts
mkinitcpio -P
passwd
pacman --noconfirm -Sy grub efibootmgr os-prober dosfstools mtools
echo "Enter EFI partition: "
read efipartition
mkdir /boot/EFI
mount $efipartition /boot/EFI
grub-install --target=x86_64-efi --bootloader-id=grub_uefi --recheck
cp /usr/share/locale/en\@quot/LC_MESSAGES/grub.mo /boot/grub/locale/en.mo
grub-mkconfig -o /boot/grub/grub.cfg
echo "Enter Swap Size: "
read swapsize
mkswap -U clear --size $swapsize --file /swapfile
swapon /swapfile
echo "/swapfile none swap defaults 0 0" >> /etc/fstab
echo "%wheel ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
echo "Enter Username: "
read username
useradd -m -g users -G wheel $username
passwd $username
ai3_path=/home/$username/arch_install3.sh
sed '1,/^#part3$/d' arch_install2.sh > $ai3_path
chown $username:users $ai3_path
chmod +x $ai3_path
# Installing various CPU and GPU drivers
read -p "Are you in a virtual machince? [y/n]" answer
if [[ $answer = y ]] ; then
pacman -Sy virtualbox-guest-utils xf86-video-vmware
exit
fi
read -p "Do you have AMD cpu or Intel CPU? [amd/intel]" answer
if [[ $answer = amd ]] ; then
pacman --noconfirm -Sy amd-ucode
else
pacman --noconfirm -Sy intel-ucode
fi
read -p "Do you have AMD gpu or Nvidia gpu? [amd/nvidia]" answer
if [[ $answer = nvidia ]] ; then
pacman --noconfirm -Sy nvidia lib32-nvidia-utils nvidia-utils
elif [[ $answer = amd ]] ; then
pacman --noconfirm -Sy mesa lib32-mesa vulkan-radeon lib32-vulkan-radeon xf86-video-amdgpu
else
pacman --noconfirm -Sy mesa lib32-mesa vulkan-intel lib32-vulkan-intel xorg-server
fi
echo "Pre-Installation Finish Reboot now"
exit
#part3
# Setting up terminal defaults
printf '\033c'
# Installing programs
sudo pacman -Syu --noconfirm xorg-server xorg-xinit libx11 libxinerama libxft webkit2gtk git xorg-xkill xorg-xrandr autorandr xorg-xsetroot sxiv calcurse mpv ffmpeg fzf python-pywal xclip man flameshot neovim dunst aerc curl ffmpegthumbnailer htop lazygit pavucontrol plocate pipewire pipewire-alsa wireplumber pipewire-pulse pzip rsync openssh starship ttf-terminus-nerd xbindkeys picom reflector yazi qutebrowser
# Making folders for the user
cd $HOME
mkdir -p .local/screenshots
mkdir -p .local/gitrepo
mkdir -p .local/sourcecode
mkdir -p .local/scripts
mkdir -p .local/documents
# Generating Dotfiles
cp /etc/bash.bashrc ~/.bashrc
#######################
########BASHRC#########
#######################
##
## ~/.bashrc
##
#
## If not running interactively, don't do anything
#[[ $- != *i* ]] && return
#PS1='[\u@\h \W]\$ '
#
##Quality of life Changes
#shopt -s autocd
#set -o vi
#
#
##XDG
#export XDG_DATA_HOME=$HOME/.local/share
#export XDG_CONFIG_HOME=$HOME/.config
#export XDG_STATE_HOME=$HOME/.local/state
#export XDG_CACHE_HOME=$HOME/.cache
#
#
##ENVAR
#export GNUPGHOME="$XDG_DATA_HOME"/gnupg
#export LESSHISTFILE="$XDG_STATE_HOME"/lesshistory
#export XAUTHORITY="$XDG_RUNTIME_DIR"/Xauthority
#export CUDA_CACHE_PATH="$XDG_CACHE_HOME"/nv
#export WINEPREFIX="$XDG_DATA_HOME"/wineprefixes/default
#export XINITRC="$XDG_CONFIG_HOME"/X11/xinitrc
#export PATH=~/.local/bin:$PATH
#export EDITOR=nvim
#export TERMINAL=st
#export TERM='xterm-256color'
#
#
##Shortcuts
#alias l='ls -lAh --color=auto'
#alias ls='ls --color=auto'
#alias grep='grep --color=auto'
#alias vim='nvim'
#alias updatesite='rsync -vrP ~/.local/documents/HTML/aroaduntraveled/* root@aroaduntraveled.com:/var/www/aroaduntraveled/'
#alias wget='wget --hsts-file="$XDG_DATA_HOME"/wget-hsts'
#alias xbindkeys='xbindkeys -f "$XDG_CONFIG_HOME"/xbindkeys/config'
#
#eval "$(starship init bash)"
#######################
###HYPRPAPER.CONF######
#######################
#
#
#preload = $HOME/Pictures/Wallpapers/b-001.jpg
#wallpaper = , $HOME/Pictures/Wallpapers/b-001.jpg
#
#
# Downloading wallpapers
cd $HOME
mkdir Pictures/Wallpapers
cd Pictures/Wallpapers
for (( w=1; w<934; w++ )); do curl -LOS "https://raw.githubusercontent.com/whoisYoges/lwalpapers/PicturesOnly/wallpapers/$(printf b-%0.3d.jpg "$w")"; done
exit