-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·74 lines (60 loc) · 1.93 KB
/
install.sh
File metadata and controls
executable file
·74 lines (60 loc) · 1.93 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/bash
############################
# install.sh
# This script creates symlinks from the home directory to any desired dotfiles in ~/dotfiles
############################
########## Variables
# dotfiles directory"
set -e
dir="$HOME/dotfiles"
# list of files/folders to symlink in homedir
files_to_symlink="eslintrc vimrc zshrc gitignore_global iex.exs gitattributes"
files_to_copy="gitconfig"
# for cygwin: prefer cygwin binaries (especially git, because of path issues in git clone)
export PATH="/cygdrive/c/cygwin64/bin/:$PATH"
##########
if [ ! -d "$HOME/.oh-my-zsh" ]; then
echo "Installing oh-my-zsh..."
git clone git://github.com/robbyrussell/oh-my-zsh.git $HOME/.oh-my-zsh
echo "oh-my-zsh installed."
else
echo "Oh-my-zsh already installed - skipping"
fi
if [ ! -d "$HOME/.vim/bundle/Vundle.vim" ]; then
echo "Installing vim plugin manager Vundle..."
git clone https://github.com/VundleVim/Vundle.vim.git $HOME/.vim/bundle/Vundle.vim
echo "Vundle plugin installed."
else
echo "Vundle plugin already installed - skipping"
fi
# create symlinks from every file in $files into $HOME directory
for file in $files_to_symlink; do
echo "Remove .$file from $HOME"
rm $HOME/.$file || true
echo "Creating symlink from $dir/$file to .$file in $HOME"
if [ $OSTYPE == "cygwin" ]; then
cyg_dest=$(cygpath -w "$HOME/.$file")
cyg_target=$(cygpath -w "$dir/$file")
cmd /C "mklink /H $cyg_dest $cyg_target"
else
ln -s $dir/$file ~/.$file
fi
done
mkdir -p $HOME/dotfiles_old
for file in $files_to_copy; do
d=$(date +%F)
backup_file=".$file-$d"
backup_dest="$HOME/dotfiles_old/$backup_file"
dest="$HOME/.$file"
if [ -f $dest ]; then
echo "Backup file to $backup_dest"
cp $dest $backup_dest
fi
echo "Copying .$file to $HOME"
cp $file $HOME/.$file
done
echo "Installing vim plugins..."
PLUGIN_INSTALL=1 vim +PluginInstall +qall
echo "Vim plugins installed"
echo ""
echo "Successfully installed dotfiles!"