1
0
mirror of https://github.com/ryanoasis/nerd-fonts.git synced 2024-12-19 20:12:52 +02:00

docker: Allow blancs in filenames

[why]
The script does not allow blanks in the font filenames.
There are also some shell warnings when run.

[how]
Simplify and always use `parallel` to run the job, even when the user
selects just one job. The problem is deciding if the passed PN is the
number one or not. We do not want to fail, but the numeric comparison
operator fails on non numbers (sometimes).

Use null termination as usual to pass filenames with blanks from a find
into something else.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
This commit is contained in:
Fini Jastrow 2024-02-05 16:24:08 +01:00
parent c07e985406
commit 1fccd8a63e

View File

@ -20,19 +20,16 @@ while [ "$#" -gt 0 ]; do
shift
done
printf "Running with options:\n%s\n" "$args"
# shellcheck disable=SC2086
if [ "$PN" -eq 1 ]; then
find /in -type f \
\( -iname '*.otf' -o -iname '*.ttf' -o -iname '*.woff' -o -iname '*.eot' -o -iname '*.ttc' \) \
-exec fontforge -script /nerd/font-patcher -out /out $args {} \;
else
njob=""
[ "$PN" -gt 1 ] && njob="-j $PN"
find /in -type f \
\( -iname '*.otf' -o -iname '*.ttf' -o -iname '*.woff' -o -iname '*.eot' -o -iname '*.ttc' \) \
| parallel $njob fontforge -script /nerd/font-patcher -out /out $args {}
if [ -z "$PN" ]; then
PN=1
fi
printf "Running with options:\n%s\nParallelism %s\n" "$args" "$PN"
# shellcheck disable=SC2086
find /in -type f \
\( -iname '*.otf' -o -iname '*.ttf' -o -iname '*.woff' -o -iname '*.eot' -o -iname '*.ttc' \) \
-print0 \
| parallel --verbose --null "--jobs=${PN}" fontforge -script /nerd/font-patcher -out /out $args {}
exit 0