particle-os-modules/modules/fonts/sources/nerd-fonts.sh
fiftydinar cb0c3bde8b chore(fonts): Force clean then regenerate font cache
Should fix some corner cases where font is not applied.

Fixes: #213
2024-09-17 13:56:58 +02:00

25 lines
673 B
Bash

#!/usr/bin/env bash
set -euo pipefail
mapfile -t FONTS <<< "$@"
URL="https://github.com/ryanoasis/nerd-fonts/releases/latest/download"
DEST="/usr/share/fonts/nerd-fonts"
echo "Installation of nerd-fonts started"
rm -rf "${DEST}"
mkdir -p /tmp/fonts
for FONT in "${FONTS[@]}"; do
FONT=${FONT// /} # remove spaces
if [ ${#FONT} -gt 0 ]; then
mkdir -p "${DEST}/${FONT}"
echo "Downloading ${FONT} from ${URL}/${FONT}.tar.xz"
curl "${URL}/${FONT}.tar.xz" -L -o "/tmp/fonts/${FONT}.tar.xz"
tar -xf "/tmp/fonts/${FONT}.tar.xz" -C "${DEST}/${FONT}"
fi
done
rm -rf /tmp/fonts
fc-cache --system-only --really-force "${DEST}"