-
Notifications
You must be signed in to change notification settings - Fork 2
/
installer.sh
executable file
·94 lines (78 loc) · 2.6 KB
/
installer.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/bin/bash
BASEDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
check_and_link () {
ORIGIN=$1
DESTINATION=$2
if [ ! -L ~/${DESTINATION} ]; then
echo "LINK: ~/${DESTINATION} ✅"
ln -s ${BASEDIR}/${ORIGIN} ~/${DESTINATION}
else
echo "LINK: ~/${DESTINATION} ✘"
fi
}
root_check_and_link () {
ORIGIN=$1
DESTINATION=$2
if [ ! -L ${DESTINATION} ]; then
echo "LINK: ${DESTINATION} ✅"
ln -s ${BASEDIR}/${ORIGIN} ${DESTINATION}
else
echo "LINK: ${DESTINATION} ✘"
fi
}
check_and_copy () {
ORIGIN=$1
DESTINATION=$2
if [ ! -f ~/${DESTINATION} ]; then
echo "COPY: ~/${DESTINATION} ✅"
cp ${BASEDIR}/${ORIGIN} ~/${DESTINATION}
else
echo "COPY: ~/${DESTINATION} ✘"
fi
}
# LINK .vimrc
check_and_link ".vimrc" ".vimrc"
# LINK .bash_profile
check_and_link ".bash_profile" ".bash_profile"
# MKDR .bash/
mkdir -p ~/.bash
# COPY .bash/aliases
check_and_copy "bash/aliases" ".bash/aliases"
# COPY .bash/profile_macosx
check_and_copy "bash/profile_macosx" ".bash/profile_macosx"
# COPY .bash/profile_linux
check_and_copy "bash/profile_linux" ".bash/profile_linux"
# COPY .bash/profile
check_and_copy "bash/profile" ".bash/profile"
# LINK .bash/common.sh
check_and_link "bash/common.sh" ".bash/common.sh"
# MKDR .bash_plugins/
mkdir -p ~/.bash_plugins
# LINK .bash_plugins/screen-layouts/
check_and_link "bash_plugins/screen-layouts" ".bash_plugins/screen-layouts"
# LINK .bash_plugins/git-completion/
check_and_link "bash_plugins/git-completion" ".bash_plugins/git-completion"
# LINK .bash_plugins/kube-completion/
check_and_link "bash_plugins/kube-completion" ".bash_plugins/kube-completion"
# LINK .bash_plugins/make-completion/
check_and_link "bash_plugins/make-completion" ".bash_plugins/make-completion"
# LINK .bash_plugins/ng-completion/
check_and_link "bash_plugins/ng-completion" ".bash_plugins/ng-completion"
# LINK .bash_plugins/npm-completion/
check_and_link "bash_plugins/npm-completion" ".bash_plugins/npm-completion"
# LINK .bash_plugins/iterm/
check_and_link "bash_plugins/iterm2" ".bash_plugins/iterm2"
# LINK .oh-my-zsh-custom
check_and_link "oh-my-zsh" ".oh-my-zsh-custom"
# LINK git-templates/
check_and_link "git/git-templates" "git-templates"
# LINK .gitconfig
check_and_link "git/gitconfig" ".gitconfig"
# LINK .gitignore_global
check_and_link "git/gitignore_global" ".gitignore_global"
# MKDR .ssh/
mkdir -p ~/.ssh
# COPY .ssh/config
check_and_copy "ssh/config" ".ssh/config"
# LINK executable "aa" (alias for iterm2_open_project.sh)
root_check_and_link "bin/iterm2_open_project.sh" "/usr/local/bin/aa"