-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup
More file actions
executable file
·180 lines (151 loc) · 4.23 KB
/
setup
File metadata and controls
executable file
·180 lines (151 loc) · 4.23 KB
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
#!/bin/bash
pkgmgr=pacman
# Helper functions
choose_multiple()
{
gum choose --cursor-prefix="[ ] " --selected-prefix="[x] " --unselected-prefix="[ ] " --no-limit "$@"
}
choose_one()
{
gum choose "$@"
}
install_pkgs()
{
for pkg in "$@"; do
if $pkgmgr -Q "$pkg" &> /dev/null; then
echo "[ Skipped ] $pkg is already installed..."
else
gum spin --title="Installing $pkg..." -- $pkgmgr --noconfirm -S $pkg
echo "=> Successfully installed $pkg..."
fi
done
}
install_helper()
{
if command -v $1 &> /dev/null; then
echo "[ Skipped ] $1 is already installed..."
pkgmgr=$1
return 0
fi
gum spin --title="Cloning repo..." -- git clone "https://aur.archlinux.org/$1.git"
cd $1
gum spin --title="Building... " -- makepkg --noconfirm -si
cd ..
rm -rf "./$1"
if command -v $1 &> /dev/null; then
echo "=> Successfully installed $1"
pkgmgr=$1
else
echo "[ ERROR ] Failed to install $1..."
fi
}
remove_conflicts()
{
for file in "$@"; do
if [ -e $file ]; then
echo "[ INFO ] $file already exists! Moving to $file.backup..."
mv $file ".$file.backup"
fi
done
}
# Installation
clear
# Choosing an AUR helper
echo "Choose your AUR helper:"
OPTIONS=$(choose_one "Yay" "Paru")
case $OPTIONS in
Yay)
install_helper yay ;;
Paru)
install_helper paru ;;
esac
# Choosing a shell
echo
echo "Choose which shell you want to use (Zsh is recommended, Bash has no config apart from a prompt):"
OPTIONS=$(choose_one "Zsh" "Bash")
case $OPTIONS in
Zsh)
install_pkgs zsh
if [[ "$SHELL" != "$(which zsh)" ]]; then
chsh -s $(which zsh)
else
echo "[ Skipped ] $(which zsh) is already the default shell..."
fi
;;
Bash)
install_pkgs bash
if [[ "$SHELL" != "$(which bash)" ]]; then
chsh -s $(which bash)
else
echo "[ Skipped ] $(which bash) is already the default shell..."
fi
;;
esac
# Installing packages
echo
echo "Choose which required packages to install:"
OPTIONS=$(choose_multiple --selected=* hyprland nvim kitty swww starship python-pywal16 python-pywalfox imagemagick slurp grim wl-clipboard less clang unzip brightnessctl npm waybar ripgrep rofi-wayland zoxide)
install_pkgs $OPTIONS
echo
echo "Choose which optional packages to install:"
OPTIONS=$(choose_multiple --selected=* btop firefox fastfetch onefetch openssh playerctl spotify discord unimatrix xdg-desktop-portal-hyprland fzf atuin)
install_pkgs $OPTIONS
echo
echo "Choose what fonts you want to install:"
OPTIONS=$(choose_multiple --selected=* ttf-jetbrains-mono-nerd ttf-liberation noto-fonts noto-fonts-extra noto-fonts-cjk noto-fonts-emoji)
install_pkgs $OPTIONS
echo
if (gum confirm "Do you want to synchronize your razer devices with pywal? (Select no if you don't have any)"); then
echo "=> Adding $USER to the plugdev group (OpenRazer requirement)..."
if id -nG "$USER" | grep -qw "plugdev"; then
echo "[ Skipped ] $USER is already in the plugdev group..."
else
sudo gpasswd -a $USER plugdev
fi
install_pkgs openrazer-daemon razer-cli
else
echo "[ Skipped ] Skipping razer setup..."
fi
echo
if (gum confirm "Do you want to use pipewire for your audio?"); then
install_pkgs pipewire wireplumber pipewire-pulse
echo "=> Enabling systemctl services..."
systemctl --user enable pipewire.service
systemctl --user enable pipewire-pulse.service
systemctl --user enable wireplumber.service
else
echo "[ Skipped ] Skipping pipewire setup..."
fi
# Syncing the configs
echo
if (gum confirm "Do you want to use GNU Stow to manage your configs?"); then
install_pkgs stow
export GUM_FILE_FILE=0
echo "Choose where you want to put the dotfiles folder:"
DOT_PATH=$(gum file --directory --all /home)
cd ..
if [[ "$DOT_PATH" != "$(pwd)" ]]; then
mv -i dotfiles/ $DOT_PATH
fi
echo "=> Successfully moved dotfiles to $DOT_PATH..."
cd $HOME
mkdir -p .local/bin
mkdir -p Pictures/screenshots
mkdir -p Pictures/wallpapers
remove_conflicts .zshrc .bashrc .zprofile
cd "$HOME/.config"
CONFIG_FILES=$(ls -A "$DOT_PATH/dotfiles/.config")
remove_conflicts $CONFIG_FILES
cd "$DOT_PATH/dotfiles"
./syncdots
else
mv -i ./* ./.* $HOME
cd ..
rm -rf dotfiles/
echo "=> Successfully moved all configs into $HOME"
fi
echo
echo "=> Successfully finished the installation..."
if(gum confirm "Do you want to reboot? (Required for all changes to take effect)"); then
reboot
fi