From 0be4e649f873b7df90f9e111c1004f4e3738d79a Mon Sep 17 00:00:00 2001 From: Matt Singleton Date: Mon, 28 Feb 2022 15:49:39 -0600 Subject: only download fonts if fc-cache is installed --- deploy.sh | 56 +++++++++++++++++++++++++++++--------------------------- 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/deploy.sh b/deploy.sh index a9ca903..1e7f273 100755 --- a/deploy.sh +++ b/deploy.sh @@ -92,32 +92,34 @@ if [ ! -e "$dconfig/excludes" ]; then fi # download nerdfonts -new_font=0 -function get_font { - local font_name="$1" - local font_url="$2" - shift 2 - local font_dir="$HOME/.local/share/fonts/$font_name" - mkdir -p "$font_dir" - if [ ! -d "$font_dir" ] || [ -z "$(ls -A "$font_dir" 2> /dev/null)" ]; then - $DLCMD "$font_dir/font.zip" "$font_url" - $UNZIPCMD "$font_dir/font.zip" "$@" -d "$font_dir" - rm "$font_dir/font.zip" - new_font=1 +if command -v fc-cache > /dev/null; then + new_font=0 + function get_font { + local font_name="$1" + local font_url="$2" + shift 2 + local font_dir="$HOME/.local/share/fonts/$font_name" + mkdir -p "$font_dir" + if [ ! -d "$font_dir" ] || [ -z "$(ls -A "$font_dir" 2> /dev/null)" ]; then + $DLCMD "$font_dir/font.zip" "$font_url" + $UNZIPCMD "$font_dir/font.zip" "$@" -d "$font_dir" + rm "$font_dir/font.zip" + new_font=1 + fi + } + get_font sourcecodepro-nerd \ + https://github.com/ryanoasis/nerd-fonts/releases/download/v2.1.0/SourceCodePro.zip \ + "Sauce Code Pro Medium Nerd Font Complete.ttf" \ + "Sauce Code Pro Bold Nerd Font Complete.ttf" \ + "Sauce Code Pro Medium Italic Nerd Font Complete.ttf" \ + "Sauce Code Pro Bold Italic Nerd Font Complete.ttf" + get_font jetbrainsmono-nerd \ + https://github.com/ryanoasis/nerd-fonts/releases/download/v2.1.0/JetBrainsMono.zip \ + "JetBrains Mono Regular Nerd Font Complete Mono.ttf" \ + "JetBrains Mono Italic Nerd Font Complete Mono.ttf" \ + "JetBrains Mono Bold Nerd Font Complete Mono.ttf" \ + "JetBrains Mono Bold Italic Nerd Font Complete Mono.ttf" + if [ "$new_font" = "1" ]; then + echo "Hint: Run 'fc-cache -v' to rebuild your font cache" fi -} -get_font sourcecodepro-nerd \ - https://github.com/ryanoasis/nerd-fonts/releases/download/v2.1.0/SourceCodePro.zip \ - "Sauce Code Pro Medium Nerd Font Complete.ttf" \ - "Sauce Code Pro Bold Nerd Font Complete.ttf" \ - "Sauce Code Pro Medium Italic Nerd Font Complete.ttf" \ - "Sauce Code Pro Bold Italic Nerd Font Complete.ttf" -get_font jetbrainsmono-nerd \ - https://github.com/ryanoasis/nerd-fonts/releases/download/v2.1.0/JetBrainsMono.zip \ - "JetBrains Mono Regular Nerd Font Complete Mono.ttf" \ - "JetBrains Mono Italic Nerd Font Complete Mono.ttf" \ - "JetBrains Mono Bold Nerd Font Complete Mono.ttf" \ - "JetBrains Mono Bold Italic Nerd Font Complete Mono.ttf" -if [ "$new_font" = "1" ]; then - echo "Hint: Run 'fc-cache -v' to rebuild your font cache" fi -- cgit v1.2.3