-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy
More file actions
executable file
·32 lines (27 loc) · 803 Bytes
/
deploy
File metadata and controls
executable file
·32 lines (27 loc) · 803 Bytes
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
#!/bin/bash
set -e
DOTFILE_PATH=$( cd $( dirname "${BASH_SOURCE[0]}" ) ; pwd ; )
if [ -d $DOTFILE_PATH/dotfiles_bak ]
then
rmdir $DOTFILE_PATH/dotfiles_bak || { echo "Please remove manually $DOTFILE_PATH/dotfiles_bak dir after making sure it doesn't contain anything useful." ; exit 1 ; }
fi
mkdir $DOTFILE_PATH/dotfiles_bak
cd ~
deploy_core(){
target="$1"
link_name="$2"
[ "$link_name" = "" ] && link_name="$target"
target="$DOTFILE_PATH/$target"
if [ -e "$link_name" ] || [ -h "$link_name" ]
then
echo "Moving existing $link_name to $DOTFILE_PATH/dotfiles_bak"
mv "$link_name" $DOTFILE_PATH/dotfiles_bak
fi
mkdir -p "$(dirname $link_name)"
ln -sv $target ~/$link_name
}
deploy_core .vim
deploy_core .vimrc
deploy_core .bashrc
deploy_core .bash_profile
deploy_core bin