-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall
More file actions
executable file
·110 lines (86 loc) · 2.75 KB
/
install
File metadata and controls
executable file
·110 lines (86 loc) · 2.75 KB
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#!/usr/bin/env zsh
#######################################################
# Setup dotfiles. Installs oh-my-zsh and vim plugins. #
#######################################################
cd $(dirname "$0")
is_mac=false
installing_ohmyzsh=false
if [ `uname` = 'Darwin' ]; then
is_mac=true
fi
skipped=(.git .config .gitignore .oh-my-zsh .DS_Store)
# Install oh-my-zsh
if [ -d "$HOME/.oh-my-zsh" ]; then
echo "oh-my-zsh already installed"
else
installing_ohmyzsh=true
git clone https://github.com/ohmyzsh/ohmyzsh.git "$HOME/.oh-my-zsh" &
omz_pid=$!
fi
# Symlink dotfiles
for f in .*; do
# Skip files found in $skipped
(( ${skipped[(I)$f]} )) && continue
# Skip .zsh-mac if not on macOS
[[ "$f" = '.zsh-mac' && $is_mac = false ]] && continue
echo "$f -> $HOME/$f"
ln -sf `pwd`/"$f" "$HOME/$f"
done
# link git ignore
echo ".config/git/ignore -> $HOME/.config/git/ignore"
mkdir -p $HOME/.config/git
ln -sf `pwd`/.config/git/ignore "$HOME/.config/git/ignore"
[ -d "$HOME/bin" ] || mkdir "$HOME/bin"
# install utils
for f in util/*; do
n=$(basename "$f")
[[ "crontab" = "$n" ]] && continue
echo "$f -> $HOME/bin/$n"
ln -sf `pwd`/"$f" "$HOME/bin/$n"
done
if [[ $is_mac = true ]]; then
mv "$HOME/.gitconfig-mac" "$HOME/.gitconfig"
else
rm "$HOME/.gitconfig-mac"
fi
# Install vim plugins
if (( $+commands[ruby] )); then
./util/vipack install
else
echo "ruby is missing. Install it and then run `vipack install` to install plugins."
fi
if (( ! $+commands[asdf] )); then
# Install latest release of asdf
pushd ..
if [ ! -d asdf ]; then
echo "Installing asdf from source"
# Clone for the first time
git clone https://github.com/asdf-vm/asdf.git
fi
pushd asdf
latest_tag=$(git tag --sort=version:refname | tail -n 1)
git checkout "$latest_tag"
echo "Installing asdf to ~/bin. Make sure it's in your PATH."
make build && mv asdf ~/bin/
popd
popd
elif [ -d ../asdf/.git ]; then
# asdf was built from source, so check for updates
pushd ../asdf
git fetch
latest_tag=$(git tag --sort=version:refname | tail -n 1)
if [[ ! $(git describe --exact-match --tags HEAD 2>/dev/null) == $latest_tag ]]; then
# We're not on the latest tag, so check it out and update
echo "Updating asdf to $latest_tag..."
git checkout "$latest_tag"
echo "Installing asdf to ~/bin. Make sure it's in your PATH."
make build && mv asdf ~/bin/
fi
popd
fi
zsh -c "asdf plugin add ruby >/dev/null && asdf plugin add nodejs >/dev/null && asdf plugin add erlang >/dev/null && asdf plugin add elixir >/dev/null"
echo "To install erlang:"
echo 'CFLAGS="-I/usr/local/include -O2 -g" KERL_CONFIGURE_OPTIONS="--without-javac" asdf install erlang latest'
# Don't exit until oh-my-zsh has been cloned
$installing_ohmyzsh && wait $omz_pid
exit 0