Browse Source

grep: alternatives instead of postinst

Signed-off-by: Huangbin Zhan <zhanhb88@gmail.com>
lilik-openwrt-22.03
Huangbin Zhan 4 years ago
parent
commit
413027e865
1 changed files with 9 additions and 15 deletions
  1. +9
    -15
      utils/grep/Makefile

+ 9
- 15
utils/grep/Makefile View 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))

Loading…
Cancel
Save