-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstaller.sh
executable file
·72 lines (63 loc) · 2.35 KB
/
installer.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/bash
# removes the bajillion files we need for hyprland
function hyprland_del() {
rm -rf ~/.config/hypr
rm -rf ~/.config/Kvantum/catppuccin-mocha-mauve ~/.config/Kvantum/kvantum.kvconfig
rm -rf ~/.config/rofi ~/.config/swaync ~/.config/waybar ~/.config/wlogout
}
# Checks if a given package is installed, if not installs it
function check_pkg() {
if pacman -Q "$1" > /dev/null; then
continue;
else
read -p "Install required pkg $1? (Y/n): " yn;
case $yn in
[Yy]* ) sudo pacman -S $1 --noconfirm;;
''|*[[:space:]]) sudo pacman -S $1 --noconfirm;;
[Nn]* ) echo "Exiting" && exit;;
* ) echo "Invalid input. Exiting." && exit;;
esac
continue;
fi
}
# select_item opens a select menu for all of the config options
function select_item() {
# Get all the current dirs and open a gum menu for them
sel=$(find . -maxdepth 1 -type d | sed -n 's/^\.\///p' | grep -v -E "\.git|README-DEPENDENCIES" | gum choose --no-limit --selected.foreground="177" || ( echo "Command failed." && exit ))
if gum confirm "This will overwrite all existing configs for these selections. Are you sure?" --selected.background="177"; then
# Select AUR helper
aur=$(gum choose --limit=1 --selected.foreground="177" yay paru)
echo $aur
for i in $sel; do
case $i in
# Remove existing config files
"yazi") rm -rf ~/.config/yazi;;
"ghostty") rm -rf ~/.config/ghostty;;
"nvim") rm -rf ~/.config/nvim;;
"zsh") rm -rf ~/.zshrc ~/.zsh;;
"fastfetch") rm -rf ~/.config/fastfetch;;
"tmux") rm -rf ~/.tmux.conf ~/.tmux;;
"cava") rm -rf .config/cava/config;;
"hyprland") hyprland_del;;
esac
stow $i
# Read the dependencies.txt file
echo "Installing dependencies for $i through $aur..."
$aur -Sy $(cat ./$i/dependencies.txt) --noconfirm || ( echo "Command failed." && exit )
echo "$i config loaded.";
done
else
echo "Quitting..." && exit
fi
}
# Only run if on arch
source /etc/os-release
if [[ $ID == "arch" ]]; then
# Check if gum and stow are installed
check_pkg "gum"
check_pkg "stow"
select_item
else
echo "This script is only currently supported on Arch linux."
echo "Support for other systems is (probbaly not) coming soon."
fi