From 413027e865b4038f71eeb14a2973a285eae494a3 Mon Sep 17 00:00:00 2001 From: Huangbin Zhan Date: Tue, 23 Jun 2020 22:32:33 +0800 Subject: [PATCH] grep: alternatives instead of postinst Signed-off-by: Huangbin Zhan --- utils/grep/Makefile | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/utils/grep/Makefile b/utils/grep/Makefile index f649690de..42b1c4f86 100644 --- a/utils/grep/Makefile +++ b/utils/grep/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=grep PKG_VERSION:=3.4 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@GNU/grep @@ -31,6 +31,10 @@ define Package/grep TITLE:=grep search utility - full version DEPENDS:=+libpcre URL:=https://www.gnu.org/software/grep/ + ALTERNATIVES:=\ + 300:/bin/egrep:/usr/libexec/egrep-gnu \ + 300:/bin/fgrep:/usr/libexec/fgrep-gnu \ + 300:/bin/grep:/usr/libexec/grep-gnu endef define Package/grep/description @@ -40,20 +44,10 @@ prints the matching lines. endef define Package/grep/install - $(INSTALL_DIR) $(1)/usr/bin - $(CP) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin -endef - -define Package/grep/postinst -#!/bin/sh -[ -L "$${IPKG_INSTROOT}/bin/grep" ] && rm -f "$${IPKG_INSTROOT}/bin/grep" -exit 0 -endef - -define Package/grep/prerm -$${IPKG_INSTROOT}/bin/busybox grep -h 2>&1 | grep -q BusyBox && \ -ln -sf busybox $${IPKG_INSTROOT}/bin/grep -exit 0 + $(INSTALL_DIR) $(1)/usr/libexec + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/egrep $(1)/usr/libexec/egrep-gnu + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/fgrep $(1)/usr/libexec/fgrep-gnu + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/grep $(1)/usr/libexec/grep-gnu endef $(eval $(call BuildPackage,grep))