-
Notifications
You must be signed in to change notification settings - Fork 15
/
install.sh
executable file
·54 lines (45 loc) · 1.92 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
#!/bin/bash
# -polka-
# Get the current directory
DIR="$( cd "$(dirname "$0" )" && pwd )"
# Link dot files to $HOME
for dotfile in $(find $DIR -maxdepth 1 -type f -name ".*"); do
if [[ $(uname) == 'Linux' && "$(basename $dotfile)" == '.tmux.linux.conf' ]]; then
ln -fs $dotfile "${HOME}/.tmux.conf"
elif [[ $(uname) == 'Darwin' && "$(basename $dotfile)" == '.tmux.osx.conf' ]]; then
ln -fs $dotfile "${HOME}/.tmux.conf"
elif [[ "$(basename $dotfile)" != ".tmux.osx.conf" && "$(basename $dotfile)" != ".tmux.linux.conf" ]]; then
ln -fs $dotfile "${HOME}/$(basename $dotfile)"
fi
done
# Link rc files in .bashrc.d
[ -d "${HOME}/.bashrc.d" ] || mkdir "${HOME}/.bashrc.d"
for dotfile in ${DIR}/.bashrc.d/*; do
ln -fs $dotfile "${HOME}/.bashrc.d/$(basename $dotfile)"
done
# Link files in bin
[ -d "${HOME}/bin" ] || mkdir "${HOME}/bin"
for file in ${DIR}/bin/*; do
[ -x $file ] || continue
[[ $(uname) == 'Linux' && $(basename $file) == 'reattach-to-user-namespace' ]] && continue
ln -fs $file "${HOME}/bin/$(basename $file)"
done
# Link files in lib
[ -d "${HOME}/lib" ] || mkdir "${HOME}/lib"
for file in ${DIR}/lib/*; do
[ -x $file ] || continue
ln -fs $file "${HOME}/lib/$(basename $file)"
done
[ -d "${HOME}/.vim/bundle" ] || mkdir -p "${HOME}/.vim/bundle"
[ -d "${HOME}/.vim/backups" ] || mkdir -p "${HOME}/.vim/backups"
[ -d "${HOME}/.vim/swaps" ] || mkdir -p "${HOME}/.vim/swaps"
[ -d "${HOME}/.vim/undo" ] || mkdir -p "${HOME}/.vim/undo"
# Preload NeoBundle
if [ ! -e "${HOME}/.vim/bundle/neobundle.vim" ]; then
echo "Installing NeoBundle..."
git clone "git://github.com/Shougo/neobundle.vim" "${HOME}/.vim/bundle/neobundle.vim" > "${HOME}/.vim/bundle/neobundle-install.log" 2>&1 &
fi
# Remove broken symlinks
find -L "${HOME}" "${HOME}/.bashrc.d" "${HOME}/bin" "${HOME}/lib" "${HOME}/.vim/" -maxdepth 1 -type l | xargs rm 2>/dev/null
# execute scripts on install
(exec "${DIR}/bin/setup-gitconfig")