Skip to content

Commit

Permalink
Use shell globbing
Browse files Browse the repository at this point in the history
Spaces in file-names will cause problems in the for loop
  • Loading branch information
JingMatrix committed Dec 7, 2022
1 parent 3858930 commit c20a7bc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions customize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ head -n -1 $(magisk --path)/.magisk/mirror/system/etc/fonts.xml >$MODPATH/system
set_perm_recursive $MODPATH/tool root root 700 700

ui_print "Injecting custom fonts"
for fontfile in $(ls $MODPATH/system/fonts); do
fontname=$(FONTCONFIG_PATH=$MODPATH/tool LD_LIBRARY_PATH=$MODPATH/tool $MODPATH/tool/fc-scan -f '%{postscriptname}' $MODPATH/system/fonts/$fontfile)
for fontfile in $MODPATH/system/fonts/*.*; do
fontname=$(FONTCONFIG_PATH=$MODPATH/tool LD_LIBRARY_PATH=$MODPATH/tool $MODPATH/tool/fc-scan -f '%{postscriptname}' "$fontfile")
ui_print "Add custom fonts $fontname"
echo ' <family name="'$fontname'">' >>$MODPATH/system/etc/fonts.xml
echo " <font>$fontfile</font>" >>$MODPATH/system/etc/fonts.xml
echo " <font>$(basename fontfile)</font>" >>$MODPATH/system/etc/fonts.xml
echo " </family>" >>$MODPATH/system/etc/fonts.xml
done

Expand Down

0 comments on commit c20a7bc

Please sign in to comment.