-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
executable file
·52 lines (46 loc) · 1.6 KB
/
setup.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
#!/bin/bash
#Git the newest version of the dotfiles
if [ ! -d ~/.dotconf ]; then
git clone --recursive https://github.com/dvanallen/dotconf.git ~/.dotconf
else
git --git-dir=$HOME/.dotconf/.git/ --work-tree=$HOME/.dotconf pull --ff-only --recurse-submodules=on-demand
fi
#Make a backup of existing dotconf files and copy over the new ones.
BACKUP_DIR=~/.dotbackup/$(date +%y%m%d%H%M%S)
mkdir -p $BACKUP_DIR
for file in ~/.dotconf/.[^.]*; do
#Use greedy glob removal to grab the basename of each dotfile.
BASENAME=${file##*/}
if [ $BASENAME != ".git" ] && [ $BASENAME != ".gitmodules" ]; then
if [ -e ~/$BASENAME ]; then
cp -r ~/$BASENAME $BACKUP_DIR/$BASENAME
fi
if [ -d ~/$BASENAME ]; then
cp -r ~/.dotconf/$BASENAME/. ~/$BASENAME
else
cp -r ~/.dotconf/$BASENAME ~/$BASENAME
fi
fi
done
#Fix SSH directory permissions
chmod 700 ~/.ssh
chmod -R 600 ~/.ssh/*
if [ "$(uname -s)" = Darwin ]; then
if ! which -s brew; then
echo "Installing homebrew"
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
PATH=$PATH:/usr/local/bin
fi
brew install cmake git tmux vim macvim mobile-shell openssh openssl nmap bash coreutils node sshrc tar
fi
#Vim setup
mkdir ~/.vim/autoload && curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim
cd ~/.vim/bundle/YouCompleteMe
if [[ "$(uname -s)" =~ .*BSD ]]; then
./install.sh --clang-completer --system-libclang --system-boost
else
./install.sh --clang-completer
fi
cd ~/.vim/bundle/tern_for_vim
npm install
echo "Don't forget to source the shell profile!"