"rm -f" after failed starter/template thumbnail

If `convert` fails, and didn't generate a file at all, `make` would
abort due to `rm` being unable to delete the non-existent broken
thumbnail.  Using `rm -f` now, so it doesn't abort if the thumbnail
file didn't get created AT ALL.

h/t Luc
This commit is contained in:
Bill Kendrick 2023-05-01 13:56:43 -07:00
parent fa9a0c5955
commit 2327fc58e7

View file

@ -4,7 +4,7 @@
# Various contributors (see AUTHORS.txt) # Various contributors (see AUTHORS.txt)
# https://tuxpaint.org/ # https://tuxpaint.org/
# June 14, 2002 - April 30, 2023 # June 14, 2002 - May 1, 2023
# The version number, for release: # The version number, for release:
@ -858,7 +858,7 @@ $(THUMB_STARTERS):
convert $(CONVERT_OPTS) obj/tmp_$(notdir $(STARTER_NAME)).png $@ 2> /dev/null ; \ convert $(CONVERT_OPTS) obj/tmp_$(notdir $(STARTER_NAME)).png $@ 2> /dev/null ; \
rm obj/tmp_$(notdir $(STARTER_NAME)).png ; \ rm obj/tmp_$(notdir $(STARTER_NAME)).png ; \
else \ else \
convert $(CONVERT_OPTS) $(STARTER_NAME) $@ 2> /dev/null || ( echo "($@ failed)" ; rm $@ ) ; \ convert $(CONVERT_OPTS) $(STARTER_NAME) $@ 2> /dev/null || ( echo "($@ failed)" ; rm -f $@ ) ; \
fi fi
$(INSTALLED_THUMB_STARTERS): $(DATA_PREFIX)/%: % install-example-starters-dirs $(INSTALLED_THUMB_STARTERS): $(DATA_PREFIX)/%: % install-example-starters-dirs
@ -913,7 +913,7 @@ TEMPLATE_NAME=$(or $(wildcard $(subst templates/.thumbs,templates,$(@:-t.png=.sv
$(THUMB_TEMPLATES): $(THUMB_TEMPLATES):
@printf "." @printf "."
@mkdir -p templates/.thumbs @mkdir -p templates/.thumbs
@convert $(CONVERT_OPTS) $(TEMPLATE_NAME) $@ 2> /dev/null || ( echo "($@ failed)" ; rm $@ ) ; \ @convert $(CONVERT_OPTS) $(TEMPLATE_NAME) $@ 2> /dev/null || ( echo "($@ failed)" ; rm -f $@ ) ; \
$(INSTALLED_THUMB_TEMPLATES): $(DATA_PREFIX)/%: % $(INSTALLED_THUMB_TEMPLATES): $(DATA_PREFIX)/%: %
@install -D -m 644 $< $@ || ( echo "NO THUMB $<" ) @install -D -m 644 $< $@ || ( echo "NO THUMB $<" )