dotfiles/install.sh
2025-10-19 15:18:06 +02:00

51 lines
1.4 KiB
Bash
Executable file

#!/usr/bin/env bash
sources=("$PWD/config/" "$PWD/etc/" "$PWD/home/" "$PWD/qutebrowser/")
targets=("$HOME/.config/" "/etc/" "$HOME/" "$HOME/.config/qutebrowser/")
length=${#sources[@]}
packages="brightnessctl hyprland hyprlock hyprpaper i3status-rust kitty mpv neovim obs-studio qutebrowser ttc-iosevka ttf-nerd-fonts-symbols-mono yazi noto-fonts-emoji i3status-rust"
yayPackages="i3bar-river"
services="greetd"
pacman() {
read -p "Install the following packages : $packages ? (Y/N): " confirm && [[ $confirm == [yY] || $confirm == [yY][eE][sS] ]] || break
sudo pacman -Syu $packages
}
yay() {
# NOTE: no confirmation, we consider user should read the files
sudo yay -Syu $packages
}
systemd() {
read -p "Enable the following services : $services ? (Y/N): " confirm && [[ $confirm == [yY] || $confirm == [yY][eE][sS] ]] || break
sudo systemctl enable $services
}
install() {
pacman
yay
systemd
update
}
update() {
for ((i = 0; i < length; i++)); do
source=${sources[i]}
target=${targets[i]}
for folder in $(ls $source -a); do
if [ -e "$target$folder" ]; then
echo "The file '$target$folder' exists."
else
if [ -w "$target" ]; then
ln -s $source$folder $target$folder
else
read -p "write in : $target$folder ? (Y/N): " confirm && [[ $confirm == [yY] || $confirm == [yY][eE][sS] ]] || break
sudo ln -s $source$folder $target$folder
fi
fi
done
done
}
update