-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·46 lines (34 loc) · 1.39 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
#!/usr/bin/env bash
DOTFILES_ROOT=$(exec 2>/dev/null;cd -- $(dirname "$0"); unset PWD; /usr/bin/pwd || /bin/pwd || pwd)
# Helper function
generic_install() {
(which brew > /dev/null && brew install "$1") || sudo apt install -o DPkg::Options::="--force-confnew" -y "$1"
}
echo "Installing zsh..."
which zsh || generic_install zsh
echo "Installing oh-my-zsh..."
if [[ ! -f ~/.oh-my-zsh/oh-my-zsh.sh ]]; then
if [[ -d ~/.oh-my-zsh ]]; then
rm -rf ~/.oh-my-zsh
fi
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
fi
echo "Install zsh-syntax-highlighting"
if [[ ! -d ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting ]]; then
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
fi
echo "Linking dotfiles into $HOME"
rm $HOME/.zshrc
ln -s $DOTFILES_ROOT/zsh/zshrc $HOME/.zshrc
printf "$DOTFILES_ROOT/zsh/zshrc linked to $HOME/.zshrc\n"
rm -rf $HOME/.zsh && mkdir $HOME/.zsh
cd $HOME/.zsh
ln -s $DOTFILES_ROOT/zsh/aliases.zsh $HOME/.zsh/aliases.zsh
ln -s $DOTFILES_ROOT/zsh/plugins.zsh $HOME/.zsh/plugins.zsh
echo "Adding global gitignore"
rm $HOME/.gitignore_global
ln -s $DOTFILES_ROOT/.gitignore_global $HOME/.gitignore_global
git config --global core.excludesfile $HOME/.gitignore_global
echo "Reloading zsh"
source $HOME/.zshrc
echo "Done!"