39 lines
1.3 KiB
Bash
39 lines
1.3 KiB
Bash
#!/bin/bash
|
|
|
|
current_dir=$(dirname "$0")
|
|
|
|
[[ ! -f "$HOME/.zshenv" ]] || touch "$HOME/.zshenv"
|
|
if cat "$HOME/.zshenv" | grep -q "\$TERMINAL_POLYJUICE"; then
|
|
if $(dirname "$0") != "$TERMINAL_POLYJUICE"; then
|
|
line_number=$(grep -n "\$TERMINAL_POLYJUICE" "$HOME/.zshenv" | cut -d: -f1)
|
|
sed -i "${line_number}c\\export TERMINAL_POLYJUICE=$current_dir" "$HOME/.zshenv"
|
|
fi
|
|
else
|
|
echo "export TERMINAL_POLYJUICE=$current_dir" >> "$HOME/.zshenv"
|
|
fi
|
|
|
|
if [ "$1" = "zsh" ]; then
|
|
if [ $# -gt 1 ]; then
|
|
for i in "${@:2}"; do
|
|
if [ "$i" = "install" ]; then
|
|
echo "Installing Oh My Zsh..."
|
|
zsh "$current_dir/zsh/install_ohmyzsh.sh"
|
|
elif [ "$i" = "ohmyzsh" ]; then
|
|
echo "Config Oh My Zsh..."
|
|
zsh "$current_dir/zsh/config_ohmyzsh.sh"
|
|
elif [ "$i" = "starship" ]; then
|
|
echo "Config Starship..."
|
|
zsh "$current_dir/zsh/config_starship.sh"
|
|
elif [ "$i" = "p10k" ]; then
|
|
echo "config powerlevel10k..."
|
|
zsh "$current_dir/zsh/config_p10k.sh"
|
|
elif [ "$i" = "check" ]; then
|
|
echo "chcking uninstalled software..."
|
|
zsh "$current_dir/zsh/check.sh"
|
|
fi
|
|
done
|
|
fi
|
|
echo "Run \"exec zsh\" to apply changes."
|
|
exec zsh
|
|
fi
|