-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall
executable file
·84 lines (60 loc) · 1.59 KB
/
install
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
75
76
77
78
79
80
81
82
83
#!/bin/sh
#
# A simple way to install my preferred environment
#
# where we are working from
CWD=`dirname $0`
# a timestamp for backups.
TS=$(date +%Y-%m-%d-%H-%M-%S)
backup_dir="$HOME/dotfile.backup/$TS"
[ ! -d $backup_dir ] && mkdir -p $backup_dir
# basic config files to load into $HOME
dotfiles="\
.bashrc\
.bash_profile\
.gitconfig\
.vimrc\
.cshrc\
.tmux.conf\
.zlogin\
"
# install dependencies
declare -a post_commands=(
# Vim related stuff
## backup ~/.vim directory to a backup
"mv ${HOME}/.vim ${backup_dir}"
## and get our current files.
"cp -Rp $CWD/.vim $HOME/.vim"
## This is required for vim-javascript and vim-jsx
"mkdir -p $HOME/.vim/autoload"
"curl -LSso $HOME/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim"
## javascript and jsx syntax
"git clone https://github.com/pangloss/vim-javascript.git ${HOME}/.vim/bundle/vim-javascript"
"git clone https://github.com/mxw/vim-jsx.git $HOME/.vim/bundle/vim-jsx"
## yes, solorazied8
"git clone https://github.com/lifepillar/vim-solarized8.git ${HOME}/.vim/pack/themes/opt/solarized8"
)
copy_file() {
message=$1
from=$2
to=$3
echo "${message}: ${from} -> ${to}"
cp -Rp ${from} ${to}
}
## bin directory.
mkdir -p "${HOME}/bin"
cp "${CWD}/bin/test.colors" "${HOME}/bin/"
for dotfile in $dotfiles
do
realfile="${HOME}/${dotfile}"
thisfile="${CWD}/${dotfile}"
if [ -e $realfile ]; then
copy_file "backup" $realfile "${backup_dir}/${dotfile}"
fi
copy_file "installing" "${thisfile}" "${realfile}"
done
for cmd in "${post_commands[@]}"
do
echo $cmd
$cmd
done