-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathinstall.sh
executable file
·63 lines (55 loc) · 1.19 KB
/
install.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
#!/bin/bash
#git clone [email protected]:yubo/home.git ~/.yubo
bak_dir="$HOME/.home_bak"
pwd_dir=$(pwd)
function install_dir {
if [[ ! -d $1 ]]; then
mkdir -p $1
fi
if [[ -n $2 ]]; then
chmod $2 $1
fi
}
function install_file {
src="${pwd_dir}/home/$1"
dst="$HOME/$1"
if [[ -e $dst || -L $dst || -d $dst ]]; then
mv $dst "${bak_dir}/"
fi
ln -s $src $dst
if [[ -n $2 ]]; then
chmod $2 ${src}
fi
}
function ignore_file {
src="${pwd_dir}/home/$1"
if [[ -e $src ]]; then
git update-index --assume-unchanged $src
fi
}
if [[ -d "$bak_dir" ]]; then
tmp_dir=$(mktemp -d -t home_XXXXXXXXXX)
mv $bak_dir $tmp_dir
echo "move $bak_dir to $tmp_dir"
fi
install_dir $bak_dir
install_dir ~/.ssh 0700
install_dir ~/.ssh/conf.d
install_dir ~/.config
install_dir ~/gopath
install_file bin
install_file .bash_profile
install_file .dircolors
install_file .fonts
install_file .gdbinit
install_file .gvimrc
install_file .globalrc
install_file .gitconfig
install_file .ssh/config 0600
install_file .tmux.conf
install_file .vimrc
install_file .curlrc
install_file .vim
install_file .config/nvim
install_file .config/bash_completion.sh
install_file .config/bash_completion.d