Author: blogic
Date: 2014-09-16 13:56:19 +0200 (Tue, 16 Sep 2014)
New Revision: 42571

Modified:
   trunk/include/package-ipkg.mk
   trunk/package/Makefile
   trunk/package/base-files/files/lib/functions.sh
   trunk/target/imagebuilder/files/Makefile
Log:
postinst trigger: the new postinst trigger broke IB

Signed-off-by: John Crispin <[email protected]>

Modified: trunk/include/package-ipkg.mk
===================================================================
--- trunk/include/package-ipkg.mk       2014-09-16 11:55:57 UTC (rev 42570)
+++ trunk/include/package-ipkg.mk       2014-09-16 11:56:19 UTC (rev 42571)
@@ -176,6 +176,7 @@
        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

Modified: trunk/package/Makefile
===================================================================
--- trunk/package/Makefile      2014-09-16 11:55:57 UTC (rev 42570)
+++ trunk/package/Makefile      2014-09-16 11:56:19 UTC (rev 42571)
@@ -59,6 +59,7 @@
 
 # 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 @@
        @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

Modified: trunk/package/base-files/files/lib/functions.sh
===================================================================
--- trunk/package/base-files/files/lib/functions.sh     2014-09-16 11:55:57 UTC 
(rev 42570)
+++ trunk/package/base-files/files/lib/functions.sh     2014-09-16 11:56:19 UTC 
(rev 42571)
@@ -197,9 +197,12 @@
                        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
 }

Modified: trunk/target/imagebuilder/files/Makefile
===================================================================
--- trunk/target/imagebuilder/files/Makefile    2014-09-16 11:55:57 UTC (rev 
42570)
+++ trunk/target/imagebuilder/files/Makefile    2014-09-16 11:56:19 UTC (rev 
42571)
@@ -54,6 +54,7 @@
 # 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 @@
        @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)
_______________________________________________
openwrt-commits mailing list
[email protected]
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-commits

Reply via email to