-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·120 lines (98 loc) · 3.84 KB
/
install.sh
File metadata and controls
executable file
·120 lines (98 loc) · 3.84 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
#!/usr/bin/env bash
set -e
# Path to the directory where this script resides
DOTFILES_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
CONFIG_DIR="$HOME/.config"
echo "================================"
echo " Dotfiles Install Script "
echo "================================"
echo ""
# Ensure ~/.config exists
mkdir -p "$CONFIG_DIR"
backup_and_link() {
local src="$1"
local dest="$2"
if [ -e "$dest" ] || [ -h "$dest" ]; then
if [ ! -h "$dest" ]; then
echo "Backing up existing $dest to ${dest}.backup"
mv "$dest" "${dest}.backup"
else
echo "Removing existing symlink at $dest"
rm "$dest"
fi
fi
echo "Linking $src -> $dest"
ln -s "$src" "$dest"
}
echo "--> Setting up user configuration files..."
# 1. Link folders in ~/.config
config_folders=(hypr kitty matugen nvim rofi scripts swaync swayosd wallengine waybar)
for folder in "${config_folders[@]}"; do
if [ -d "$DOTFILES_DIR/$folder" ]; then
backup_and_link "$DOTFILES_DIR/$folder" "$CONFIG_DIR/$folder"
else
echo "Warning: Directory $folder not found in $DOTFILES_DIR. Skipping."
fi
done
# 2. Link starship.toml
if [ -f "$DOTFILES_DIR/starship.toml" ]; then
backup_and_link "$DOTFILES_DIR/starship.toml" "$CONFIG_DIR/starship.toml"
else
echo "Warning: starship.toml not found. Skipping."
fi
# 3. Link .zshrc
if [ -f "$DOTFILES_DIR/.zshrc" ]; then
backup_and_link "$DOTFILES_DIR/.zshrc" "$HOME/.zshrc"
else
echo "Warning: .zshrc not found. Skipping."
fi
echo "User configuration files have been successfully linked."
echo ""
# 4. System-wide setup
echo "--> System-wide setup"
echo "This section requires root privileges and sets up greetd, pam, and hyprland sessions."
read -p "Do you want to setup system-wide configurations? [y/N]: " setup_system
if [[ "$setup_system" =~ ^[Yy]$ ]]; then
echo "Requesting sudo privileges..."
# Check if necessary setup files exist before copying
if [ -d "$DOTFILES_DIR/setup-files" ]; then
# hyprland desktop entry
if [ -f "$DOTFILES_DIR/setup-files/hyprland.desktop" ]; then
echo "Copying hyprland.desktop to /usr/share/wayland-sessions/"
sudo mkdir -p /usr/share/wayland-sessions
sudo cp -v "$DOTFILES_DIR/setup-files/hyprland.desktop" /usr/share/wayland-sessions/hyprland.desktop
fi
# PAM login
if [ -f "$DOTFILES_DIR/setup-files/login" ]; then
echo "Copying login to /etc/pam.d/"
sudo mkdir -p /etc/pam.d
sudo cp -v "$DOTFILES_DIR/setup-files/login" /etc/pam.d/login
fi
# Greetd PAM and Config
if [ -f "$DOTFILES_DIR/setup-files/greetd" ]; then
echo "Copying greetd PAM to /etc/pam.d/"
sudo mkdir -p /etc/pam.d
sudo cp -v "$DOTFILES_DIR/setup-files/greetd" /etc/pam.d/greetd
fi
if [ -f "$DOTFILES_DIR/setup-files/config.toml" ]; then
echo "Copying greetd config.toml to /etc/greetd/"
sudo mkdir -p /etc/greetd
sudo cp -v "$DOTFILES_DIR/setup-files/config.toml" /etc/greetd/config.toml
fi
if [ -f "$DOTFILES_DIR/setup-files/hyprland.conf" ]; then
echo "Copying greetd hyprland.conf to /etc/greetd/"
sudo mkdir -p /etc/greetd
sudo cp -v "$DOTFILES_DIR/setup-files/hyprland.conf" /etc/greetd/hyprland.conf
fi
echo "System-wide setup complete."
else
echo "Error: setup-files directory not found in dotfiles repository."
fi
else
echo "Skipping system-wide configurations."
fi
echo ""
echo "================================"
echo " Installation Complete "
echo "================================"
echo "Enjoy your new setup! You may need to restart your terminal or log out and log back in for changes to take effect."