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

index 0b64553e3f1c13726f9574dbab3ff0dcd6b44f32..6a6eede46b8085d94cd8151e3da1718ac5eadcbd 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=gzip
 PKG_VERSION:=1.10
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=@GNU/gzip
@@ -29,6 +29,10 @@ define Package/gzip
   TITLE:=gzip (GNU zip) is a compression utility.
   URL:=https://www.gnu.org/software/gzip/
   MAINTAINER:=Christian Beier <dontmind@freeshell.org>
+  ALTERNATIVES:=\
+    300:/bin/gunzip:/usr/libexec/gunzip-gnu \
+    300:/bin/gzip:/usr/libexec/gzip-gnu \
+    300:/bin/zcat:/usr/libexec/zcat-gnu
 endef
 
 define Package/gzip/description
@@ -42,25 +46,10 @@ CONFIGURE_VARS += \
 
 define Package/gzip/install
        $(SED) 's,/bin/bash,/bin/sh,g' $(PKG_INSTALL_DIR)/usr/bin/{gunzip,zcat}
-       $(INSTALL_DIR) $(1)/usr/bin
-       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/{gunzip,gzip,zcat} $(1)/usr/bin/
-endef
-
-define Package/gzip/postinst
-#!/bin/sh
-for app in gunzip gzip zcat; do
-  ln -sf ../usr/bin/$$app $${IPKG_INSTROOT}/bin/$$app
-done
-endef
-
-define Package/gzip/postrm
-#!/bin/sh
-for app in gunzip gzip zcat; do
-  ln -sf busybox $${IPKG_INSTROOT}/bin/$$app
-  $${IPKG_INSTROOT}/bin/$$app 2>&1 | grep 'applet not found' > /dev/null 2>&1 && rm $${IPKG_INSTROOT}/bin/$$app
-done
-exit 0
+       $(INSTALL_DIR) $(1)/usr/libexec
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gunzip $(1)/usr/libexec/gunzip-gnu
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gzip $(1)/usr/libexec/gzip-gnu
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/zcat $(1)/usr/libexec/zcat-gnu
 endef
 
 $(eval $(call BuildPackage,gzip))
-