mirror of
https://github.com/ryanoasis/nerd-fonts.git
synced 2025-01-19 03:12:07 +02:00
archive-fonts: Fix various ShellCheck issues
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
This commit is contained in:
parent
335a38d78f
commit
a11fa2db53
@ -39,7 +39,7 @@ mini_readme="$outputdir/readme.md"
|
||||
cat "$root_dir/src/archive-readme.md" >> "$mini_readme"
|
||||
|
||||
# clear out the directory
|
||||
find "${outputdir:?}" -maxdepth 1 \( -name "${search_pattern}.zip" -o -name "${search_pattern}.tar.xz" \) -type f -print -delete
|
||||
find "${outputdir:?}" -maxdepth 1 \( -name "${search_pattern}.zip" -o -name "${search_pattern}.tar.xz" \) -type f -delete
|
||||
|
||||
find . -maxdepth 1 -iregex "\./$pattern" -type d | sort |
|
||||
while read -r filename; do
|
||||
@ -52,14 +52,15 @@ while read -r filename; do
|
||||
expected=$(find "${searchdir}" -iname "*.[ot]tf" -exec echo "+" \; | wc -l)
|
||||
echo "${LINE_PREFIX} Packing ${basename}.tar.xz (${expected} fonts)"
|
||||
# This finds all files, uniq on the filename (ignoring path):
|
||||
# shellcheck disable=SC2156 # It's hard enough with injection
|
||||
while IFS= read -d $'\0' -r descriptor; do
|
||||
path=$(echo ${descriptor} | sed 's/|.*//')
|
||||
file=$(echo ${descriptor} | sed 's/.*|//')
|
||||
if $(echo ${file} | grep -qi '.[ot]tf'); then
|
||||
path=${descriptor//|*/}
|
||||
file=${descriptor//*|/}
|
||||
if grep -qi '.[ot]tf' <<< "${file}" ; then
|
||||
expected=$((expected - 1))
|
||||
fi
|
||||
# Need to cd to the file because we want to archive 'flat' (without subdirs):
|
||||
x=$(cd "$path" && tar rf "$outputdir/$basename.tar" --no-recursion "$file")
|
||||
(cd "$path" && tar rf "$outputdir/$basename.tar" --no-recursion "$file")
|
||||
done < <(find "${searchdir}" -type f -exec bash -c 'printf "%s\000" "{}" | sed "s!\(.*\)/!\1|!"' \; | sort -z -u '-t|' -k2,2 | sort -z)
|
||||
|
||||
if [ $expected -ne 0 ]; then
|
||||
@ -67,7 +68,7 @@ while read -r filename; do
|
||||
echo "${LINE_PREFIX} Did not pack expected number of font files! Likely same font names for different paths."
|
||||
exit 1
|
||||
fi
|
||||
x=$(cd "${outputdir}" && tar rf "${outputdir}/${basename}.tar" "readme.md")
|
||||
(cd "${outputdir}" && tar rf "${outputdir}/${basename}.tar" "readme.md")
|
||||
xz -f -9 -T0 "${outputdir}/${basename}.tar"
|
||||
|
||||
# ZIP stuff:
|
||||
|
Loading…
x
Reference in New Issue
Block a user