sed: alternatives instead of postinst
authorHuangbin Zhan <zhanhb88@gmail.com>
Tue, 23 Jun 2020 14:40:35 +0000 (22:40 +0800)
committerHuangbin Zhan <zhanhb88@gmail.com>
Tue, 23 Jun 2020 14:40:35 +0000 (22:40 +0800)
Signed-off-by: Huangbin Zhan <zhanhb88@gmail.com>
utils/sed/Makefile

index 938728312c9713dcceabf5066c3b28c279d835d7..50b35de3c690d79932a113433e798ff3826ad42f 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=sed
 PKG_VERSION:=4.8
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=@GNU/sed
@@ -31,6 +31,7 @@ define Package/sed
   TITLE:=sed stream editor utility - full version
   DEPENDS:=+libpcre
   URL:=https://www.gnu.org/software/sed/
+  ALTERNATIVES:=300:/bin/sed:/usr/libexec/sed-gnu
 endef
 
 define Package/sed/description
@@ -42,22 +43,10 @@ occurrences of a string within a file.
 endef
 
 define Package/sed/install
-       $(INSTALL_DIR) $(1)/usr/bin
-       $(CP) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin
+       $(INSTALL_DIR) $(1)/usr/libexec
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/sed $(1)/usr/libexec/sed-gnu
 endef
 
 CONFIGURE_ARGS+= --disable-acl
 
-define Package/sed/postinst
-#!/bin/sh
-[ -L "$${IPKG_INSTROOT}/bin/sed" ] && rm -f "$${IPKG_INSTROOT}/bin/sed"
-exit 0
-endef
-
-define Package/sed/prerm
-$${IPKG_INSTROOT}/bin/busybox sed -h 2>&1 | grep -q BusyBox && \
-ln -sf busybox $${IPKG_INSTROOT}/bin/sed
-exit 0
-endef
-
 $(eval $(call BuildPackage,sed))