#!/usr/bin/env bash set -euo pipefail SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)" WEBUI_DIR="$(cd -- "$SCRIPT_DIR/.." && pwd)" FONT_DIR="$WEBUI_DIR/assets/fonts" TARGET="$FONT_DIR/Cantarell-VF.otf" mkdir -p "$FONT_DIR" candidates=( "/usr/share/fonts/opentype/cantarell/Cantarell-VF.otf" "/usr/share/fonts/truetype/cantarell/Cantarell-VF.otf" "/usr/share/fonts/cantarell/Cantarell-VF.otf" ) for src in "${candidates[@]}"; do if [[ -f "$src" ]]; then install -o root -g root -m 0644 "$src" "$TARGET" echo "Vendored Cantarell font: $TARGET" exit 0 fi done found="$(find /usr/share/fonts -type f \( -iname 'Cantarell-VF.otf' -o -iname 'Cantarell*.otf' -o -iname 'Cantarell*.ttf' \) 2>/dev/null | head -n 1 || true)" if [[ -n "$found" && -f "$found" ]]; then install -o root -g root -m 0644 "$found" "$TARGET" echo "Vendored Cantarell font: $TARGET" exit 0 fi echo "Cantarell font file not found on this system." >&2 echo "Install fonts-cantarell, then rerun this script, or manually place Cantarell-VF.otf in: $FONT_DIR" >&2 exit 1