[OpenWrt-Devel] [PATCH] package-ipkg.mk: allow to install CC packages on older versions
Christian Schoenebeck
christian.schoenebeck at gmail.com
Wed Jan 21 04:36:31 EST 2015
Packages compiled on CC / trunk could not be installed on BB and before.
Why to block users from using updated packages like ca-certificates,
privoxy or updated luci-apps. Checks if default_postinst/prerm function
exists in /lib/functions.sh then run, otherwise run [xxx]-pkg script
if exists.
Signed-off-by: Christian Schoenebeck <christian.schoenebeck at gmail.com>
---
include/package-ipkg.mk | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/include/package-ipkg.mk b/include/package-ipkg.mk
index 77eaeb8..584ab95 100644
--- a/include/package-ipkg.mk
+++ b/include/package-ipkg.mk
@@ -195,13 +195,25 @@ $(_endef)
( \
echo "#!/bin/sh"; \
echo "[ \"\$$$${IPKG_NO_SCRIPT}\" = \"1\" ] && exit 0"; \
- echo ". \$$$${IPKG_INSTROOT}/lib/functions.sh"; \
- echo "default_postinst \$$$$0 \$$$$@"; \
+ echo "grep 'default_postinst' \$$$${IPKG_INSTROOT}/lib/functions.sh >/dev/null 2>&1 && {"; \
+ echo " . \$$$${IPKG_INSTROOT}/lib/functions.sh"; \
+ echo " default_postinst \$$$$0 \$$$$@"; \
+ echo "} || {"; \
+ echo " name=\$$$$(echo \$$$$(basename \$$$$0) | cut -d. -f1)"; \
+ echo " [ -f \$$$${IPKG_INSTROOT}/usr/lib/opkg/info/\$$$${name}.postinst-pkg ] && \\"; \
+ echo " . \$$$${IPKG_INSTROOT}/usr/lib/opkg/info/\$$$${name}.postinst-pkg \$$$$@"; \
+ echo "}"; \
) > postinst; \
( \
echo "#!/bin/sh"; \
- echo ". \$$$${IPKG_INSTROOT}/lib/functions.sh"; \
- echo "default_prerm \$$$$0 \$$$$@"; \
+ echo "grep 'default_prerm' \$$$${IPKG_INSTROOT}/lib/functions.sh >/dev/null 2>&1 && {"; \
+ echo " . \$$$${IPKG_INSTROOT}/lib/functions.sh"; \
+ echo " default_prerm \$$$$0 \$$$$@"; \
+ echo "} || {"; \
+ echo " name=\$$$$(echo \$$$$(basename \$$$$0) | cut -d. -f1)"; \
+ echo " [ -f \$$$${IPKG_INSTROOT}/usr/lib/opkg/info/\$$$${name}.prerm-pkg ] && \\"; \
+ echo " . \$$$${IPKG_INSTROOT}/usr/lib/opkg/info/\$$$${name}.prerm-pkg \$$$$@"; \
+ echo "}"; \
) > prerm; \
chmod 0755 prerm; \
$($(1)_COMMANDS) \
--
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list