grep: alternatives instead of postinst
authorHuangbin Zhan <redacted>
Tue, 23 Jun 2020 14:32:33 +0000 (22:32 +0800)
committerHuangbin Zhan <redacted>
Tue, 23 Jun 2020 14:32:33 +0000 (22:32 +0800)
Signed-off-by: Huangbin Zhan <redacted>
utils/grep/Makefile

index f649690de3cc3529030e1fc0f990702d40037325..42b1c4f86432ed5dd1e2768f21b9fcd60fd3358f 100644 (file)
@@ -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))
git clone https://git.99rst.org/PROJECT