2016-11-13 19:25:35 +02:00
|
|
|
#!/bin/bash
|
2017-07-31 00:02:23 +02:00
|
|
|
# version: 1.1.0
|
2016-11-13 19:25:35 +02:00
|
|
|
# Iterates over all patched fonts directories
|
|
|
|
# to generate ruby cask files for homebrew-fonts (https://github.com/caskroom/homebrew-fonts)
|
2016-12-03 06:03:07 +02:00
|
|
|
# adds Windows versions of the fonts as well (casks files just won't download them)
|
2016-11-13 19:25:35 +02:00
|
|
|
|
|
|
|
#set -x
|
|
|
|
|
2017-01-16 00:23:30 +02:00
|
|
|
LINE_PREFIX="# [Nerd Fonts] "
|
|
|
|
|
2016-11-13 19:25:35 +02:00
|
|
|
cd ../../patched-fonts/ || {
|
2017-05-14 00:02:53 +02:00
|
|
|
echo >&2 "$LINE_PREFIX Could not find patched fonts directory"
|
2016-11-13 19:25:35 +02:00
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2017-01-16 00:23:30 +02:00
|
|
|
# limit archiving to given pattern (first script param) or entire root folder if no param given:
|
|
|
|
if [ $# -eq 1 ]
|
|
|
|
then
|
|
|
|
pattern="./$1"
|
|
|
|
echo "$LINE_PREFIX Limiting archive to pattern './$pattern'"
|
|
|
|
else
|
|
|
|
pattern="."
|
|
|
|
echo "$LINE_PREFIX No limting pattern given, will search entire folder"
|
|
|
|
fi
|
|
|
|
|
2016-11-13 19:25:35 +02:00
|
|
|
#find ./Hack -maxdepth 0 -type d | # uncomment to test 1 font
|
2016-11-19 03:27:38 +02:00
|
|
|
#find ./ProFont -maxdepth 0 -type d | # uncomment to test 1 font
|
2017-01-16 00:23:30 +02:00
|
|
|
find $pattern -maxdepth 1 -type d | # uncomment to test all fonts
|
2016-11-13 19:25:35 +02:00
|
|
|
while read -r filename
|
|
|
|
do
|
|
|
|
|
|
|
|
basename=$(basename "$filename")
|
|
|
|
searchdir=$filename
|
|
|
|
outputdir=$PWD/../archives/
|
|
|
|
|
|
|
|
[[ -d "$outputdir" ]] || mkdir -p "$outputdir"
|
|
|
|
|
2016-12-03 06:03:07 +02:00
|
|
|
zip "$outputdir/$basename" -rj "$searchdir" -i '*.[o,t]tf'
|
2016-11-13 19:25:35 +02:00
|
|
|
|
|
|
|
done
|