-
Notifications
You must be signed in to change notification settings - Fork 1
/
bootstrap.sh
executable file
·50 lines (41 loc) · 1.18 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
#!/bin/bash
DOTFILES=$HOME/dotfiles
# Glob dotfiles
shopt -s dotglob
function symlink_directory_files() {
local origin=$1
local dest=$2
for f in $origin/*; do
if [ ! -e $dest/$(basename $f) ]; then
ln -nsf $f $dest
echo "Symlinked $f."
else
echo "Symlink already existed: $f"
fi
done
}
# Create all symlinks
echo "Symlinking files from $DOTFILES/files/ into $HOME.."
symlink_directory_files $DOTFILES/files $HOME
# Create expected directories
DIRECTORIES=(workspace bin)
echo "Creating directories.."
for directory in ${DIRECTORIES[@]}; do
if [ ! -d $HOME/$directory ]; then
mkdir -p $HOME/$directory
echo "Created $HOME/$directory."
else
echo "Directory already existed: $directory"
fi
done
# Symlink bin scripts
echo "Symlinking bin scripts from $DOTFILES/bin/ into $HOME/bin.."
symlink_directory_files $DOTFILES/bin $HOME/bin
# Source profile
echo "Sourcing $HOME/.bash_profile"
. $HOME/.bash_profile
# Install vim plugins
echo "Installing vim plugins.."
test -f $HOME/.vim/autoload/plug.vim || curl -fLo ~/.vim/autoload/plug.vim \
--create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
vim +PlugInstall +qall