dotwryn/setup/zsh.setup.zsh

29 lines
759 B
Bash
Raw Normal View History

2021-09-15 07:48:37 +00:00
#####################################################################
function SETUP__ZSH() {
2022-02-06 07:15:14 +00:00
ZSH__SET_DEFAULT_SHELL
2021-09-15 07:48:37 +00:00
ZSH__SOURCE_RC
}
#####################################################################
function ZSH__SET_DEFAULT_SHELL() {
2022-02-06 07:15:14 +00:00
local DEFAULT_SHELL=$(awk -F: -v user="$USER" '$1 == user {print $NF}' /etc/passwd)
CHECK 'setting zsh as default shell'
sudo chsh -s $(which zsh) $(whoami)>>$LOG 2>&1 \
2021-09-15 07:48:37 +00:00
&& OK || WARN 'failed to set zsh as default shell'
}
function ZSH__SOURCE_RC() {
local LOCAL_ZSHRC="$HOME/.zshrc";
local SOURCE_LINE="source $DOTWRYN_PATH/zsh/rc";
grep -q "^$SOURCE_LINE$" $LOCAL_ZSHRC && {
STATUS 'already set up zshrc'
} || {
CHECK 'setting up zshrc'
echo $SOURCE_LINE >> $LOCAL_ZSHRC \
&& OK || WARN
}
}