rootfs: fail on errors in postinst scripts
[openwrt/openwrt.git] / include / rootfs.mk
index 15f71ae0dfbf77f0571977950e2eef857fcf897b..b1617215a3ecfc1f380c8aad46c76022545fccc3 100644 (file)
@@ -60,6 +60,11 @@ define prepare_rootfs
                cd $(1); \
                for script in ./usr/lib/opkg/info/*.postinst; do \
                        IPKG_INSTROOT=$(1) $$(which bash) $$script; \
+                       ret=$$?; \
+                       if [ $$ret -ne 0 ]; then \
+                               echo "postinst script $$script has failed with exit code $$ret" >&2; \
+                               exit 1; \
+                       fi; \
                done; \
                for script in ./etc/init.d/*; do \
                        grep '#!/bin/sh /etc/rc.common' $$script >/dev/null || continue; \