-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathINSTALL.sh
88 lines (75 loc) · 3.11 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
#!/bin/bash
# HyprManga Installation Script
# -----------------------------
# This script installs yay, required packages, and force copies dotfiles from the HyprManga repository.
# It is designed to be executed remotely using:
# bash -c "$(curl -fsSL https://raw.githubusercontent.com/not1cyyy/HyprManga/main/INSTALL.sh)"
# Set up error handling
set -euo pipefail
# Variables
DOTFILES_REPO="https://github.com/not1cyyy/HyprManga.git"
DOTFILES_DIR="$HOME/.config/dotfiles"
BACKUP_DIR="$HOME/.config-backup"
# Function to print messages
print_message() {
echo -e "\n\033[1;32m==> $1\033[0m"
}
# Function to handle errors
handle_error() {
echo -e "\n\033[1;31mERROR: $1\033[0m"
exit 1
}
# Step 1: Install yay (AUR helper)
print_message "Installing yay..."
if ! command -v yay &> /dev/null; then
sudo pacman -S --needed --noconfirm git base-devel || handle_error "Failed to install dependencies for yay."
git clone https://aur.archlinux.org/yay.git /tmp/yay || handle_error "Failed to clone yay repository."
cd /tmp/yay
makepkg -si --noconfirm || handle_error "Failed to build and install yay."
cd ~
rm -rf /tmp/yay
else
echo "yay is already installed. Skipping..."
fi
# Step 2: Install required packages using yay
print_message "Installing required packages using yay..."
yay -S --needed --noconfirm git hyprland hyprpaper hyprpanel rofi alacritty kitty nautilus || handle_error "Failed to install packages."
# Step 3: Clone the dotfiles repository
print_message "Cloning dotfiles repository..."
if [ -d "$DOTFILES_DIR" ]; then
echo "Dotfiles directory already exists. Pulling latest changes..."
git -C "$DOTFILES_DIR" pull || handle_error "Failed to pull dotfiles repository."
else
git clone "$DOTFILES_REPO" "$DOTFILES_DIR" || handle_error "Failed to clone dotfiles repository."
fi
# Step 4: Backup existing configurations
print_message "Backing up existing configurations..."
mkdir -p "$BACKUP_DIR"
for config in hypr hyprpaper hyprpanel rofi alacritty kitty nautilus; do
if [ -d "$HOME/.config/$config" ]; then
mv "$HOME/.config/$config" "$BACKUP_DIR/$config" || handle_error "Failed to backup $config."
fi
done
# Step 5: Force copy dotfiles
print_message "Force copying dotfiles..."
for config in hypr hyprpaper hyprpanel rofi alacritty kitty nautilus; do
if [ -d "$DOTFILES_DIR/dotconfig/$config" ]; then
cp -rf "$DOTFILES_DIR/dotconfig/$config" "$HOME/.config/" || handle_error "Failed to copy $config."
else
echo "Warning: $config directory not found in dotfiles repository. Skipping..."
fi
done
# Step 6: Additional customizations (optional)
print_message "Applying additional customizations..."
# Example: Install fonts
yay -S --noconfirm ttf-jetbrains-mono-nerd ttf-font-awesome || handle_error "Failed to install fonts."
# Step 7: Final message
print_message "Dotfiles installation complete! Enjoy your new Hyprland setup."
echo "Backups of existing configurations are stored in $BACKUP_DIR."
# Step 8: Rebooting the system
print_message "Rebooting the system in 5 seconds..."
for i in {5..1}; do
echo -ne "Rebooting in $i seconds...\r"
sleep 1
done
sudo reboot