This repository has been archived by the owner on Jul 29, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
executable file
·101 lines (84 loc) · 2.15 KB
/
setup.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
91
92
93
94
95
96
97
98
99
100
101
#!/usr/bin/env bash
set -e
remove_current_installation() {
rm -rf ~/.zsh
}
install_zsh_with_brew() {
brew install zsh zsh-completions
if brew ls --versions zsh > /dev/null; then
echo 'zsh already installed'
else
brew install zsh
fi
if brew ls --versions zsh-completions > /dev/null; then
echo 'zsh-completions already installed'
else
brew install zsh-completions
fi
}
install_fonts() {
brew tap homebrew/cask-fonts
if brew cask ls --versions font-hack-nerd-font > /dev/null; then
echo 'nerd fonts already installed'
else
brew cask install font-hack-nerd-font
fi
}
backup_affected_configuration_files() {
if [[ -f ~/.zshrc ]]; then
mv ~/.zshrc ~/.zshrc.bak
fi
if [[ -f ~/.profile ]]; then
mv ~/.profile ~/.profile.bak
fi
if [[ -f ~/.zsh_plugins.txt ]]; then
mv ~/.zsh_plugins.txt ~/.zsh_plugins.txt.bak
fi
}
setup_zsh_configuration() {
backup_affected_configuration_files
path_of_repository="$( cd "$(dirname "$0")" ; pwd -P )"
cp "$path_of_repository/.zshrc" ~/.zshrc
chmod 0700 ~/.zshrc
cp "$path_of_repository/.profile" ~/.profile
chmod 0700 ~/.profile
cp "$path_of_repository/.zsh_plugins.txt" ~/.zsh_plugins.txt
chmod 0600 ~/.zsh_plugins.txt
}
install_git_duet() {
brew tap git-duet/tap
if brew ls --versions git-duet > /dev/null; then
echo 'git-duet already installed'
else
brew install git-duet
fi
}
install_antibody() {
if brew ls --versions getantibody/tap/antibody > /dev/null; then
echo 'getantibody/tap/antibody already installed'
else
brew install getantibody/tap/antibody
fi
}
install_fzf() {
if brew ls --versions fzf > /dev/null; then
echo 'fzf already installed'
else
brew install fzf
fi
}
install_thefuck() {
if brew ls --versions thefuck > /dev/null; then
echo 'thefuck already installed'
else
brew install thefuck
fi
}
remove_current_installation
install_zsh_with_brew
install_antibody
install_fonts
install_git_duet
install_fzf
install_thefuck
setup_zsh_configuration