less: add ALTERNATIVES 11915/head
authorJosef Schlehofer <pepe.schlehofer@gmail.com>
Tue, 21 Apr 2020 21:30:48 +0000 (23:30 +0200)
committerJosef Schlehofer <pepe.schlehofer@gmail.com>
Tue, 21 Apr 2020 21:36:42 +0000 (23:36 +0200)
This package can not be installed if you have installed less from
busybox.

Collected errors:
 * check_data_file_clashes: Package less wants to install file /bin/less
        But that file is already provided by package  * busybox
 * opkg_install_cmd: Cannot install package less.

To avoid this error, I moved it from /bin/less to /usr/bin/less.

If you install it now, it changes symlink from busybox to /usr/bin/less
/bin/less -> busybox*
/bin/less -> /usr/bin/less*

When you remove it, it changes symlink back to busybox.

That's why postint and postrm scripts are no longer needed.

Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com>
utils/less/Makefile

index 26a08ab688d03f274dbde747f0b2842b027a6268..6d4095073e00976c0f6dde0065f597db0f6bdd8b 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=less
 PKG_VERSION:=530
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://www.greenwoodsoftware.com/less
@@ -30,6 +30,7 @@ define Package/less/Default
   CATEGORY:=Utilities
   TITLE:=Pager program similar to more
   URL:=http://www.greenwoodsoftware.com/less/
+  ALTERNATIVES:=200:/bin/less:/usr/bin/less
 endef
 
 define Package/less/Default/description
@@ -69,20 +70,8 @@ ifeq ($(BUILD_VARIANT),wide)
 endif
 
 define Package/less/install
-       $(INSTALL_DIR) $(1)/bin
-       $(CP) $(PKG_INSTALL_DIR)/usr/bin/less $(1)/bin/less
-endef
-
-define Package/less/postinst
-#!/bin/sh
-[ -L "$${IPKG_INSTROOT}/usr/bin/less" ] && rm -f "$${IPKG_INSTROOT}/usr/bin/less"
-exit 0
-endef
-
-define Package/less/postrm
-#!/bin/sh
-/bin/busybox less -h 2>&1 | grep -q BusyBox && ln -sf ../../bin/busybox /usr/bin/less
-exit 0
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/less $(1)/usr/bin/less
 endef
 
 Package/less-wide/install = $(Package/less/install)