less: add ALTERNATIVES

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>
This commit is contained in:
Josef Schlehofer 2020-04-21 23:30:48 +02:00
parent 4caa759c8f
commit 0ae161ecb6
No known key found for this signature in database
GPG Key ID: B950216FE4329F4C
1 changed files with 4 additions and 15 deletions

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