119 lines
3.8 KiB
Bash
119 lines
3.8 KiB
Bash
#! /bin/bash
|
|
|
|
echo "$SHELL" | grep -q zsh
|
|
if [ $? -ne 0 ]; then
|
|
echo "Please run this script in zsh shell."
|
|
exit 1
|
|
fi
|
|
|
|
# git, fzf, zoxide are required
|
|
if ! command -v git >/dev/null 2>&1; then
|
|
echo "Git is not installed."
|
|
exit 1
|
|
fi
|
|
|
|
if ! command -v fzf >/dev/null 2>&1; then
|
|
echo "FZF is not installed."
|
|
exit 1
|
|
fi
|
|
|
|
if ! command -v zoxide >/dev/null 2>&1; then
|
|
echo "Zoxide is not installed."
|
|
exit 1
|
|
fi
|
|
|
|
if ! command -v python >/dev/null 2>&1; then
|
|
if ! command -v python3 >/dev/null 2>&1; then
|
|
echo "Python is not installed."
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
if ! command -v starship >/dev/null 2>&1; then
|
|
echo "Starship is not installed."
|
|
exit 1
|
|
fi
|
|
|
|
ZSH_POLYJUICE_PATH="$HOME/.TerminalPolyjuice"
|
|
PLUGINS_PATH="$ZSH_POLYJUICE_PATH/zsh/plugins"
|
|
|
|
# git clone zsh-autosuggestions
|
|
if [ ! -d "$PLUGINS_PATH"/zsh-autosuggestions ]; then
|
|
echo "Zsh Autosuggestions is not downloaded. Downloading..."
|
|
# git clone https://github.com/zsh-users/zsh-autosuggestions.git "$PLUGINS_PATH"/zsh-autosuggestions
|
|
git clone https://gitee.com/mirrors/zsh-autosuggestions.git "$PLUGINS_PATH"/zsh-autosuggestions
|
|
else
|
|
cd "$PLUGINS_PATH"/zsh-autosuggestions || exit 1
|
|
if [ ! -d .git ]; then
|
|
echo "Zsh Autosuggestions is not a git repository. Please remove $PLUGINS_PATH/zsh-autosuggestions and try again."
|
|
exit 1
|
|
else
|
|
echo "Zsh Autosuggestions is already exist. Updating..."
|
|
git pull
|
|
fi
|
|
fi
|
|
|
|
# git clone zsh-syntax-highlighting
|
|
if [ ! -d "$PLUGINS_PATH"/zsh-syntax-highlighting ]; then
|
|
echo "Zsh Syntax Highlighting is not downloaded. Downloading..."
|
|
# git clone https://github.com/zsh-users/zsh-syntax-highlighting.git "$PLUGINS_PATH"/zsh-syntax-highlighting
|
|
git clone https://gitee.com/mirrors/zsh-syntax-highlighting.git "$PLUGINS_PATH"/zsh-syntax-highlighting
|
|
else
|
|
cd "$PLUGINS_PATH"/zsh-syntax-highlighting || exit 1
|
|
if [ ! -d .git ]; then
|
|
echo "Zsh Syntax Highlighting is not a git repository. Please remove $PLUGINS_PATH/zsh-syntax-highlighting and try again."
|
|
exit 1
|
|
else
|
|
echo "Zsh Syntax Highlighting is already exist. Updating..."
|
|
git pull
|
|
fi
|
|
fi
|
|
|
|
# git clone zsh-autocomplete
|
|
if [ ! -d "$PLUGINS_PATH"/zsh-autocomplete ]; then
|
|
echo "Zsh Autocomplete is not downloaded. Downloading..."
|
|
# git clone https://github.com/marlonrichert/zsh-autocomplete.git "$PLUGINS_PATH"/zsh-autocomplete
|
|
git clone https://gitee.com/mirrors/zsh-autocomplete.git "$PLUGINS_PATH"/zsh-autocomplete
|
|
|
|
else
|
|
cd "$PLUGINS_PATH"/zsh-autocomplete || exit 1
|
|
if [ ! -d .git ]; then
|
|
echo "Zsh Autocomplete is not a git repository. Please remove $PLUGINS_PATH/zsh-autocomplete and try again."
|
|
exit 1
|
|
else
|
|
echo "Zsh Autocomplete is already exist. Updating..."
|
|
git pull
|
|
fi
|
|
fi
|
|
|
|
# git clone powerlevel10k
|
|
if [ ! -d "$PLUGINS_PATH"/fzf-tab ]; then
|
|
echo "fzf-tab is not downloaded. Downloading..."
|
|
git clone https://github.com/Aloxaf/fzf-tab.git "$PLUGINS_PATH"/fzf-tab
|
|
else
|
|
cd "$PLUGINS_PATH"/fzf-tab || exit 1
|
|
if [ ! -d .git ]; then
|
|
echo "fzf-tab is not a git repository. Please remove $PLUGINS_PATH/fzf-tab and try again."
|
|
exit 1
|
|
else
|
|
echo "fzf-tab is already exist. Updating..."
|
|
git pull
|
|
fi
|
|
fi
|
|
|
|
# git clone oh-my-zsh
|
|
if [ ! -d "$PLUGINS_PATH"/ohmyzsh ]; then
|
|
echo "Oh My Zsh is not downloaded. Downloading..."
|
|
# git clone https://github.com/ohmyzsh/ohmyzsh.git "$PATH_OHMYZSH"
|
|
git clone https://gitee.com/mirrors/ohmyzsh.git "$PLUGINS_PATH"/ohmyzsh
|
|
else
|
|
cd "$PLUGINS_PATH"/ohmyzsh || exit 2
|
|
if [ ! -d .git ]; then
|
|
echo "Oh My Zsh is not a git repository. Please remove $PLUGINS_PATH/ohmyzsh and try again."
|
|
exit 1
|
|
else
|
|
echo "Oh My Zsh is already exist. Updating..."
|
|
git pull
|
|
fi
|
|
fi
|