-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup_dotfiles
executable file
·48 lines (41 loc) · 1.24 KB
/
setup_dotfiles
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
#!/bin/bash
# NOTE: Run this from the directory this file is in
function ensure_link {
test -e "$2"
if [[ $? == 0 ]]
then
test -L $2 || mv $2 "$2.orig"
fi
test -L "$2" || ln -s "$1" "$2"
}
# Install diff-highlight if we don't have it
GIT_SOURCE_DIR="$HOME/src/git/git/"
test -e ${GIT_SOURCE_DIR}
if [[ $? == 1 ]]
then
git clone [email protected]:git/git.git ${GIT_SOURCE_DIR}
cd ${GIT_SOURCE_DIR}/contrib/diff-highlight
make
cd -
fi
ensure_link "${PWD}" "$HOME/scripts"
cd $HOME/scripts
ensure_link "${PWD}/bashrc" "$HOME/.bashrc"
ensure_link "${PWD}/vimrc" "$HOME/.vimrc"
ensure_link "${PWD}/.vim" "$HOME/.vim"
ensure_link "${PWD}/ackrc" "$HOME/.ackrc"
if [ $(whoami) == "ubuntu" ]
then
ensure_link "${PWD}/gitconfig_ubuntu" "$HOME/.gitconfig"
else
ensure_link "${PWD}/gitconfig" "$HOME/.gitconfig"
fi
ensure_link "${PWD}/gitignore_global" "$HOME/.gitignore_global"
ensure_link "${PWD}/iex.exs" "$HOME/.iex.exs"
ensure_link "${PWD}/ctags" "$HOME/.ctags"
# Needed for neovim setup
ensure_link "${HOME}/.vim" "${HOME}/.config/.vim"
git submodule init
git submodule update
# Setup asdf - note branch may change over time https://asdf-vm.com/guide/getting-started.html
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.14.0