gnunnet: halt build if any command fails
authorEneas U de Queiroz <[email protected]>
Thu, 6 Oct 2022 13:02:59 +0000 (10:02 -0300)
committerDaniel Golle <[email protected]>
Thu, 6 Oct 2022 22:33:10 +0000 (23:33 +0100)
There are many places in the packages' install recipes whith multiple
commands being executed in the same shell invocation, separated with a
semicolon (;).  The return status will depend only on the last command
being run.  The same thing happens in loops, where only the last file
will determine the result of the command.

Change the ';' to '&&', and exit the loop if any operation fails.

Signed-off-by: Eneas U de Queiroz <[email protected]>
net/gnunet/Makefile

index 3c9187179ca07f0638a397558138dc409ab50aec..59c4062371eb71f4138746a06e86c4bca3430d2a 100644 (file)
@@ -97,42 +97,42 @@ define BuildComponent
 
   define Package/gnunet-$(1)/install
        ( if [ "$(BIN_$(1))" ]; then \
-               $(INSTALL_DIR) $$(1)/usr/bin ; \
+               $(INSTALL_DIR) $$(1)/usr/bin && \
                for bin in $(BIN_$(1)); do \
-                       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gnunet-$$$$$$$$bin $$(1)/usr/bin/ ; \
+                       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gnunet-$$$$$$$$bin $$(1)/usr/bin/ || exit 1; \
                done \
        fi )
 
        ( if [ "$(LIB_$(1))" ]; then \
-               $(INSTALL_DIR) $$(1)/usr/lib ; \
+               $(INSTALL_DIR) $$(1)/usr/lib && \
                for lib in $(LIB_$(1)); do \
-                       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libgnunet$$$$$$$$lib.so* $$(1)/usr/lib/ ; \
+                       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libgnunet$$$$$$$$lib.so* $$(1)/usr/lib/ || exit 1; \
                done \
        fi )
 
        ( if [ "$(PLUGIN_$(1))" ]; then \
-               $(INSTALL_DIR) $$(1)/usr/lib/gnunet ; \
+               $(INSTALL_DIR) $$(1)/usr/lib/gnunet && \
                for plug in $(PLUGIN_$(1)); do \
-                       $(CP) $(PKG_INSTALL_DIR)/usr/lib/gnunet/libgnunet_plugin_$$$$$$$$plug*.so $$(1)/usr/lib/gnunet ; \
+                       $(CP) $(PKG_INSTALL_DIR)/usr/lib/gnunet/libgnunet_plugin_$$$$$$$$plug*.so $$(1)/usr/lib/gnunet || exit 1; \
                done \
        fi )
 
        ( if [ "$(LIBEXEC_$(1))" ]; then \
-               $(INSTALL_DIR) $$(1)/usr/lib/gnunet/libexec ; \
+               $(INSTALL_DIR) $$(1)/usr/lib/gnunet/libexec && \
                for lex in $(LIBEXEC_$(1)); do \
-                       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/gnunet/libexec/gnunet-$$$$$$$$lex $$(1)/usr/lib/gnunet/libexec ; \
+                       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/gnunet/libexec/gnunet-$$$$$$$$lex $$(1)/usr/lib/gnunet/libexec || exit 1; \
                done \
        fi )
 
        ( if [ "$(CONF_$(1))" ]; then \
-               $(INSTALL_DIR) $$(1)/usr/share/gnunet/config.d ; \
+               $(INSTALL_DIR) $$(1)/usr/share/gnunet/config.d && \
                for conf in $(CONF_$(1)); do \
-               $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/gnunet/config.d/$$$$$$$$conf.conf $$(1)/usr/share/gnunet/config.d ; \
+               $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/gnunet/config.d/$$$$$$$$conf.conf $$(1)/usr/share/gnunet/config.d || exit 1; \
                done \
        fi )
 
        ( if [ -e ./files/gnunet-$(1).defaults ]; then \
-               $(INSTALL_DIR) $$(1)/etc/uci-defaults ; \
+               $(INSTALL_DIR) $$(1)/etc/uci-defaults && \
                $(INSTALL_BIN) ./files/gnunet-$(1).defaults $$(1)/etc/uci-defaults/gnunet-$(1) ; \
        fi )
   endef
@@ -146,7 +146,7 @@ define Package/gnunet/install
 
        ( for bin in arm ats cadet core config ecc identity nat nat-auto nat-server nse \
            peerinfo peerstore revocation scalarproduct scrypt statistics transport uri; do \
-               $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gnunet-$$$$bin $(1)/usr/bin/ ; \
+               $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gnunet-$$$$bin $(1)/usr/bin/ || exit 1; \
        done )
 
        ( for lib in arm ats block blockgroup cadet \
@@ -154,11 +154,11 @@ define Package/gnunet/install
            identity natauto natnew nse nt peerinfo peerstore regexblock regex revocation \
            scalarproduct set seti setu statistics transport transportapplication \
            transportcommunicator transportcore transportmonitor util; do \
-               $(CP) $(PKG_INSTALL_DIR)/usr/lib/libgnunet$$$$lib.so* $(1)/usr/lib/ ; \
+               $(CP) $(PKG_INSTALL_DIR)/usr/lib/libgnunet$$$$lib.so* $(1)/usr/lib/ || exit 1; \
        done )
 
        ( for plug in ats_proportional block_dht block_regex block_revocation dhtu_gnunet dhtu_ip transport_unix; do \
-               $(CP) $(PKG_INSTALL_DIR)/usr/lib/gnunet/libgnunet_plugin_$$$$plug*.so $(1)/usr/lib/gnunet ; \
+               $(CP) $(PKG_INSTALL_DIR)/usr/lib/gnunet/libgnunet_plugin_$$$$plug*.so $(1)/usr/lib/gnunet || exit 1; \
        done )
 
        ( for lex in communicator-unix daemon-topology helper-nat-client \
@@ -168,13 +168,13 @@ define Package/gnunet/install
            service-scalarproduct-alice service-scalarproduct-bob service-scalarproduct-ecc-alice \
            service-scalarproduct-ecc-bob service-set service-seti service-setu service-statistics \
            service-tng service-transport timeout; do \
-               $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/gnunet/libexec/gnunet-$$$$lex $(1)/usr/lib/gnunet/libexec ; \
+               $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/gnunet/libexec/gnunet-$$$$lex $(1)/usr/lib/gnunet/libexec || exit 1; \
        done )
 
        ( for conf in arm ats cadet communicator-unix core datacache dht dhtu identity \
            nat nat-auto nse peerinfo peerstore regex revocation \
            scalarproduct set seti setu statistics tlds topology transport util; do \
-               $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/gnunet/config.d/$$$$conf.conf $(1)/usr/share/gnunet/config.d ; \
+               $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/gnunet/config.d/$$$$conf.conf $(1)/usr/share/gnunet/config.d || exit 1; \
        done )
 
        $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/gnunet/hellos/* $(1)/usr/share/gnunet/hellos