forked from mathiasbynens/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 1
/
bootstrap.sh
executable file
·39 lines (33 loc) · 873 Bytes
/
bootstrap.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
#!/usr/bin/env zsh
cd "$(dirname "${0:A}")"
localSource="$(cd "$(dirname ".zshrc")"; pwd)/$(basename ".zshrc")"
# git pull origin master;
function doIt() {
rsync --exclude ".git/" \
--exclude ".DS_Store" \
--exclude "bootstrap.sh" \
--exclude "README.md" \
--exclude ".zshrc" \
--exclude "zshrc.sh" \
--exclude ".functions" \
--exclude ".aliases" \
--exclude ".extras" \
--exclude "dotfiles.sublime-workspace" \
--exclude "LICENSE-MIT.txt" \
-avh --no-perms . ~
if [ -f ~/.zshrc ] && [[ "$(realpath ~/.zshrc)" != "$localSource" ]]; then
mv ~/.zshrc ~/.zshrc.old
fi
ln -s $localSource ~/.zshrc
source ~/.zshrc
}
if [[ "$1" = "--force" ]] || [[ "$1" = "-f" ]]; then
doIt
else
read -q "REPLY?This may overwrite existing files in your home directory. Are you sure? (y/n) "
echo ""
if [[ $REPLY =~ ^[Yy]$ ]]; then
doIt
fi
fi
unset doIt