[openwrt/openwrt] image: ignore errors from more commands

LEDE Commits lede-commits at lists.infradead.org
Wed Oct 30 06:18:00 PDT 2024


ansuel pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/def70fa85b242465ee14c69dc6f57cd42f860a5e

commit def70fa85b242465ee14c69dc6f57cd42f860a5e
Author: Christian Marangi <ansuelsmth at gmail.com>
AuthorDate: Wed Oct 30 14:05:10 2024 +0100

    image: ignore errors from more commands
    
    Ignore errors in more image commands to handle case where the image is
    too big and check-image validation fails.
    
    Signed-off-by: Christian Marangi <ansuelsmth at gmail.com>
---
 include/image-commands.mk | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/include/image-commands.mk b/include/image-commands.mk
index 702cbd8c98..2568fb3ade 100644
--- a/include/image-commands.mk
+++ b/include/image-commands.mk
@@ -316,12 +316,12 @@ define Build/elecom-product-header
 	$(eval product=$(word 1,$(1)))
 	$(eval fw=$(if $(word 2,$(1)),$(word 2,$(1)),$@))
 
-	( \
+	-( \
 		echo -n -e "ELECOM\x00\x00$(product)" | dd bs=40 count=1 conv=sync; \
 		echo -n "0.00" | dd bs=16 count=1 conv=sync; \
 		dd if=$(fw); \
-	) > $(fw).new
-	mv $(fw).new $(fw)
+	) > $(fw).new \
+	&& mv $(fw).new $(fw) || rm -f $(fw)
 endef
 
 define Build/elecom-wrc-gs-factory
@@ -351,10 +351,10 @@ define Build/elx-header
 		echo -ne "$$($(MKHASH) md5 $@ | fold -s2 | xargs -I {} echo \\x{} | tr -d '\n')" | \
 			dd bs=58 count=1 conv=sync; \
 	) > $(KDIR)/tmp/$(DEVICE_NAME).header
-	$(call Build/xor-image,-p $(xor_pattern) -x)
-	cat $(KDIR)/tmp/$(DEVICE_NAME).header $@ > $@.new
-	mv $@.new $@
-	rm -rf $(KDIR)/tmp/$(DEVICE_NAME).header
+	-$(call Build/xor-image,-p $(xor_pattern) -x) \
+	&& cat $(KDIR)/tmp/$(DEVICE_NAME).header $@ > $@.new \
+	&& mv $@.new $@ \
+	&& rm -rf $(KDIR)/tmp/$(DEVICE_NAME).header
 endef
 
 define Build/eva-image
@@ -614,8 +614,8 @@ define Build/seama-seal
 endef
 
 define Build/senao-header
-	$(STAGING_DIR_HOST)/bin/mksenaofw $(1) -e $@ -o $@.new
-	mv $@.new $@
+	-$(STAGING_DIR_HOST)/bin/mksenaofw $(1) -e $@ -o $@.new \
+	&& mv $@.new $@ || rm -f $@
 endef
 
 define Build/sysupgrade-tar
@@ -718,8 +718,8 @@ define Build/multiImage
 endef
 
 define Build/xor-image
-	$(STAGING_DIR_HOST)/bin/xorimage -i $@ -o $@.xor $(1)
-	mv $@.xor $@
+	-$(STAGING_DIR_HOST)/bin/xorimage -i $@ -o $@.xor $(1) \
+	&& mv $@.xor $@ || rm -f $@
 endef
 
 define Build/zip




More information about the lede-commits mailing list