Update .local/share/chezmoi/home/Library/Fonts/run_onchange_after_add-fonts.tmpl
This commit is contained in:
parent
698eb49e2c
commit
ac5ae27392
1 changed files with 19 additions and 0 deletions
|
@ -0,0 +1,19 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
{{- includeTemplate "universal/logg" }}
|
||||||
|
|
||||||
|
{{ $fontFiles := (output "find" (joinPath .chezmoi.homeDir ".local" "share" "fonts") "-type" "f") -}}
|
||||||
|
{{- range $fontFile := splitList "\n" $fontFiles -}}
|
||||||
|
{{- if ne $fontFile "" -}}
|
||||||
|
# {{ $fontFile }} hash: {{ $fontFile | sha256sum }}
|
||||||
|
{{ end -}}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
### Ensure all fonts are added to ~/Library/Fonts on macOS
|
||||||
|
find "$HOME/.local/share/fonts" -type f | while read FONT_FILE; do
|
||||||
|
BASENAME="$(basename "$FONT_FILE")"
|
||||||
|
if [ ! -f "$HOME/Library/Fonts/$BASENAME" ] || [ "$(openssl sha256 "$HOME/Library/Fonts/$BASENAME" | sed 's/.*= //')" != "$(openssl sha256 "$FONT_FILE" | sed 's/.*= //')" ]; then
|
||||||
|
logg info 'Adding `'"$BASENAME"'` to ~/Library/Fonts'
|
||||||
|
cp "$FONT_FILE" "$HOME/Library/Fonts/$BASENAME"
|
||||||
|
fi
|
||||||
|
done
|
Loading…
Reference in a new issue