(install.sh, install_nvm.sh): refactor font installation logic to check for existing fonts before downloading, and remove redundant echo statement in install_nvm.sh

This commit is contained in:
Frank Qing
2025-05-28 15:11:24 +08:00
parent 18a56766c6
commit 5088da8a75
4 changed files with 55 additions and 5 deletions

View File

@@ -248,9 +248,29 @@ fi
echo -e "Installing Nerd Fonts version of Hack, Roboto Mono, DejaVu Sans Mono\n" echo -e "Installing Nerd Fonts version of Hack, Roboto Mono, DejaVu Sans Mono\n"
# Check and download Hack font if it doesn't exist
if [ ! -f ~/.fonts/HackNerdFont-Regular.ttf ]; then
echo "Downloading Hack Nerd Font..."
wget -q --show-progress -N https://github.com/ryanoasis/nerd-fonts/raw/master/patched-fonts/Hack/Regular/HackNerdFont-Regular.ttf -P ~/.fonts/ wget -q --show-progress -N https://github.com/ryanoasis/nerd-fonts/raw/master/patched-fonts/Hack/Regular/HackNerdFont-Regular.ttf -P ~/.fonts/
else
echo "Hack Nerd Font already exists, skipping download."
fi
# Check and download Roboto Mono font if it doesn't exist
if [ ! -f ~/.fonts/RobotoMonoNerdFont-Regular.ttf ]; then
echo "Downloading Roboto Mono Nerd Font..."
wget -q --show-progress -N https://github.com/ryanoasis/nerd-fonts/raw/master/patched-fonts/RobotoMono/Regular/RobotoMonoNerdFont-Regular.ttf -P ~/.fonts/ wget -q --show-progress -N https://github.com/ryanoasis/nerd-fonts/raw/master/patched-fonts/RobotoMono/Regular/RobotoMonoNerdFont-Regular.ttf -P ~/.fonts/
else
echo "Roboto Mono Nerd Font already exists, skipping download."
fi
# Check and download DejaVu Sans Mono font if it doesn't exist
if [ ! -f ~/.fonts/DejaVuSansMNerdFont-Regular.ttf ]; then
echo "Downloading DejaVu Sans Mono Nerd Font..."
wget -q --show-progress -N https://github.com/ryanoasis/nerd-fonts/raw/master/patched-fonts/DejaVuSansMono/Regular/DejaVuSansMNerdFont-Regular.ttf -P ~/.fonts/ wget -q --show-progress -N https://github.com/ryanoasis/nerd-fonts/raw/master/patched-fonts/DejaVuSansMono/Regular/DejaVuSansMNerdFont-Regular.ttf -P ~/.fonts/
else
echo "DejaVu Sans Mono Nerd Font already exists, skipping download."
fi
fc-cache -fv ~/.fonts fc-cache -fv ~/.fonts

View File

@@ -25,5 +25,3 @@ curl -s https://git.miomio.moe/mio/easyzsh/raw/branch/master/patch.sh | bash -s
# Restore original working directory # Restore original working directory
cd "$ORIGINAL_DIR" cd "$ORIGINAL_DIR"
echo -e "\nAll basic packages have been installed. Restart your terminal or run 'source ~/.zshrc' to start using them.\n"

28
install_pyenv.sh Executable file
View File

@@ -0,0 +1,28 @@
#!/bin/bash
# Save the original working directory
ORIGINAL_DIR="$(pwd)"
# Install pyenv (Python Version Manager) if it is not already installed
if command -v pyenv &> /dev/null; then
echo -e "pyenv is already installed\n"
else
echo -e "Installing pyenv (Python Version Manager)\n"
# Using the official pyenv installer (https://github.com/pyenv/pyenv-installer)
curl -fsSL https://pyenv.run | bash
# Load pyenv for the remainder of this script
export PYENV_ROOT="$HOME/.pyenv"
[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init - bash)"
fi
# OPTIONAL: Install the latest stable version of Python
# Uncomment the following line if you would like to automatically install it
# pyenv install 3.12.0 && pyenv global 3.12.0
# Apply the pyenv zsh configuration patch (downloads zshrc/pyenv.zsh to ~/.config/zshrc/pyenv.zsh)
curl -s https://git.miomio.moe/mio/easyzsh/raw/branch/master/patch.sh | bash -s pyenv
# Restore original working directory
cd "$ORIGINAL_DIR"

4
zshrc/pyenv.zsh Normal file
View File

@@ -0,0 +1,4 @@
# Initialize pyenv (Python Version Manager)
export PYENV_ROOT="$HOME/.pyenv"
[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH" # Add pyenv to PATH
eval "$(pyenv init - zsh)" # This loads pyenv