40 lines
1.2 KiB
Bash
40 lines
1.2 KiB
Bash
#!/bin/bash
|
|
|
|
current_dir=$(dirname $(realpath "$0"))
|
|
|
|
[[ -f "$HOME/.zshenv" ]] || touch "$HOME/.zshenv"
|
|
if cat "$HOME/.zshenv" | grep -q "TERMINAL_POLYJUICE"; then
|
|
if [[ "$current_dir" != "$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
|
|
|
|
for i in "$@"; do
|
|
if [ "$i" = "install_ohmyzsh" ]; then
|
|
echo "Installing Oh My Zsh..."
|
|
zsh "$current_dir/install_ohmyzsh.sh"
|
|
if [ $? -ne 0 ]; then
|
|
echo "Oh My Zsh installation failed."
|
|
exit 1
|
|
fi
|
|
elif [ "$i" = "config_starship" ]; then
|
|
echo "Config Starship..."
|
|
zsh "$current_dir/config_starship.sh"
|
|
if [ $? -ne 0 ]; then
|
|
echo "Starship configuration failed."
|
|
exit 1
|
|
fi
|
|
elif [ "$i" = "check" ]; then
|
|
echo "chcking uninstalled software..."
|
|
zsh "$current_dir/check.sh"
|
|
if [ $? -ne 0 ]; then
|
|
echo "Check failed."
|
|
exit 1
|
|
fi
|
|
fi
|
|
done
|
|
echo "Run \"exec zsh\" to apply changes."
|
|
# exec zsh |