-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathinit.sh
More file actions
executable file
Β·55 lines (48 loc) Β· 1.23 KB
/
init.sh
File metadata and controls
executable file
Β·55 lines (48 loc) Β· 1.23 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
#!/usr/bin/env bash
# ~/.dotfiles/init.sh
set -e
cd "$(dirname "$0")" || exit 1
echo "π¦ Updating dotfiles repository..."
git pull --quiet
function doIt() {
echo "π Syncing dotfiles to home directory..."
rsync --exclude ".git/" \
--exclude ".idea" \
--exclude ".DS_Store" \
--exclude "init.sh" \
--exclude "README.md" \
-avh --no-perms . ~
echo "β
Dotfiles copied successfully!"
}
if [[ "$1" == "--force" || "$1" == "-f" ]]; then
doIt
else
read -rp "β οΈ This may overwrite existing files in your home directory. Proceed? (y/n) " -n 1
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
doIt
else
echo "β Aborted."
exit 1
fi
fi
unset doIt
# Reload appropriate shell configuration
if [ -n "$ZSH_VERSION" ]; then
echo "π Reloading Zsh configuration..."
if [ -f ~/.zprofile ]; then
source ~/.zprofile
elif [ -f ~/.zshrc ]; then
source ~/.zshrc
fi
elif [ -n "$BASH_VERSION" ]; then
echo "π Reloading Bash configuration..."
if [ -f ~/.bash_profile ]; then
source ~/.bash_profile
fi
else
echo "βΉοΈ Unknown shell. Please restart your terminal manually."
fi
echo
echo "π Setup complete!"
echo "π If things don't load immediately, run: exec zsh -l"