diff --git a/README.md b/README.md index 05ecb9a..b07bca4 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,8 @@ Linux: macOS: ```brew install git neovim lsd tmux``` +On macOS, `install.sh` also installs the `font-jetbrains-mono-nerd-font` Homebrew cask. + From your users home directory (~/), execute: ```git clone gitea@git.24unix.net:tracer/dotfiles.git .config/dotfiles``` diff --git a/install.sh b/install.sh index 3d6d30c..a6e02df 100755 --- a/install.sh +++ b/install.sh @@ -105,6 +105,7 @@ apply_dotfiles() { if [ "$(uname -s)" = "Darwin" ]; then install_karabiner_config fi + install_fonts install_kitty_icon install_tmux_plugins install_powerlevel10k @@ -135,6 +136,15 @@ replace_dir() { link_dotfile() { source_path=$1 target_path=$2 + resolved_source_path=$(cd "$(dirname "$source_path")" && pwd)/$(basename "$source_path") + target_parent=$(dirname "$target_path") + resolved_target_parent=$(cd "$target_parent" 2>/dev/null && pwd || printf '%s' "$target_parent") + resolved_target_path=$resolved_target_parent/$(basename "$target_path") + + if [ "$resolved_source_path" = "$resolved_target_path" ]; then + skip "$target_path resolves to the source path; refusing to create a self-referential symlink." + return + fi if [ -L "$target_path" ]; then current_target=$(readlink "$target_path") @@ -188,6 +198,21 @@ install_kitty_icon() { echo } +install_fonts() { + if [ "$(uname -s)" != "Darwin" ]; then + return + fi + + if ! command_exists brew; then + skip "font installation: Homebrew is not installed." + return + fi + + echo "${BLUE}Installing fonts...${RESET}" + brew install --cask font-jetbrains-mono-nerd-font + echo +} + install_tmux_plugins() { echo "${BLUE}Installing tmux plugins...${RESET}"