postinst trigger: the new postinst trigger broke IB
authorJohn Crispin <john@openwrt.org>
Tue, 16 Sep 2014 11:56:19 +0000 (11:56 +0000)
committerJohn Crispin <john@openwrt.org>
Tue, 16 Sep 2014 11:56:19 +0000 (11:56 +0000)
Signed-off-by: John Crispin <blogic@openwrt.org>
SVN-Revision: 42571

include/package-ipkg.mk
package/Makefile
package/base-files/files/lib/functions.sh
target/imagebuilder/files/Makefile

index 494444613ae66079e883907bfa3520513827482c..7cea44af656a9294ea34e94dca8bdee003f00dd5 100644 (file)
@@ -176,6 +176,7 @@ ifeq ($(DUMP),)
        chmod 644 $$(IDIR_$(1))/CONTROL/control
        ( \
                echo "#!/bin/sh"; \
+               echo "[ \"\$$$${IPKG_NO_SCRIPT}\" = \"1\" ] && exit 0"; \
                echo ". \$$$${IPKG_INSTROOT}/lib/functions.sh"; \
                echo "default_postinst \$$$$0 \$$$$@"; \
        ) > $$(IDIR_$(1))/CONTROL/postinst
index a42b4b0dd01100981a8f627504a3e44e80c6d860..a6b34be0f485c650971e1771de417ec6aa666cc6 100644 (file)
@@ -59,6 +59,7 @@ endif
 
 # where to build (and put) .ipk packages
 OPKG:= \
+  IPKG_NO_SCRIPT=1 \
   IPKG_TMP=$(TMP_DIR)/ipkg \
   IPKG_INSTROOT=$(TARGET_DIR) \
   IPKG_CONF_DIR=$(STAGING_DIR)/etc \
@@ -108,9 +109,8 @@ $(curdir)/install: $(TMP_DIR)/.build
        @mkdir -p $(TARGET_DIR)/etc/rc.d
        @( \
                cd $(TARGET_DIR); \
-               for script in ./etc/init.d/*; do \
-                       grep '#!/bin/sh /etc/rc.common' $$script >/dev/null || continue; \
-                       IPKG_INSTROOT=$(TARGET_DIR) $$(which bash) ./etc/rc.common $$script enable; \
+               for script in ./usr/lib/opkg/info/*.postinst; do \
+                       IPKG_INSTROOT=$(TARGET_DIR) $$(which bash) $$script; \
                done || true \
        )
        @-find $(TARGET_DIR) -name CVS   | $(XARGS) rm -rf
index 67f4a046e595c0a0a862cf739c521e6a2afd73a1..fafb7a340fe7c69dacb7506eb464fe8b4a8c4ea1 100755 (executable)
@@ -197,9 +197,12 @@ default_postinst() {
                        done
                done
        }
-       [ -n "${IPKG_INSTROOT}" -o "$PKG_UPGRADE" = "1" ] || for i in `cat /usr/lib/opkg/info/${name}.list | grep "^/etc/init.d/"`; do
-               $i enable
-               $i start
+       [ "$PKG_UPGRADE" = "1" ] || for i in `cat ${IPKG_INSTROOT}/usr/lib/opkg/info/${name}.list | grep "^/etc/init.d/"`; do
+               [ -n "${IPKG_INSTROOT}" ] && $(which bash) ${IPKG_INSTROOT}/etc/rc.common ${IPKG_INSTROOT}$i enable; \
+               [ -n "${IPKG_INSTROOT}" ] || {
+                       $i enable
+                       $i start
+               }
        done
        return 0
 }
index 72a91e074053fd5bafa05ee43c4b5c231557b681..8136111b670a0eadddf25edbdb181aff874e7b23 100644 (file)
@@ -54,6 +54,7 @@ help: FORCE
 # override variables from rules.mk
 PACKAGE_DIR:=$(TOPDIR)/packages
 OPKG:= \
+  IPKG_NO_SCRIPT=1 \
   IPKG_TMP="$(TOPDIR)/tmp/ipkgtmp" \
   IPKG_INSTROOT="$(TARGET_DIR)" \
   IPKG_CONF_DIR="$(TOPDIR)/tmp" \
@@ -142,12 +143,12 @@ package_postinst: FORCE
        @rm -f $(TARGET_DIR)/tmp/opkg.lock
        @echo
        @echo Activating init scripts
+       @mkdir -p $(TARGET_DIR)/etc/rc.d
        @( \
                cd $(TARGET_DIR); \
-               for script in ./etc/init.d/*; do \
-                       grep '#!/bin/sh /etc/rc.common' $$script >/dev/null || continue; \
-                       IPKG_INSTROOT=$(TARGET_DIR) $(which bash) ./etc/rc.common $$script enable; \
-               done || true; \
+               for script in ./usr/lib/opkg/info/*.postinst; do \
+                       IPKG_INSTROOT=$(TARGET_DIR) $$(which bash) $$script; \
+               done || true \
        )
        rm -f $(TARGET_DIR)/usr/lib/opkg/info/*.postinst
        $(if $(CONFIG_CLEAN_IPKG),rm -rf $(TARGET_DIR)/usr/lib/opkg)