install.fairie/home/Library/Fonts/run_onchange_after_add-fonts.tmpl
Brian Zalewski e58f91cb9e Update 9 files
- /home/dot_local/bin/run_onchange_ensure-executable.tmpl
- /home/dot_local/share/ansible/run_onchange_after_symlink-ansible-configs.tmpl
- /home/dot_ssh/run_onchanges_after_ensure-private-key.tmpl
- /home/dot_ssh/run_onchanges_after_generate-public-keys.tmpl
- /home/Library/Fonts/run_onchange_after_add-fonts.tmpl
- /system/usr/share/run_onchange_after_setup-share-folder
- /system/usr/local/share/run_onchange_after_setup-share-folder
- /system/var/log/user/run_onchange_after-symlink-user-logs
- /system/etc/default/modify_grub
2022-12-25 09:09:00 +00:00

20 lines
823 B
Bash

#!/usr/bin/env bash
{{ includeTemplate "universal/profile" }}
{{ 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