-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathinstall.sh
executable file
·232 lines (203 loc) · 6.08 KB
/
install.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
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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
#!/bin/bash
RED='\033[0;31m'
NC='\033[0m'
BLUE='\033[0;34m'
GREEN='\033[0;32m'
MAGENTA='\033[1;35m'
YELLOW='\033[33m'
BOLD=$(tput bold)
NORMAL=$(tput sgr0)
os="$(grep -m1 "NAME=" </etc/os-release | cut -d '"' -f 2)"
server="$(echo "$XDG_SESSION_TYPE")"
mainbanner () {
cat << EOF
▗▄▄▖ ▗▄▖ █
▐▛▀▜▌ █▀█ ▀
▐▌ ▐▌▗▟██▖▐▌ ▐▌▐▌ ▐▌ ▟██▖ █▟█▌ ██ ▐▌ ▐▌▐█▙█▖
▐███ ▐▙▄▖▘▐▌ ▐▌▐▌ ▐▌ ▘▄▟▌ █▘ █ ▐▌ ▐▌▐▌█▐▌
▐▌ ▐▌ ▀▀█▖▐▌ ▐▌▐▌ ▐▌▗█▀▜▌ █ █ ▐▌ ▐▌▐▌█▐▌
▐▙▄▟▌▐▄▄▟▌ █▄█▘▐▙▄█▌▐▙▄█▌ █ ▗▄█▄▖▐▙▄█▌▐▌█▐▌
▝▀▀▀ ▀▀▀ ▝▀█ ▀▀▝▘ ▀▀▝▘ ▀ ▝▀▀▀▘ ▀▀▝▘▝▘▀▝▘
▝
EOF
}
error () {
>&2 printf "${RED}${BOLD}${@}${NC}${NORMAL}\n"
exit 1
}
success () {
printf "${GREEN}${@}${NC}\n"
}
info () {
>&2 printf "${BLUE}${@}${NC}${NORMAL}\n"
}
warning () {
>&2 printf "${GREEN}${@}${NC}${NORMAL}\n"
}
banner () {
clear
printf "${BLUE}${BOLD}$(mainbanner)${NC}${NORMAL}\n"
echo -ne "${GREEN}┌─> ${NC}${YELLOW}By: ${MAGENTA}AlphaTechnolog${YELLOW} and ${MAGENTA}Bleyom ${NC}\n"
echo -ne "${GREEN}├────────>${NC}${YELLOW} Links: ${BLUE}https://github.com/AlphaTechnolog${YELLOW} and ${BLUE}https://github.com/Bleyom\n"
echo -ne "${GREEN}└────────>${NC}${YELLOW} The script only works for ${BLUE}Arch Linux${YELLOW} and ${GREEN}Void Linux${NC} ${RED}(Working in Debian and another distros support)${NC}\n"
}
check_deps () {
info "Checking required dependencies"
declare -a dependencies=('git')
for dependency in ${dependencies[@]}; do
if ! command -v $dependency 2>&1 > /dev/null; then
error "Cannot found required dependency: $dependency"
fi
done
banner
}
install_paru() {
if ! pacman -Qs git base-devel fakeroot >/dev/null; then
sudo pacman -S git base-devel fakeroot --noconfirm
fi
git clone https://aur.archlinux.org/paru-bin.git .paru-bin
cd .paru-bin || exit 1
makepkg -si
cd ..
rm -rf ./.paru-bin
}
check_server() {
if [ "$server" == x11 ]; then
echo -ne "${RED}[*] You are using X11${NC}"
if [ "$os" == "Arch Linux" ]; then
paru -Sy eww --noconfirm
elif [ "$os" == "void" ]; then
cp -r eww-template/eww srcpkgs/eww
fi
else
echo -ne "${GREEN}[*] You are using Wayland or idk${NC}"
if [ "$os" == "Arch Linux" ]; then
paru -Sy eww-wayland-git --noconfirm
elif [ "$os" == "void" ]; then
cp -r eww-template/eww-wayland srcpkgs/eww
fi
fi
}
install_eww_x11 () {
if [[ $os == 'Void' ]]; then
if ! test -d ./eww-template/eww; then
cp -r ./eww-template/eww ./srcpkgs/eww
fi
elif [[ $os == 'Arch Linux' ]]; then
paru -Sy eww --noconfirm
else
warning "Cannot install eww for your operative system: skipping"
fi
}
install_eww_wayland () {
if [[ $os == 'Void' ]]; then
if ! test -d ./eww-template/eww; then
cp -r ./eww-template/eww-wayland ./srcpkgs/eww
fi
elif [[ $os == 'Arch Linux' ]]; then
paru -Sy eww-wayland-git --noconfirm
else
warning "Cannot install eww for your operative system: skipping"
fi
}
install_eww () {
if [[ $server == "x11" ]]; then
info "You are using X11"
install_eww_x11
else
info "You are using Wayland or idk"
install_eww_wayland
fi
}
get_fixed_polybar_config () {
printf "${BLUE}${NC}"
cat << EOF
[system-battery]
battery = BAT0
adapter = $(/bin/ls -1 /sys/class/power_supply)
[system-network]
interface = $(/bin/ls -1 /sys/class/net | grep w --color=never)
EOF
}
copy_config () {
info "Copying config"
cp -r ./.config/* $HOME/.config
chmod +x $HOME/.config/bspwm/*
chmod +x $HOME/.config/polybar/launch.sh
get_fixed_polybar_config > $HOME/.config/polybar/system.ini
}
use_void () {
info "Installing dependencies"
sudo xbps-install xtools feh git polybar sxhkd bspwm rofi picom dunst neofetch kitty exa bat fish-shell wget unzip psmisc --yes
info "Cloning void-packages and trying to install eww"
if ! test -d void-packages; then
git clone https://github.com/void-linux/void-packages.git void-packages
fi
cd void-packages || exit 1
./xbps-src binary-bootstrap
if ! test -d eww-template; then
git clone https://github.com/monke0192/eww-template
fi
install_eww
./xbps-src pkg eww
cd ..
xi eww
copy_config
}
use_common () {
skip_auto_dependencies_installation
copy_config
}
use_arch () {
if ! command -v paru 2>&1 > /dev/null; then
info "Paru not found: installing!"
install_paru
fi
paru -Sy polybar git sxhkd bspwm polybar feh rofi picom dunst neofetch nerd-fonts-ttf kitty bat exa fish wget unzip --noconfirm
install_eww
copy_config
}
skip_auto_dependencies_installation () {
warning "Cannot get a valid operative system to autoinstall the dependencies: skipping!"
}
start_installation () {
if [[ $os == 'Void' ]]; then
use_void
elif [[ $os == 'Arch Linux' ]]; then
use_arch
else
use_common
fi
}
install_fonts () {
font_name='Iosevka'
font_url='https://github.com/ryanoasis/nerd-fonts/releases/download/2.2.0-RC/Iosevka.zip'
info "Downloading font '$font_name' from '$font_url'"
wget "$font_url"
if ! test -f "$font_name.zip"; then
error "Cannot download font... try manually downloading it from the url"
fi
mkdir -p ./$font_name
mv "$font_name.zip" $font_name
cd $font_name
unzip "$font_name.zip"
sudo mv ./*.ttf /usr/share/fonts
cd ../
rm -rf ./$font_name
info "Reloading fonts cache"
fc-cache -r
success "Font downloaded & installed successfully"
}
configure_shell () {
info "Setting fish as default shell"
sudo usermod --shell $(which fish) $(whoami)
success "Done"
}
main () {
banner
check_deps
start_installation
install_fonts
configure_shell
}
main