-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·114 lines (96 loc) · 3.29 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
#!/bin/bash
script_dir="$(pwd)"
# Function to prompt the user for input
prompt_user() {
while true; do
read -p "$1 [y/n]: " yn
case $yn in
[Yy]* ) return 0;;
[Nn]* ) return 1;;
* ) echo "Please answer yes [y] or no [n].";;
esac
done
}
# Function to safely copy files with user confirmation
safe_copy() {
if [ -e "$1" ]; then
if [ -e "$2" ]; then
echo "File or directory $2 already exists."
if prompt_user "Do you want to overwrite it?"; then
rsync -a --delete "$1" "$2"
echo "Updated: $2"
else
echo "Skipping: $2"
fi
else
rsync -a --delete "$1" "$2"
echo "Created: $2"
fi
else
echo "Source not found: $1"
fi
}
# Function to install GNOME extensions
install_gnome_extensions() {
EXTENSIONS_FILE="$script_dir/gnome_extensions_list.txt"
if [ -f "$EXTENSIONS_FILE" ]; then
echo "Installing GNOME extensions..."
while IFS= read -r uuid; do
echo "Installing extension: $uuid"
gnome-extensions install "$uuid" || echo "Failed to install $uuid"
done < "$EXTENSIONS_FILE"
echo "GNOME extensions installation complete."
else
echo "GNOME extensions list not found, skipping."
fi
}
# Step 1: Restore Dotfiles
if prompt_user "Do you want to restore dotfiles (zsh configs, Kitty config, Fastfetch conf)?"; then
echo "Restoring dotfiles..."
echo "Restoring Zsh configs..."
safe_copy "$script_dir/.zshrc" "$HOME/.zshrc"
safe_copy "$script_dir/.zprofile" "$HOME/.zprofile"
safe_copy "$script_dir/.zshenv" "$HOME/.zshenv"
safe_copy "$script_dir/.zsh" "$HOME/.zsh"
safe_copy "$script_dir/.config/zshrc.d" "$HOME/.config/zshrc.d"
echo "Restoring Kitty config..."
safe_copy "$script_dir/.config/kitty" "$HOME/.config/kitty"
echo "Restoring Fastfetch conf..."
safe_copy "$script_dir/.fastfetch_conf.jsonc" "$HOME/.fastfetch_conf.jsonc"
echo "Restoring Oh My Zsh and Powerlevel10k..."
safe_copy "$script_dir/.oh-my-zsh" "$HOME/.oh-my-zsh"
safe_copy "$script_dir/.p10k.zsh" "$HOME/.p10k.zsh"
echo "Dotfiles restored."
else
echo "Skipping dotfiles restore."
fi
# Step 2: Restore GNOME Extensions
if prompt_user "Do you want to restore GNOME extensions?"; then
install_gnome_extensions
else
echo "Skipping GNOME extensions installation."
fi
# Step 4: Restore Fonts
if prompt_user "Do you want to restore fonts?"; then
echo "Restoring fonts..."
mkdir -p $HOME/.local/share/fonts
safe_copy "$script_dir/.local/share/fonts" "$HOME/.local/share/fonts"
safe_copy "$script_dir/.fonts" "$HOME/.fonts"
echo "Fonts restored."
else
echo "Skipping fonts restore."
fi
# Step 5: Restore GNOME Tweaks Settings
if prompt_user "Do you want to restore GNOME Tweaks settings?"; then
DCONF_FILE="$script_dir/gnome_tweaks_settings_backup.dconf"
if [ -f "$DCONF_FILE" ]; then
echo "Restoring GNOME Tweaks settings..."
dconf load / < "$DCONF_FILE"
echo "GNOME Tweaks settings restored."
else
echo "No GNOME Tweaks settings backup found, skipping."
fi
else
echo "Skipping GNOME Tweaks settings restore."
fi
echo "Installation complete!"