-
Notifications
You must be signed in to change notification settings - Fork 1
/
install.sh
executable file
·75 lines (65 loc) · 2.13 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
# acquire default username
while true; do
echo "Is <$(logname)> your default user? [Y/n]"
read response
if [[ "$response" == "" || "$response" =~ [yY]([eE][sS])? ]]; then
default_user=$(logname)
break
elif [[ "$response" =~ [nN][oO]? ]]; then
echo "Please enter your default user:"
read default_user
break
fi
done
# install brew
if [[ ! -n $(which brew) ]]; then
echo "Installing Homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
# install dependencies
for dep in curl git python; do
if [[ ! -n $(which $dep) ]]; then
echo "Installing $dep..."
brew install $dep
fi
done
# install zsh
if [[ $(which zsh) != $HOME/zsh ]]; then
echo "Installing zsh..."
brew install zsh
fi
# set zsh as the default shell
chsh -s $(which zsh)
# install oh-my-zsh
if [[ ! -d ~/.oh-my-zsh ]]; then
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
fi
# install zsh plugins
if [[ ! -d ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions ]]; then
echo "Installing zsh-autosuggestions..."
git clone https://github.com/zsh-users/zsh-autosuggestions \
${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
fi
if [[ ! -d ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/fast-syntax-highlighting ]]; then
echo "Installing fast-syntax-highlighting..."
git clone https://github.com/zdharma-continuum/fast-syntax-highlighting.git \
${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/fast-syntax-highlighting
fi
if [[ ! -n $(which autojump) ]]; then
echo "Installing autojump..."
brew install autojump
fi
# install font: Menlo for Powerline
if [[ ! -f ~/Library/Fonts/Menlo\ for\ Powerline.ttf ]]; then
echo "Downloading Menlo for Powerline..."
git clone https://github.com/abertsch/Menlo-for-Powerline.git
mv Menlo-for-Powerline/* ~/Library/Fonts
rm -rf Menlo-for-Powerline
fi
# install trash
brew install trash
# modify .zshrc
python scripts/modify_zshrc.py $default_user
echo "Done"