adjust dir structure
This commit is contained in:
@@ -13,28 +13,50 @@ else
|
||||
fi
|
||||
|
||||
for i in "$@"; do
|
||||
if [ "$i" = "install_ohmyzsh" ]; then
|
||||
echo "Installing Oh My Zsh..."
|
||||
zsh "$current_dir/install_ohmyzsh.sh"
|
||||
if [ "$i" = "install" ]; then
|
||||
echo "Installing related software..."
|
||||
zsh "$current_dir/function/install.sh"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Oh My Zsh installation failed."
|
||||
echo "related software installation failed."
|
||||
exit 1
|
||||
fi
|
||||
elif [ "$i" = "config_starship" ]; then
|
||||
echo "Config Starship..."
|
||||
zsh "$current_dir/config_starship.sh"
|
||||
zsh "$current_dir/function/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"
|
||||
echo "Checking uninstalled software..."
|
||||
zsh "$current_dir/function/check.sh"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Check failed."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# copying $HOME/.zshrc
|
||||
current_dir=$(dirname $(realpath "$0"))
|
||||
|
||||
if [ -f "$HOME/.zshrc" ]; then
|
||||
if $(file "$HOME/.zshrc" | grep -q "symbolic link") ; then
|
||||
if [[ $(readlink "$HOME/.zshrc") != "$current_dir/zshrc" ]]; then
|
||||
ln -sf "$current_dir/zshrc" "$HOME/.zshrc"
|
||||
fi
|
||||
else
|
||||
if [ ! -f "$HOME/.zshrc.bkp" ]; then
|
||||
mv "$HOME/.zshrc" "$HOME/.zshrc.bkp"
|
||||
ln -s "$current_dir/zshrc" "$HOME/.zshrc"
|
||||
else
|
||||
echo "Backup file already exists. Please remove $HOME/.zshrc.bkp and try again."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
else
|
||||
ln -s "$current_dir/zshrc" "$HOME/.zshrc"
|
||||
fi
|
||||
|
||||
echo "Run \"exec zsh\" to apply changes."
|
||||
# exec zsh
|
||||
Reference in New Issue
Block a user