Browse Source

gzip: alternatives instead of postinst

Signed-off-by: Huangbin Zhan <zhanhb88@gmail.com>
Huangbin Zhan 1 year ago
parent
commit
77cc346438
1 changed files with 9 additions and 20 deletions
  1. 9 20
      utils/gzip/Makefile

+ 9 - 20
utils/gzip/Makefile

@@ -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))
-