From patchwork Thu Jan 21 17:54:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Dickinson X-Patchwork-Id: 571290 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.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id CAF901402F0 for ; Fri, 22 Jan 2016 04:57:24 +1100 (AEDT) Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id CCE2428C648; Thu, 21 Jan 2016 18:54:36 +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=-0.3 required=5.0 tests=BAYES_00,RDNS_NONE autolearn=no version=3.3.2 Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 9A8B7280966 for ; Thu, 21 Jan 2016 18:54:12 +0100 (CET) X-policyd-weight: using cached result; rate:hard: -8.5 Received: from s2.neomailbox.net (unknown [5.148.176.60]) by arrakis.dune.hu (Postfix) with ESMTPS for ; Thu, 21 Jan 2016 18:54:12 +0100 (CET) From: openwrt@daniel.thecshore.com To: openwrt-devel@lists.openwrt.org Date: Thu, 21 Jan 2016 12:54:41 -0500 Message-Id: <1453398885-102144-2-git-send-email-openwrt@daniel.thecshore.com> In-Reply-To: <1453398885-102144-1-git-send-email-openwrt@daniel.thecshore.com> References: <1453398885-102144-1-git-send-email-openwrt@daniel.thecshore.com> Subject: [OpenWrt-Devel] [PATCH 1/5] include/package: Add generic macro for replacing BusyBox applets 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: , MIME-Version: 1.0 Errors-To: openwrt-devel-bounces@lists.openwrt.org Sender: "openwrt-devel" From: Daniel Dickinson There are a number of packages in base and feeds that provide full versions of commands that are provided by busybox either by default or as a configure option. Here we add a macro that makes installation/uninstallation of the full version work smoothly (so that --force-overwrite is unnecessary and so that so on uninstall the busybox functionality is restored, if the applicable applet has been included in busybox). It does require making sure that if busybox applet is installed in /bin that the full version is in /usr/bin and vice versa (and similarly with /sbin and /usr/sbin) so that the path of the file in the package doesn't conflict with the symlink to busybox that exists in the stock image, so that on installation/deinstallation of the package we simply point symlinks at the right target and at the same time that even if the command isn't in the 'standard' location there is a symlink so that any program or configuration that depends or defaults to a particular path still works. Signed-off-by: Daniel Dickinson --- include/package.mk | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/include/package.mk b/include/package.mk index 1dfbd68..012b504 100644 --- a/include/package.mk +++ b/include/package.mk @@ -233,6 +233,21 @@ define Build/IncludeOverlay endef endef +define Package/BusyBoxReplacement/Default + define Package/$(1)/postinst + #!/bin/sh + ln -sf $(3)/$(5) $${IPKG_INSTROOT}/$(2)/$(5) + $(6) + exit 0 + endef + define Package/$(1)/postrm + #!/bin/sh + /bin/busybox $(5) -h 2>&1 | grep -q BusyBox && ln -sf $(if $(4),$(4)/)busybox $(2)/$(5) || rm -f $(2)/$(5) + $(7) + exit 0 + endef +endef + define BuildPackage $(Build/IncludeOverlay) $(eval $(Package/Default))