-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·90 lines (71 loc) · 2.06 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
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
#!/bin/bash
#
# This script installs configuration onto the current machine.
set -exo pipefail
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
# Function definitions
# Homebrew for macos
# https://brew.sh/
install_brew() {
if [[ $(command -v brew) == "" ]]; then
NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
else
echo "brew already installed: $(which brew)"
fi
}
# Homebrew on linux
# https://docs.brew.sh/Homebrew-on-Linux
install_linuxbrew() {
install_brew
test -d ~/.linuxbrew && eval "$(~/.linuxbrew/bin/brew shellenv)"
test -d /home/linuxbrew/.linuxbrew && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" >> ~/.bashrc
}
# oh-my-zsh
# https://ohmyz.sh/#install
install_oh_my_zsh() {
if [ ! -e ~/.oh-my-zsh ]; then
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
else
echo "oh-my-zsh already installed"
fi
}
# Rust
install_rustup() {
if [[ $(command -v rustup) == "" ]]; then
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
else
echo "rustup already installed: $(which rustup)"
fi
}
setup_vim() {
if [[ $(command -v vim) != "" ]]; then
# Install vim-plug
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
# Install vim dependencies.
vim -c 'PlugInstall | qa'
else
echo "vim not installed, skipping setup"
fi
}
# Install Process
# Additional non-default installs
if [ "${INSTALL_ALL}" = "yes" ]; then
# Platform specific setup
case $(uname) in
Darwin)
install_brew
;;
Linux)
install_linuxbrew
;;
esac
install_rustup
# Install the brew bundle for my preferences.
brew bundle --file="$DIR/Brewfile"
fi
install_oh_my_zsh
# Sync configuration files
"${DIR}/sync.sh" -o
setup_vim