This repository contains installation and setup scripts for my custom arch linux based linux distribution
This repository have 3 scripts.
- arch-install.sh will guide through disk partitioning and install
base
linux
kernellinux-headers
and some other packages on the OS. Following additional packages are installed after this scriptopendoas
: for super user access (sudo alternative)neovim
: basic command line text editornetworkmanager
: for managing networks (duh??)zsh
: I like colors when I type. Bash was not enoughgit
: Arjuna had Gandeev, I must have git.sed
andrsync
: GNU guys already shipped one, andcp
don’t have enough optionsgrub efibootmgr os-prober
: well, the system have to turn on.
- configuration-script.sh will handle the most boring and time consuming part of arch installation. It will set locale, timezone (hardcoded to Asia/Kolkata) and hostname. It will also guide you through user creation and passwords and install grub bootloader. Script will terminate after this step, and you will be left with a clean arch install (except for the packages stated earlier).
- kvos-setup.sh will install my personal customized i3wm setup. Some of the included things are:
Alacritty
as my terminal emulatorzsh
as user shell with customized starship promptFirefox
as default web browserranger
for terminal based andpcmanfm-qt
as gui file browsergeany
as gui text editor andneovim
as terminal text editor.emacs
can be installed too. Custom doom emacs configuration is there in\~/.config/doom
directory.- Papirus icon set and materia dark as gtk and qt theme.
- Download an Arch Linux ISO and write it to a USB
- Boot from the live USB and connect to the internet
- From the command line execute following command
bash <(curl -s https://kanishakvaidya.github.io/arch-install.sh)
- This will execute the arch-install.sh script
- This will guide you through base arch install.
- After completion,
poweroff
your machine, remove bootable USB and turn on you PC. - Congratulations, You’ve installed Arch BTW!
- On this installation or on any existing arch based install you run the kvos-setup.sh script in the home folder for my custom i3wm desktop. You can download and run this script using the following command from the shell:
bash <(curl -s https://kanishakvaidya.github.io/kvos-setup.sh)
#!/bin/bash
clear
install_text='
/$$$$$$ /$$
/$$__ $$ | $$
| $$ \ $$ /$$$$$$ /$$$$$$$| $$$$$$$
| $$$$$$$$ /$$__ $$ /$$_____/| $$__ $$
| $$__ $$| $$ \__/| $$ | $$ \ $$
| $$ | $$| $$ | $$ | $$ | $$
| $$ | $$| $$ | $$$$$$$| $$ | $$
|__/ |__/|__/ \_______/|__/ |__/
/$$$$$$ /$$ /$$ /$$
|_ $$_/ | $$ | $$| $$
| $$ /$$$$$$$ /$$$$$$$ /$$$$$$ /$$$$$$ | $$| $$
| $$ | $$__ $$ /$$_____/|_ $$_/ |____ $$| $$| $$
| $$ | $$ \ $$| $$$$$$ | $$ /$$$$$$$| $$| $$
| $$ | $$ | $$ \____ $$ | $$ /$$ /$$__ $$| $$| $$
/$$$$$$| $$ | $$ /$$$$$$$/ | $$$$/| $$$$$$$| $$| $$
|______/|__/ |__/|_______/ \___/ \_______/|__/|__/
/$$$$$$ /$$ /$$
/$$__ $$ |__/ | $$
| $$ \__/ /$$$$$$$ /$$$$$$ /$$ /$$$$$$ /$$$$$$ /$$$$$$$
| $$$$$$ /$$_____/ /$$__ $$| $$ /$$__ $$|_ $$_/ /$$_____/
\____ $$| $$ | $$ \__/| $$| $$ \ $$ | $$ | $$$$$$
/$$ \ $$| $$ | $$ | $$| $$ | $$ | $$ /$$\____ $$
| $$$$$$/| $$$$$$$| $$ | $$| $$$$$$$/ | $$$$//$$$$$$$/
\______/ \_______/|__/ |__/| $$____/ \___/ |_______/
| $$
| $$
|__/
==================================================================
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
==================================================================
'
echo "$install_text"
sed -i "s/^#ParallelDownloads = 5$/ParallelDownloads = 5/" /etc/pacman.conf
while ! pacman -Sy archlinux-keyring
do
read -p "Can't update archlinux-keyring. Please rectify and the continue [ENTER]"
done
loadkeys us
timedatectl set-ntp true
pkgs="base linux linux-firmware linux-headers neovim opendoas networkmanager fzf "
A good partitioning scheme is as follows:
Mount point | Partition | Partition type | Size of partition |
---|---|---|---|
/mnt/boot | /dev/sda1 | EFI syste partition | 512 MB |
[SWAP] | /dev/sda2 | Linux swap | 2x RAM |
mnt | /dev/sda3 | Linux x86_64 root () | Rest of device |
curl -fLo /tmp/configuration-script.sh https://kanishakvaidya.github.io/arch-kvos/static/scripts/configuration-script.sh
clear
echo "$install_text"
echo "Do you want to install grub bootloader?"
select yn in "Yes, install grub" "No, don't install grub"
do
case $yn in
"Yes, install grub" )
grubanswer="y"
pkgs+="grub os-prober "
if [ -d /sys/firmware/efi ]
then
pkgs+="efibootmgr "
bios="UEFI"
echo "You have an $bios system"
echo "You have to create an EFI system partition"
echo "Create a swap partition if you want one"
read -p "press enter to continue "
else
bios="BIOS"
echo "You have a $bios system."
echo "Create a bios boot partition for GPT. No need for separate boot partition for MBR"
echo "Create a swap partition if you want one"
read -p "press enter to continue "
fi
break
;;
"No, don't install grub" )
grubanswer="n"
break
;;
* ) echo "Please enter either 1 or 2" ;;
esac
done
clear
echo "$install_text"
lsblk
echo -e "\n"
read -p "Enter the drive (e.g. /dev/sda or /dev/nvme0n1): " drive
cfdisk $drive
clear
echo "$install_text"
lsblk
echo -e "\n"
read -p "Enter the root partition (e.g. /dev/sda2 or /dev/nvme0n1p2): " partition
mkfs.ext4 $partition
mount $partition /mnt
clear
echo "$install_text"
if [[ $grubanswer == "y" ]]
then
if [[ $bios == "UEFI" ]]
then
lsblk
echo -e "\n"
read -p "Enter EFI partition (e.g. /dev/sda1 or /dev/nvme0n1p1): " efipartition
mkfs.fat -F 32 $efipartition
mount --mkdir $efipartition /mnt/boot
fi
sed --expression "2s|^|grubanswer=$grubanswer\nbios=$bios\ndrive=$drive\n|" /tmp/configuration-script.sh > /mnt/configuration-script.sh
else
sed --expression "2s|^|grubanswer=$grubanswer\nbios=\"not installing\"\ndrive=$drive\n|" /tmp/configuration-script.sh > /mnt/configuration-script.sh
fi
clear
echo "$install_text"
read -p "Are you setting a swap partition? [y/n]: " swpanswer
if [[ $swpanswer = y ]] ; then
lsblk
echo -e "\n"
read -p "Enter swap partition (e.g. /dev/sda3 or /dev/nvme0n1p3): " swap_partition
mkswap $swap_partition
swapon $swap_partition
fi
Installing
- base linux system
- doas for root access
- nvim text editor
- a network manager
- git
clear
echo "$install_text"
while ! pacstrap /mnt $(echo $pkgs)
do
read -p "There were some errors installing packages. Please rectify them [ENTER to continue] "
done
clear
echo "$install_text"
echo -e "\n Generating fstab..."
genfstab -U /mnt >> /mnt/etc/fstab
echo -e "copying configuration script..."
chmod +x /mnt/configuration-script.sh
arch-chroot /mnt ./configuration-script.sh
[[ $bios == "UEFI" ]] && umount /mnt/boot
umount /mnt
This should be run after chrooting into the arch system
#!/bin/bash
config_text='
/$$$$$$ /$$ /$$$$$$ /$$$$$$ /$$
/$$__ $$ | $$ /$$__ $$ /$$__ $$|__/
| $$ \__/ /$$ /$$ /$$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$/$$$$ | $$ \__/ /$$$$$$ /$$$$$$$ | $$ \__/ /$$ /$$$$$$
| $$$$$$ | $$ | $$ /$$_____/|_ $$_/ /$$__ $$| $$_ $$_ $$ | $$ /$$__ $$| $$__ $$| $$$$ | $$ /$$__ $$
\____ $$| $$ | $$| $$$$$$ | $$ | $$$$$$$$| $$ \ $$ \ $$ | $$ | $$ \ $$| $$ \ $$| $$_/ | $$| $$ \ $$
/$$ \ $$| $$ | $$ \____ $$ | $$ /$$| $$_____/| $$ | $$ | $$ | $$ $$| $$ | $$| $$ | $$| $$ | $$| $$ | $$
| $$$$$$/| $$$$$$$ /$$$$$$$/ | $$$$/| $$$$$$$| $$ | $$ | $$ | $$$$$$/| $$$$$$/| $$ | $$| $$ | $$| $$$$$$$
\______/ \____ $$|_______/ \___/ \_______/|__/ |__/ |__/ \______/ \______/ |__/ |__/|__/ |__/ \____ $$
/$$ | $$ /$$ \ $$
| $$$$$$/ | $$$$$$/
\______/ \______/
=============================================================================================================================
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
=============================================================================================================================
'
clear
echo "$config_text"
reg=$(ls /usr/share/zoneinfo | fzf --prompt "Setting time zone. Choose region: ")
if [ -f /usr/share/zoneinfo/$reg ]
then
ln -sf /usr/share/zoneinfo/$reg /etc/localtime
else
city=$(ls /usr/share/zoneinfo/$reg | fzf --prompt "Setting time zone. Choose City: ")
ln -sf /usr/share/zoneinfo/$reg/$city /etc/localtime
fi
hwclock --systohc
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
read -p "Hostname: " hostname
echo $hostname > /etc/hostname
echo "127.0.0.1 localhost" >> /etc/hosts
echo "::1 localhost" >> /etc/hosts
echo "127.0.1.1 $hostname.localdomain $hostname" >> /etc/hosts
mkdir -p /etc/X11/xorg.conf.d/
echo 'Section "InputClass"' > /etc/X11/xorg.conf.d/30-touchpad.conf
echo ' Identifier "touchpad"' >> /etc/X11/xorg.conf.d/30-touchpad.conf
echo ' Driver "libinput"' >> /etc/X11/xorg.conf.d/30-touchpad.conf
echo ' MatchIsTouchpad "on"' >> /etc/X11/xorg.conf.d/30-touchpad.conf
echo ' Option "Tapping" "on"' >> /etc/X11/xorg.conf.d/30-touchpad.conf
echo ' Option "ScrollMethod" "twofinger"' >> /etc/X11/xorg.conf.d/30-touchpad.conf
echo ' Option "NaturalScrolling" "true"' >> /etc/X11/xorg.conf.d/30-touchpad.conf
echo 'EndSection' >> /etc/X11/xorg.conf.d/30-touchpad.conf
clear
echo "$config_text"
echo -e "Setting Root Password \n"
passwd
echo -e "\n Setting up a user...\n"
read -p "Enter a username: " username
useradd -m -G audio,video,storage,optical,wheel $username
passwd $username
echo "permit persist $username as root" > /etc/doas.conf
echo "setting a link to doas"
ln -sf /bin/doas /bin/sudo
sed -i "s/^#ParallelDownloads = 5$/ParallelDownloads = 5/" /etc/pacman.conf
if [[ $grubanswer == "y" ]] ; then
echo "Setting up GRUB"
case $bios in
UEFI ) grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=myArch ;;
BIOS ) grub-install --target=i386-pc $drive ;;
esac
grub-mkconfig -o /boot/grub/grub.cfg
fi
systemctl enable NetworkManager.service
exit
For KVOS installation, following packages will be installed:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Put an X in between [ ] to download said packages %
% You can also remove packages or add by appending %
% package names to a line in a [X] section %
% Then save the file and exit %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- [X] Base
alacritty arandr autoconf automake base bat bison blueman conky dunst efibootmgr eza fakeroot feh firefox flameshot flex fzf gcc geany git gvfs gvfs-mtp htop i3-wm i3blocks i3lock jack2 kvantum kvos-wallpapers libtool lxappearance-gtk3 lxqt-archiver lxqt-policykit lxsession-gtk3 m4 make man-db materia-gtk-theme neovim networkmanager network-manager-applet nodejs ntfs-3g otf-font-awesome patch pavucontrol-qt pcmanfm-qt picom pkgconf pulseaudio pulseaudio-alsa pulseaudio-bluetooth qt5ct ranger ripgrep rofi rsync sed smplayer smplayer-skins smplayer-themes sshfs starship ttf-dejavu ttf-hack ttf-indic-otf ttf-nerd-fonts-symbols udiskie unzip vte3 which xclip xcolor xdg-user-dirs yarn zathura zathura-pdf-mupdf zip zsh zsh-autosuggestions zsh-completions zsh-syntax-highlighting
- [ ] Utilities
imagemagick rclone vlc v4l2loopback-dkms v4l2loopback-utils w3m xournalpp youtube-dl xf86-input-wacom
- [X] Xorg
xorg xorg-xinit
- [ ] amd-drivers
amd-ucode mesa xf86-video-amdgpu
- [ ] intel-drivers
intel-ucode mesa xf86-video-intel
- [ ] nvidia drivers
nvidia nvidia-prime nvidia-utils nvtop
- [ ] Office suit (remove unwanted packages)
libreoffice-fresh
- [ ] Development
emacs pyright python-pip
- [ ] TeX/LaTeX
texlive-most
This is the KVOS installation script
#!/bin/bash
dotfile_text='
/$$ /$$ /$$ /$$ /$$$$$$ /$$$$$$ /$$$$$$ /$$ /$$ /$$
| $$ /$$/| $$ | $$ /$$__ $$ /$$__ $$ |_ $$_/ | $$ | $$| $$
| $$ /$$/ | $$ | $$| $$ \ $$| $$ \__/ | $$ /$$$$$$$ /$$$$$$$ /$$$$$$ /$$$$$$ | $$| $$ /$$$$$$ /$$$$$$
| $$$$$/ | $$ / $$/| $$ | $$| $$$$$$ | $$ | $$__ $$ /$$_____/|_ $$_/ |____ $$| $$| $$ /$$__ $$ /$$__ $$
| $$ $$ \ $$ $$/ | $$ | $$ \____ $$ | $$ | $$ \ $$| $$$$$$ | $$ /$$$$$$$| $$| $$| $$$$$$$$| $$ \__/
| $$\ $$ \ $$$/ | $$ | $$ /$$ \ $$ | $$ | $$ | $$ \____ $$ | $$ /$$ /$$__ $$| $$| $$| $$_____/| $$
| $$ \ $$ \ $/ | $$$$$$/| $$$$$$/ /$$$$$$| $$ | $$ /$$$$$$$/ | $$$$/| $$$$$$$| $$| $$| $$$$$$$| $$
|__/ \__/ \_/ \______/ \______/ |______/|__/ |__/|_______/ \___/ \_______/|__/|__/ \_______/|__/
=============================================================================================================================
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
=============================================================================================================================
'
clear
echo "$dotfile_text"
echo "Please grant root priveliges to $USER"
grep kv-arch-repo /etc/pacman.conf > /dev/null || echo "
[kv-arch-repo]
SigLevel = Optional TrustAll
Server = https://kanishakvaidya.github.io/\$repo/\$arch" | sudo tee -a /etc/pacman.conf
curl -fLo /tmp/packages.md https://kanishakvaidya.github.io/arch-kvos/static/scripts/packages.md
while ! ( nvim /tmp/packages.md || vim /tmp/packages.md || micro /tmp/packages.md || nano /tmp/packages.md || vi /tmp/packages.md || $EDITOR /tmp/packages.md || $VISUAL /tmp/packages.md )
do
echo "No text editor found. Installing nano now. Suffer. Atleast set an EDITOR from now"
sudo pacman -Syu --noconfirm nano
done
sudo sed -i "s/^#ParallelDownloads = 5$/ParallelDownloads = 5/" /etc/pacman.conf
while ! sudo pacman -Syu --needed --noconfirm $(awk '/\- \[X\]/ {getline ; print}' /tmp/packages.md | tr "\n" " " )
do
read -p "Some errors occured while installing packages. Rectify them and press ENTER to continue."
done
echo 'export ZDOTDIR="$HOME"/.config/zsh' | sudo tee /etc/zsh/zshenv
chsh -s /usr/bin/zsh
Managing dotfiles using a git bare repository is referenced from this Anand Iyer’s blog
#!/bin/bash
[[ -d $HOME/Desktop ]] && mv $HOME/Desktop $HOME/desktop || mkdir -p $HOME/desktop
[[ -d $HOME/Downloads ]] && mv $HOME/Downloads $HOME/dwn || mkdir -p $HOME/dwn
[[ -d $HOME/Templates ]] && mv $HOME/Templates $HOME/templates || mkdir -p $HOME/templates
[[ -d $HOME/Public ]] && mv $HOME/Public $HOME/shared || mkdir -p $HOME/shared
[[ -d $HOME/Documents ]] && mv $HOME/Documents $HOME/doc || mkdir -p $HOME/doc
[[ -d $HOME/Music ]] && mv $HOME/Music $HOME/music || mkdir -p $HOME/music
[[ -d $HOME/Pictures ]] && mv $HOME/Pictures $HOME/pic || mkdir -p $HOME/pic
[[ -d $HOME/Videos ]] && mv $HOME/Videos $HOME/vid || mkdir -p $HOME/vid
mkdir -p $HOME/.local/state/zsh $HOME/.local/share $HOME/.local/bin $HOME/.local/share/icons/ $HOME/.config $HOME/.local/share/AppImages $HOME/.local/share/fonts
git clone --depth=1 --separate-git-dir=$HOME/.config/my_dotfiles https://github.com/KanishakVaidya/dotfiles.git /tmp/tmpdotfiles
rsync --recursive --verbose --exclude '.git' /tmp/tmpdotfiles/ $HOME/
clear ; echo "$dotfile_text"
xdg-user-dirs-update
fc-cache -fv
# git clone --depth=1 https://github.com/KanishakVaidya/wallpapers.git $HOME/pic/.wall
echo "setting a link to xresources"
ln -sf $HOME/.config/Xresources/codedark $HOME/.Xresources
Installing papirus icons and materia dark theme
git clone --depth=1 https://github.com/PapirusDevelopmentTeam/papirus-icon-theme.git /tmp/papirus-icons
cp -r /tmp/papirus-icons/Papirus* $HOME/.local/share/icons/
sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
nvim -c PlugInstall -c qa
clear
git clone https://aur.archlinux.org/paru-bin.git /tmp/paru-bin
(cd /tmp/paru-bin ; makepkg -si)
echo '
/$$ /$$ /$$ /$$ /$$$$$$
| $$ | $$ | $$ | $$ /$$__ $$
| $$ | $$ /$$$$$$ /$$$$$$$ /$$$$$$ /$$$$$$ | $$ | $$ \ $$
| $$$$$$$$ |____ $$ /$$_____/|_ $$_/ |____ $$ | $$ | $$$$$$$$
| $$__ $$ /$$$$$$$| $$$$$$ | $$ /$$$$$$$ | $$ | $$__ $$
| $$ | $$ /$$__ $$ \____ $$ | $$ /$$ /$$__ $$ | $$ | $$ | $$
| $$ | $$| $$$$$$$ /$$$$$$$/ | $$$$/| $$$$$$$ | $$$$$$$$| $$ | $$
|__/ |__/ \_______/|_______/ \___/ \_______/ |________/|__/ |__/
/$$ /$$ /$$ /$$ /$$ /$$ /$$$$$$ /$$
| $$ | $$|__/ | $$ | $$ /$$/ /$$$_ $$ /$$$$$$
| $$ | $$ /$$ /$$$$$$$ /$$$$$$ /$$$$$$ | $$ /$$//$$ /$$| $$$$\ $$ /$$__ $$
| $$ / $$/| $$ /$$_____/|_ $$_/ |____ $$ |__/ /$$/| $$ /$$/| $$ $$ $$| $$ \__/
\ $$ $$/ | $$| $$$$$$ | $$ /$$$$$$$ /$$| $$ \ $$/$$/ | $$\ $$$$| $$$$$$
\ $$$/ | $$ \____ $$ | $$ /$$ /$$__ $$ | $$ \ $$ \ $$$/ | $$ \ $$$ \____ $$
\ $/ | $$ /$$$$$$$/ | $$$$/| $$$$$$$ | $$ \ $$ \ $/ | $$$$$$/ /$$ \ $$
\_/ |__/|_______/ \___/ \_______/ |__/ \__/ \_/ \______/ | $$$$$$/
\_ $$_/
\__/
'
exit
Only root can change the brightness by editing files in /sys/class/backlight
. To allow users in the video group to change the brightness, a udev rule such as the following can be used (replace the <vendor> with your vendor id. E.g. amdgpu_bl0 acpi_video0, intel_backlight. Find it using ls /sys/class/backlight
)
pacman -S xf86-input-wacom
This provides xsetwacom command.
First list the wacom devices using the comand
xsetwacom list devices
A sample output is
# Wacom One by Wacom S Pen stylus id: 15 type: STYLUS # Wacom One by Wacom S Pen eraser id: 23 type: ERASER
To map wacom tablet with ID 15 to display named HDMI-1, use following command
xsetwacom --set "15" MapToOutput HDMI-1