forked from classy-giraffe/easy-arch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpost-install.sh
executable file
·154 lines (133 loc) · 6 KB
/
post-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
#!/usr/bin/env -S bash -e
if [ "$(id -u)" -eq 0 ]; then
error_print "Please run this script without sudo."
exit 1
fi
# Cleaning the TTY.
clear
# Cosmetics (colours for text).
BOLD='\e[1m'
BRED='\e[91m'
BBLUE='\e[34m'
BGREEN='\e[92m'
BYELLOW='\e[93m'
RESET='\e[0m'
# Pretty print (function).
info_print() {
echo -e "${BOLD}${BGREEN}[ ${BYELLOW}•${BGREEN} ] $1${RESET}"
}
# Pretty print for input (function).
input_print() {
echo -ne "${BOLD}${BYELLOW}[ ${BGREEN}•${BYELLOW} ] $1${RESET}"
}
# Alert user of bad input (function).
error_print() {
echo -e "${BOLD}${BRED}[ ${BBLUE}•${BRED} ] $1${RESET}"
}
exists() {
command -v "$1" &>/dev/null
}
dotfiles() {
/usr/bin/git --git-dir="$HOME/.dotfiles/" --work-tree="$HOME" "$@"
}
get_repo() {
input_print "Please enter the url of your dotfiles repo: "
read -r dotfiles_repo
if [[ -z "$dotfiles_repo" ]]; then
echo
error_print "URL can't be empty."
return 1
fi
}
gpu_detector() {
GPU=$(lspci -v | grep -A1 -E "(VGA|3D)")
if [[ "$GPU" == *"Intel"* ]]; then
info_print "An Intel GPU has been detected, installing appropiate video drivers."
video_drivers=(vulkan-intel lib32-vulkan-intel mesa lib32-mesa)
elif [[ "$GPU" == *"AMD"* ]]; then
info_print "An AMD GPU has been detected, installing appropiate video drivers."
video_drivers=(xf86-video-amdgpu vulkan-radeon lib32-vulkan-radeon mesa lib32-mesa)
else
info_print "An NVIDIA GPU has been detected, this currently needs more testing."
exit 1
fi
}
graphic_server_install() {
main_pkgs=(xorg qtile ly xclip picom papirus-icon-theme playerctl udisks2 dunst bluez bluez-utils brightnessctl)
audio_server=(pipewire-alsa wireplumber pipewire-audio pipewire-pulse pipewire-jack alsa-utils pavucontrol pamixer)
fonts=(noto-fonts noto-fonts-emoji ttf-liberation gnu-free-fonts ttf-nerd-fonts-symbols ttf-fira-code ttf-firacode-nerd)
apps=(cups-pdf ffmpegthumbnailer libreoffice-fresh blueman bitwarden kitty firefox nsxiv rofi rofi-calc flameshot dwarffortress rofi-emoji udiskie syncthing mpv mpv-mpris copyq)
yay_pkgs=(dragon-drop syncthingtray rofi-nerdy kitty-xterm-symlinks python-pulsectl-asyncio python-pywalfox zapzap)
# Detect gpu for video driver installation
gpu_detector
# Install packages
info_print "Installing the graphics server, display and window manager, along with some useful tools (this may take a while)."
sudo pacman -S --noconfirm "${main_pkgs[@]}" "${apps[@]}" "${fonts[@]}" "${video_drivers[@]}" "${audio_server[@]}" &>/dev/null
exists yay && yay -S --noconfirm "${yay_pkgs[@]}" &>/dev/null
sleep 5
sudo sed -Ei 's/^(animation =).*/\1 doom/;s/^(clock =).*/\1 %F %a - %r/;s/^(bigclock =).*/\1 true/;s/^(clear_password =).*/\1 true/;' /etc/ly/config.ini
sudo localectl set-x11-keymap latam pc105 deadtilde
info_print "Enabling the display manager (ly), CUPS and bluetooh."
services=(ly.service cups.service bluetooth.service)
for service in "${services[@]}"; do
sudo systemctl enable "$service" &>/dev/null
done
}
yay_install() {
info_print "Installing the yay AUR manager."
git clone https://aur.archlinux.org/yay.git &>/dev/null
cd yay
makepkg --noconfirm -si &>/dev/null
cd .. && rm -rf yay
}
# Welcome screen.
echo -ne "${BOLD}${BYELLOW}
==========================================================
█████████ █████ █████ █████████ █████████
███░░░░░███ ░░███ ░░███ ███░░░░░███ ███░░░░░███
░███ ░███ ░███ ░███ ░███ ░███ ░███ ░░░
░███████████ ░███ ░███ ░███████████ ░░█████████
░███░░░░░███ ░███ ░███ ░███░░░░░███ ░░░░░░░░███
░███ ░███ ░███ █ ░███ ░███ ░███ ███ ░███
█████ █████ ███████████ █████ █████ █████░░█████████
░░░░░ ░░░░░ ░░░░░░░░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░░░░░░
Post-Install
==========================================================
${RESET}"
info_print "Welcome to ALIAS 2: Electric Boogaloo."
# Install yay
if ! exists yay; then
input_print "Do you want to install yay for simpler AUR management [y/N]?: "
read -r yay_response
if ! [[ "${yay_response,,}" =~ ^(yes|y)$ ]]; then
error_print "Continuing."
return 0
else
yay_install
fi
fi
# Clone config
info_print "Cloning config and tracking it."
if [[ ! -d "${HOME}/.dotfiles" ]]; then
until get_repo; do :; done
git clone --bare "$dotfiles_repo" "$HOME"/.dotfiles &>/dev/null
dotfiles checkout -f
dotfiles config --local status.showUntrackedFiles no
if [[ "$dotfiles_repo" == *"hownioni/dotfiles"* ]]; then
info_print "Installing some AUR packages required for my config."
git clone https://github.com/hownioni/Walls.git "$HOME"/Pictures/Wallpapers &>/dev/null
yay -S --noconfirm bash-complete-alias pistol-git vimv python-pywal16 &>/dev/null
wal --cols16 -i "$HOME"/Pictures/Wallpapers/Synthwave/1_Trevor_Something_does_not_exist.png &>/dev/null
fi
else
info_print "There already exists a \"~/.dotfiles\" directory. Continuing."
fi
# Install graphics server
input_print "Do you want to install the graphics server [y/N]?: "
read -r graphics_response
if ! [[ "${graphics_response,,}" =~ ^(yes|y)$ ]]; then
info_print "All done! You can reboot now."
exit 0
fi
graphic_server_install
info_print "All done! You can reboot now."