forked from mathiasbynens/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.sh
executable file
·73 lines (55 loc) · 1.27 KB
/
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
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
#!/usr/bin/env bash
. mixins.sh
## Exit if execute on Windows
if [ "$(expr substr $(uname -s) 1 5)" == "MINGW" ]; then
output_error "ERROR: This script doesn't work on Windows"
exit
fi
#git checkout master;
#git pull origin master;
# Pre check
install_or_update_nvm() {
curl -o- https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
cd ~/.nvm
LAST_TAG=`git describe --abbrev=0 --tags`
git checkout $LAST_TAG
cd -
}
create_symlinks() {
dotfiles=(".gitconfig" ".gitignore" ".hgignore")
for dotfile in "${dotfiles[@]}"
do
ln -sfv ${PWD}/dotfiles/${dotfile} ${HOME}/${dotfile}
done
}
main() {
./dotfiles/.atom/bootstrap.sh
./dotfiles/.vscode/bootstrap.sh
create_symlinks
#install_or_update_nvm
}
main
git stash pop stash@\{0\} --quiet
exit
#################
cd "$(dirname "${BASH_SOURCE}")";
function doIt() {
rsync --exclude ".git/" \
--exclude ".DS_Store" \
--exclude ".osx" \
--exclude "bootstrap.sh" \
--exclude "README.md" \
--exclude "LICENSE-MIT.txt" \
-avh --no-perms . ~;
source ~/.bash_profile;
}
if [ "$1" == "--force" -o "$1" == "-f" ]; then
doIt;
else
read -p "This may overwrite existing files in your home directory. Are you sure? (y/n) " -n 1;
echo "";
if [[ $REPLY =~ ^[Yy]$ ]]; then
doIt;
fi;
fi;
unset doIt;