From patchwork Wed Jan 21 09:36:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Schoenebeck X-Patchwork-Id: 431394 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from arrakis.dune.hu (arrakis.dune.hu [78.24.191.176]) (using TLSv1.1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id F3A5B140280 for ; Wed, 21 Jan 2015 20:36:46 +1100 (AEDT) Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 1915D28BC2E; Wed, 21 Jan 2015 10:34:21 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on arrakis.dune.hu X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID autolearn=unavailable version=3.3.2 Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id E386528BC2E for ; Wed, 21 Jan 2015 10:34:14 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 CL_IP_EQ_HELO_IP=-2 (check from: .gmail. - helo: .mail-wi0-f179.google. - helo-domain: .google.) FROM/MX_MATCHES_HELO(DOMAIN)=-2; rate: -8.5 Received: from mail-wi0-f179.google.com (mail-wi0-f179.google.com [209.85.212.179]) by arrakis.dune.hu (Postfix) with ESMTPS for ; Wed, 21 Jan 2015 10:34:14 +0100 (CET) Received: by mail-wi0-f179.google.com with SMTP id l15so22508154wiw.0 for ; Wed, 21 Jan 2015 01:36:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=ryOETeY0vk4OyyWvyOrBolR1pY/MLH8P6LPAQb8eZqI=; b=SmgHjqUOlw5gkyEEhYu1vpZQdi26Ad8rJT3Xg51YE1sJvpmwP3KQR15WCh0lGRiZYz zn1uSV1DN9iEBjwqsbRBGfDR5/o45bl6ZTGv/T+TSlg/HhDgaHtr3VyjnCcYXwc19cOx H6I9X0XrtNlmvgYu/eTQWC3uzaQ6RApeh7w1xw7AUlW6vIEB/9xfKtbgpSUWXbc3OqCE +8GKr1l+oCfjg1ZYfue7sIxsSU6XkLa2kYtIz3RX9Sj1I9kM1VphqPMPWNBcSQxgM9ld JP3CS6O5r7MgJt89z6/ZnWg9Z01ashe75mqbxM+kMfhzT7KvV1qyXaX270wzOSUZOqqX KWRQ== X-Received: by 10.180.73.101 with SMTP id k5mr54373570wiv.43.1421832993496; Wed, 21 Jan 2015 01:36:33 -0800 (PST) Received: from [10.0.2.15] (pd907f256.dip0.t-ipconnect.de. [217.7.242.86]) by mx.google.com with ESMTPSA id js5sm6470438wid.11.2015.01.21.01.36.31 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Jan 2015 01:36:32 -0800 (PST) Message-ID: <54BF731F.7040308@gmail.com> Date: Wed, 21 Jan 2015 10:36:31 +0100 From: Christian Schoenebeck User-Agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: OpenWrt Development List Subject: [OpenWrt-Devel] [PATCH] package-ipkg.mk: allow to install CC packages on older versions X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openwrt-devel-bounces@lists.openwrt.org Sender: "openwrt-devel" 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 --- 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) \