--- Prompt Section (collect all user input here) ---
Disk Selection
echo "Available disks:"
lsblk -d -o NAME,SIZE,MODEL
while true; do
read -p "Enter Disk (e.g. sda, nvme0n1): " disk_input
disk="/dev/{disk_input%/}"
if [ ! -b "disk" ]; then
echo "Disk $disk does not exist. Try again."
continue
fi
break
done
Hostname
while true; do
read -p "Hostname: " hostname
[[ -z "$hostname" ]] && echo "Hostname cannot be empty." && continue
break
done
Root Password
while true; do
read -s -p "Root password: " root_password
echo
read -s -p "Confirm root password: " root_password2
echo
[[ "rootpassword"!="root_password2" ]] && echo "Passwords do not match." && continue
[[ -z "$root_password" ]] && echo "Password cannot be empty." && continue
break
done
Assistant
Username
while true; do
read -p "Username: " user
[[ -z "$user" ]] && echo "Username cannot be empty." && continue
break
done
User Password
while true; do
read -s -p "User password: " user_password
echo
read -s -p "Confirm user password: " user_password2
echo
[[ "userpassword"!="user_password2" ]] && echo "Passwords do not match." && continue
[[ -z "$user_password" ]] && echo "Password cannot be empty." && continue
break
done
Export variables for later use
export disk hostname root_password user user_password
Partition Naming
if [[ "disk"==∗nvme∗]];thenpartprefix="{disk}p"
else
part_prefix="${disk}"
fi
mount -o noatime,compress=lzo,ssd,space_cache=v2,discard=async,subvol=@ "part2"/mntmkdir−p/mnt/home,var,.snapshots,var/cache/pacman/pkpart2" /mnt/home
mount -o noatime,compress=lzo,ssd,space_cache=v2,discard=async,subvol=@var "part2"/mnt/varmopart2" /mnt/var/cache/pacman/pkg/
mount -o noatime,compress=zstd,ssd,space_cache=v2,discard=async,subvol=@snapshots "$part2" /mnt/.snapshots
mkdir -p "THEMEDIR/gtk−3.0"cp−r"{SRC_DIR}/assets/gtk/scalable" "THEMEDIR/gtk−3.0/assets"2>/dev/null∣∣trueif[{SRC_DIR}/main/gtk-3.0/gtk-Dark.scss" ]; then
sassc -M -t expanded "SRCDIR/main/gtk−3.0/gtk−{THEME_DIR}/gtk-3.0/gtk.css"
cp "THEMEDIR/gtk−3.0/gtk.css""{THEME_DIR}/gtk-3.0/gtk-dark.css"
fi
--- GTK4 ---
mkdir -p "THEMEDIR/gtk−4.0"cp−r"{SRC_DIR}/assets/gtk/scalable" "THEMEDIR/gtk−4.0/assets"2>/dev/null∣∣trueif[{SRC_DIR}/main/gtk-4.0/gtk-Dark.scss" ]; then
sassc -M -t expanded "SRCDIR/main/gtk−4.0/gtk−{THEME_DIR}/gtk-4.0/gtk.css"
cp "THEMEDIR/gtk−4.0/gtk.css""{THEME_DIR}/gtk-4.0/gtk-dark.css"
fi
--- index.theme ---
cat > "THEMEDIR/index.theme"<<EOF[DesktopEntry]Type=X−GNOME−MetathemeName={THEME_NAME}
Comment=Gruvbox Dark GTK Theme
EOF
gsettings set org.gnome.desktop.interface gtk-theme 'Gruvbox-Dark'
gsettings set org.gnome.desktop.interface icon-theme "Papirus-Dark"
gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark'
Mime setup
find /usr/share/applications -iname '*.desktop' -print0 | while IFS= read -r -d ′\0′d;domimetypes=(grep -m1 '^MimeType=' "d"∣cut−d=−f2)[[−z"mime_types" ]] && continue
IFS=';' read -ra mimes <<< "mimetypes"formin"{mimes[@]}"; do
[[ -z "m" ]] && continue
xdg-mime default "(basename "d")""m"
done
done
for type in pdf x-pdf fdf xdp xfdf pdx; do xdg-mime default org.pwmt.zathura.desktop application/type;donefortypetype; done
Firefox user.js linking
firefox
if [ -d ~/.mozilla/firefox ]; then
dir=(ls/.mozilla/firefox/∣grep".default−release"∣head−n1)if[−n"dir" ]; then
ln -sf /home/USER/.dotfiles/user.js/home/USER/.mozilla/firefox/$dir/user.js
fi
fi
mount -o noatime,compress=zstd,ssd,space_cache=v2,discard=async,subvol=@snapshots "$part2" /mnt/.snapshots
Good, but make sure /mnt/.snapshots exists before mounting.
You create after mounting /mnt, but no explicit mkdir -p /mnt/.snapshots before mounting it.
Suggestion: Add this line earlier before mounting .snapshots:
bash
mkdir -p /mnt/.snapshots
3. Pacstrap and Reflector Mirrorlist race condition
In install.sh:
bash
reflector --country 'India' --latest 10 --age 24 --sort rate --save /etc/pacman.d/mirrorlist
if ! pacstrap /mnt "${install_pkgs[@]}"; then
echo "pacstrap failed. Please check the package list and network connection."
exit 1
fi
Modifying /etc/pacman.d/mirrorlist inside live environment may not affect the chroot environment unless done inside /mnt. Instead, the mirrorlist should be updated inside the chroot (which you do again in chroot.sh).
Having it only inside chroot.sh is sufficient — running reflector within the chroot environment ensures proper mirrorlist inside the installed system.
Suggestion: You can remove the reflector call before pacstrap or ensure a working mirrorlist is used during live environment pacstrap.
4. root_password and user_password stored in plaintext in /mnt/root/install.conf
This is preferred over plaintext scripts, but still storing passwords in plaintext on disk is a moderate security risk.
Suggestion:
Wipe the file as you do (shred -u /root/install.conf in chroot) after use.
Consider prompting for passwords in chroot.sh as well or passing them securely.
5. chroot.sh - sed locale gen
bash
sed -i 's/#en_US.UTF-8/en_US.UTF-8/g' /etc/locale.gen
Should be:
bash
sed -i 's/^#en_US.UTF-8/en_US.UTF-8/g' /etc/locale.gen
To avoid accidentally uncommenting #some otheren_US.UTF-8 lines.
6. chroot.sh - sed on /etc/default/grub
bash
sed -i 's/^#GRUB_DISABLE_OS_PROBER=false/GRUB_DISABLE_OS_PROBER=false/' /etc/default/grub
Good, this enables OS prober for GRUB, but if line not present it won't add it.
Better to append if not present:
bash
if ! grep -q '^GRUB_DISABLE_OS_PROBER=' /etc/default/grub; then
echo 'GRUB_DISABLE_OS_PROBER=false' >> /etc/default/grub
else
sed -i 's/^#GRUB_DISABLE_OS_PROBER=false/GRUB_DISABLE_OS_PROBER=false/' /etc/default/grub
fi
7. run.sh - Directly run firefox
Running firefox in a script without checking if the X or Wayland session is running can cause errors or proper operation can be interrupted. Consider running this only after user graphical session is fully up, or ask user to run this manually.
8. run.sh - Using sudo inside a script run as user