1#!/bin/bash
2
3LOGFILE="arch_post_install.log"
4
5sudo -v
6( while true; do sudo -n true; sleep 60; done ) &
7sudo_keepalive_pid=$!
8
9PRE_INSTALLED_PKGS=(
10 base
11 base-devel
12 linux
13 linux-firmware
14 linux-headers
15 btrfs-progs
16 sudo
17 openssh
18 neovim
19 git
20 networkmanager
21 zsh
22
23 # NVIDIA Drivers
24 dkms
25 libva-nvidia-driver
26 nvidia-open-dkms
27)
28
29
30HYPRLAND_STACK=(
31 hyprland-git
32 hypridle-git
33 hyprpicker-git
34 hyprshot
35 xdg-desktop-portal-hyprland-git
36 awww
37 waybar
38 cliphist
39 rofi
40 rofimoji
41 wtype # rofimoji dependency
42)
43
44FONTS_THEME=(
45 adw-gtk-theme
46 matugen-bin
47 noto-fonts
48 noto-fonts-emoji
49 ttf-hack-nerd
50 woff2-font-awesome
51 nwg-look
52)
53
54CLI_TOOLS=(
55 bat
56 bluetui
57 bind
58 btop
59 cpio
60 dust
61 ddcutil
62 eza
63 ethtool
64 fd
65 fzf
66 fastfetch
67 gdb
68 lazygit
69 man-db
70 ripgrep
71 tree
72 tmux
73 zoxide
74 stow
75 gum
76 pacman-contrib
77 python-setuptools
78 rsync
79 unzip
80 xdg-terminal-exec
81 webkit2gtk
82 yazi
83 zenity
84)
85
86CONTAINERS_VMS=(
87 docker
88 docker-buildx
89 docker-compose
90 lazydocker
91)
92
93NETWORK_REMOTE=(
94 networkmanager
95 openssh
96 tailscale
97 # rustdesk-bin
98 # tigervnc
99 localsend
100 dnsmasq
101)
102
103GUI_APPS=(
104 chromium
105 ghostty
106 obs-studio
107
108 obsidian-bin
109 bruno-bin
110 thunderbird
111 librewolf-bin
112
113 #3D Apps
114 bambustudio-bin
115 blender-bin
116)
117
118SECURITY=(
119 #ufw
120 ufwall
121 ufw-docker
122 polkit-gnome
123 keychain
124)
125
126SESSION_STACK=(
127 sddm
128 uwsm
129 xorg-xhost
130# sddm dependencies
131 qt6-svg
132 qt6-multimedia-ffmpeg
133)
134
135MEDIA_STACK=(
136 pipewire-pulse
137 wireplumber
138 pavucontrol
139 mpv
140 imv
141 swaync
142)
143
144cleanup_sudo() {
145 kill "$sudo_keepalive_pid"
146}
147
148ensure_connectivity_and_source(){
149 if ! ping -c 3 archlinux.org >/dev/null 2>&1; then
150 echo "Network connectivity check failed. Please ensure you are connected to the internet."
151 exit 1
152 fi
153
154 if ! command -v curl >/dev/null 2>&1; then
155 echo "Install curl and run the script"
156 exit 1
157 fi
158
159 COMMON_SCRIPT_URL="https://scripts.ansari.wtf/base.sh"
160 source <(curl -s $COMMON_SCRIPT_URL)
161}
162
163cleanup(){
164 echo
165 echo -e "${YELLOW}Setup interrupted. Cleaning up...${NC}"
166 exit 1
167}
168
169yay_setup(){
170 if ! yay --version >/dev/null 2>&1; then
171 execute_step "git --version" "Precheck Git installed"
172 execute_step "git clone https://aur.archlinux.org/yay.git" "Cloning yay from git"
173 log_info "Installing yay"
174 (cd yay && makepkg -si --noconfirm) && rm -rf yay
175 clear_screen_from_given_line 10
176 log_info "yay installed successfully"
177 else
178 log_info "yay is already installed.."
179 fi
180}
181
182
183media_setup(){
184 log_info "Setting up Media Applications"
185 execute_step "sudo pacman -S --noconfirm --needed ${MEDIA_STACK[*]}" "Installing Media Stack Packages"
186 log_info "Media Applications setup completed"
187
188 log_info "Setting up audio with PipeWire"
189 execute_step "systemctl --user enable pipewire pipewire-pulse wireplumber" "Enabling PipeWire, PipeWire-Pulse, and WirePlumber services"
190 execute_step "systemctl --user start pipewire pipewire-pulse wireplumber" "Starting PipeWire, PipeWire-Pulse, and WirePlumber services"
191 execute_step "systemctl --user restart pipewire pipewire-pulse wireplumber" "Restarting PipeWire services to ensure they are running"
192 log_info "Audio setup completed"
193}
194
195session_setup(){
196 log_info "Setting up Session Manager (SDDM)"
197 execute_step "sudo pacman -S --noconfirm --needed ${SESSION_STACK[*]}" "Installing Session Stack Packages"
198 execute_step "git clone -b wraith https://github.com/The-Robin-Hood/SilentSDDM" "Cloning Wraith SDDM"
199 execute_step "sudo mkdir -p /usr/share/sddm/themes/wraith" "Creating SDDM folder"
200 execute_step "sudo cp -r SilentSDDM/* /usr/share/sddm/themes/wraith/" "Moving files"
201 if [[ -f /etc/sddm.conf ]]; then
202 sudo cp -f /etc/sddm.conf /etc/sddm.conf.bk
203 sudo rm -rf /etc/sddm.conf
204 fi
205 execute_step "echo -e '[Theme]\nCurrent=wraith\nGreeterEnvironment=QML2_IMPORT_PATH=/usr/share/sddm/themes/wraith/components/' | sudo tee -a /etc/sddm.conf" "Editing /etc/sddm.conf"
206 execute_step "sudo cp '$HOME/.assets/imgs/dp.jpg' '/usr/share/sddm/faces/$USERNAME.face.icon'" "Setting Avatar for the user"
207 log_info "Done with sddm setup"
208}
209
210dotfile_setup(){
211 log_info "Setting up Dotfiles and Oh-My-Zsh"
212 execute_step 'sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"' "Installing oh-my-zsh"
213 execute_step "git clone https://github.com/zsh-users/zsh-autosuggestions .oh-my-zsh/custom/plugins/zsh-autosuggestions" "Cloning zsh-autosuggestions plugin"
214 execute_step "git clone https://github.com/The-Robin-Hood/dotfiles" "Cloning Dotfiles"
215 execute_step "cd dotfiles && stow . --adopt && git restore . && cd .." "Configuring dotfiles"
216 log_info "Dotfiles and Oh-My-Zsh setup completed"
217}
218
219check_package_diff() {
220 ALL_PKGS=(
221 "${PRE_INSTALLED_PKGS[@]}"
222 "${HYPRLAND_STACK[@]}"
223 "${FONTS_THEME[@]}"
224 "${CLI_TOOLS[@]}"
225 "${CONTAINERS_VMS[@]}"
226 "${NETWORK_REMOTE[@]}"
227 "${GUI_APPS[@]}"
228 "${SECURITY[@]}"
229 "${SESSION_STACK[@]}"
230 "${MEDIA_STACK[@]}"
231 )
232
233 PKGS_INSTALLED_LOCALLY=$(pacman -Qqe)
234
235 echo "=== Installed locally (Not in the pkgs list) ==="
236 comm -13 <(printf '%s\n' "${ALL_PKGS[@]}" | sort -u) <(echo "$PKGS_INSTALLED_LOCALLY" | sort -u)
237 echo ""
238 echo "=== Not installed locally ==="
239 comm -23 <(printf '%s\n' "${ALL_PKGS[@]}" | sort -u) <(echo "$PKGS_INSTALLED_LOCALLY" | sort -u)
240 echo ""
241}
242
243main(){
244 clear
245 ensure_connectivity_and_source
246 setup_cleanup_trap cleanup
247 trap cleanup_sudo EXIT
248 show_box "Arch Post Installation"
249
250 yay_setup
251
252 execute_step "yay -Syu --noconfirm --needed" "Updating System Packages"
253 execute_step "yay -S --noconfirm --needed ${PRE_INSTALLED_PKGS[*]}" "Checking Pre-installed Packages"
254 execute_step "yay -S --noconfirm --needed ${FONTS_THEME[*]}" "Installing Fonts and Theme Packages"
255 execute_step "yay -S --noconfirm --needed ${SECURITY[*]}" "Installing Security Packages"
256 execute_step "yay -S --noconfirm --needed ${CLI_TOOLS[*]}" "Installing CLI Tools"
257 execute_step "yay -S --noconfirm --needed ${NETWORK_REMOTE[*]}" "Installing Network and Remote Packages"
258 execute_step "yay -S --noconfirm --needed ${CONTAINERS_VMS[*]}" "Installing Container and VM Packages"
259 execute_step "yay -S --noconfirm --needed ${GUI_APPS[*]}" "Installing GUI Applications"
260 execute_step "yay -S --noconfirm --needed ${HYPRLAND_STACK[*]}" "Installing Hyprland and related Packages"
261
262 media_setup
263 session_setup
264 dotfile_setup
265
266 execute_step "swww img .assets/wallpapers/gwen-stacy.jpg --transition-fps=60 --transition-type=wipe" "Configuring Wallpaper"
267}
268
269#check_package_diff
270main