Currently all package postinst scripts are saved as postinst-pkg and interpreted
by script in base-files. Thus those don't work if you have old base-files.
Updating generating script to make it work even with old base-files.

Signed-off-by: Michal Hrusecky <michal.hruse...@nic.cz>
---
 include/package-ipkg.mk | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/include/package-ipkg.mk b/include/package-ipkg.mk
index eb4c874..124e228 100644
--- a/include/package-ipkg.mk
+++ b/include/package-ipkg.mk
@@ -196,8 +196,13 @@ $(_endef)
                ( \
                        echo "#!/bin/sh"; \
                        echo "[ \"\$$$${IPKG_NO_SCRIPT}\" = \"1\" ] && exit 0"; 
\
+                       echo "pkgname=\"\$$$$(basename \$$$${0%.*})\""; \
                        echo ". \$$$${IPKG_INSTROOT}/lib/functions.sh"; \
-                       echo "default_postinst \$$$$0 \$$$$@"; \
+                       echo "if type default_postinst > /dev/null; then"; \
+                       echo "  default_postinst \$$$$0 \$$$$@ || true"; \
+                       echo "elif [ -f 
\"\$$$${IPKG_INSTROOT}/usr/lib/opkg/info/\$$$${pkgname}.postinst-pkg\" ]; 
then"; \
+                       echo "  . 
\"\$$$${IPKG_INSTROOT}/usr/lib/opkg/info/\$$$${pkgname}.postinst-pkg\""; \
+                       echo "fi"; \
                ) > postinst; \
                ( \
                        echo "#!/bin/sh"; \
-- 
2.7.2
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to