-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_zsh.sh
More file actions
executable file
·71 lines (58 loc) · 1.54 KB
/
setup_zsh.sh
File metadata and controls
executable file
·71 lines (58 loc) · 1.54 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
#!/bin/bash
set -e
DOTFILES_ROOT=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)
FONTS_PATH=~/.fonts
DOTFILES_CUSTOM_THEMES=${DOTFILES_ROOT}/oh-my-zsh/themes/
ZSH_CUSTOM_THEMES=~/.oh-my-zsh/custom/themes/
ZSH_CONFIG_FILE=~/.zshrc
main() {
_install_font
_install_zsh
_install_oh_my_zsh
_configure_theme_oh_my_zsh
_enable_custom_theme
}
function _install_zsh(){
if ! zsh --version &> /dev/null; then
echo "Instalando ZSH"
sudo apt update && sudo apt install zsh -y
chsh -s /bin/zsh
else
echo "ZSH já está instalado"
fi
}
function _install_oh_my_zsh(){
if [ ! -d ~/.oh-my-zsh ]; then
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
else
echo "oh my zsh já está instalado"
fi
}
function _configure_theme_oh_my_zsh(){
if [[ -d ~/.oh-my-zsh ]]; then
if [[ -d ${DOTFILES_CUSTOM_THEMES} ]]; then
for item in "${DOTFILES_CUSTOM_THEMES}"*; do
if [[ -f "$item" ]]; then
file=$(basename $item)
ln -s ${item} ${ZSH_CUSTOM_THEMES}${file}
fi
done
echo "\nLinked custom themes path\n\n"
else
echo "Error: '$path' is not a valid directory."
fi
fi
}
function _install_font(){
if [ ! -d ${FONTS_PATH} ]; then
mkdir ${FONTS_PATH}
fi
cp ${DOTFILES_ROOT}"/"oh-my-zsh/fonts/* ${FONTS_PATH}
fc-cache -fv
}
function _enable_custom_theme(){
echo ${ZSH_CONFIG_FILE}
/bin/sed -i 's/ZSH_THEME=\".*/ZSH_THEME=\"agnoster-homer\"/g' ${ZSH_CONFIG_FILE}
cat ${ZSH_CONFIG_FILE} | grep ZSH_THEME
}
main