update to 590 [release 590-1mamba;Mon Jul 12 2021]
This commit is contained in:
parent
146fd3133e
commit
1448bc6a16
@ -3,6 +3,5 @@
|
||||
The less utility is a text file browser that resembles more, but has more capabilities.
|
||||
Less allows you to move backwards in the file as well as forwards.
|
||||
Since less doesn't have to read the entire input file before it starts, less starts up more quickly than text editors (for example, vi).
|
||||
|
||||
You should install less because it is a basic utility for viewing text files, and you'll use it frequently.
|
||||
|
||||
|
25
less.spec
25
less.spec
@ -1,11 +1,11 @@
|
||||
Name: less
|
||||
Version: 563
|
||||
Version: 590
|
||||
Release: 1mamba
|
||||
Summary: A text file browser similar to more, but better
|
||||
Group: Applications/File
|
||||
Vendor: openmamba
|
||||
Distribution: openmamba
|
||||
Packager: Davide Madrisan <davide.madrisan@gmail.com>
|
||||
Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
|
||||
URL: http://www.greenwoodsoftware.com/less/
|
||||
Source0: http://www.greenwoodsoftware.com/less/less-%{version}.tar.gz
|
||||
Source1: lesspipe.sh
|
||||
@ -16,15 +16,15 @@ License: GPL
|
||||
BuildRequires: glibc-devel
|
||||
BuildRequires: libncurses-devel
|
||||
## AUTOBUILDREQ-END
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-root
|
||||
|
||||
%description
|
||||
The less utility is a text file browser that resembles more, but has more capabilities.
|
||||
Less allows you to move backwards in the file as well as forwards.
|
||||
Since less doesn't have to read the entire input file before it starts, less starts up more quickly than text editors (for example, vi).
|
||||
|
||||
You should install less because it is a basic utility for viewing text files, and you'll use it frequently.
|
||||
|
||||
%debug_package
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
# fix permisions
|
||||
@ -32,14 +32,13 @@ chmod 644 COPYING LICENSE NEWS README
|
||||
|
||||
%build
|
||||
%configure \
|
||||
--bindir=/bin \
|
||||
--with-regex=posix
|
||||
|
||||
%make
|
||||
|
||||
%install
|
||||
[ "%{buildroot}" != / ] && rm -rf %{buildroot}
|
||||
%makeinstall bindir=/bin
|
||||
%makeinstall
|
||||
|
||||
install -d %{buildroot}/etc/profile.d
|
||||
install -D -m 755 %{S:1} %{buildroot}%{_bindir}/lesspipe.sh
|
||||
@ -51,18 +50,22 @@ install -c -m 755 %{S:3} %{buildroot}%{_sysconfdir}/profile.d/less.csh
|
||||
|
||||
%files
|
||||
%defattr(-,root,root)
|
||||
/bin/less
|
||||
/bin/lessecho
|
||||
/bin/lesskey
|
||||
%{_bindir}/lesspipe.sh
|
||||
%{_sysconfdir}/profile.d/less.sh
|
||||
%{_sysconfdir}/profile.d/less.csh
|
||||
%{_bindir}/less
|
||||
%{_bindir}/lessecho
|
||||
%{_bindir}/lesskey
|
||||
%{_bindir}/lesspipe.sh
|
||||
%{_mandir}/man1/less.*
|
||||
%{_mandir}/man1/lessecho.*
|
||||
%{_mandir}/man1/lesskey.*
|
||||
%doc COPYING LICENSE NEWS README
|
||||
%doc COPYING LICENSE
|
||||
#NEWS README
|
||||
|
||||
%changelog
|
||||
* Mon Jul 12 2021 Silvan Calarco <silvan.calarco@mambasoft.it> 590-1mamba
|
||||
- update to 590
|
||||
|
||||
* Thu Oct 22 2020 Automatic Build System <autodist@mambasoft.it> 563-1mamba
|
||||
- automatic version update by autodist
|
||||
|
||||
|
241
lesspipe.sh
241
lesspipe.sh
@ -1,127 +1,128 @@
|
||||
#!/bin/sh -
|
||||
#!/bin/sh
|
||||
#
|
||||
# To use this filter with less, define LESSOPEN:
|
||||
# export LESSOPEN="|/usr/bin/lesspipe.sh %s"
|
||||
#
|
||||
# The script should return zero if the output was valid and non-zero
|
||||
# otherwise, so less could detect even a valid empty output
|
||||
# (for example while uncompressing gzipped empty file).
|
||||
# For backward-compatibility, this is not required by default. To turn
|
||||
# this functionality there should be another vertical bar (|) straight
|
||||
# after the first one in the LESSOPEN environment variable:
|
||||
# export LESSOPEN="||/usr/bin/lesspipe.sh %s"
|
||||
|
||||
# Helper function to list contents of ISO files (CD images)
|
||||
iso_list() {
|
||||
isoinfo -d -i "$1"
|
||||
isoinfo -d -i "$1" | grep -q ^Rock\.Ridge && iiopts="$iiopts -R"
|
||||
isoinfo -d -i "$1" | grep -q ^Joliet && iiopts="$iiopts -J"
|
||||
echo
|
||||
isoinfo -f $iiopts -i "$1"
|
||||
}
|
||||
|
||||
lesspipe() {
|
||||
case `echo "$1" | tr '[:upper:]' '[:lower:]'` in
|
||||
*.[1-9n]|*.man|*.[1-9n].bz2|*.man.bz2|*.[1-9].gz|*.[1-9]x.gz|*.man.gz|*.[1-9].xz|*.[1-9]x.xz|*.man.xz)
|
||||
case `echo "$1" | tr '[:upper:]' '[:lower:]'` in
|
||||
*.gz) DECOMPRESSOR="gunzip -c" ;;
|
||||
*.bz2) DECOMPRESSOR="bunzip2 -c" ;;
|
||||
*.xz) DECOMPRESSOR="unxz -c" ;;
|
||||
*) DECOMPRESSOR="cat" ;;
|
||||
esac
|
||||
if $DECOMPRESSOR -- "$1" | file - | grep -q troff; then
|
||||
if echo "$1" | grep -q ^/; then #absolute path
|
||||
man -- "$1" | cat -s
|
||||
else
|
||||
man -- "./$1" | cat -s
|
||||
fi
|
||||
else
|
||||
$DECOMPRESSOR -- "$1"
|
||||
fi
|
||||
;;
|
||||
|
||||
*.tar.gz|*.tgz|*.tar.z|*.tar.dz)
|
||||
tar tzvf "$1" ;;
|
||||
|
||||
*.tar.xz)
|
||||
tar Jtvvf "$1" ;;
|
||||
|
||||
*.xz)
|
||||
if [ -x "`which xz`" ]; then xz -dc -- "$1"
|
||||
else echo "No xz available"; fi ;;
|
||||
|
||||
*.tar.bz2|*.tbz2)
|
||||
if [ -x "`which bunzip2`" ]; then bunzip2 -dc "$1" | tar tvvf -
|
||||
else echo "No bunzip2 available"; fi ;;
|
||||
|
||||
*.bin|*.raw)
|
||||
if [ -x "`which isoinfo`" ]; then
|
||||
file "$1" | grep -q ISO\.9660 && iso_list "$1"
|
||||
else
|
||||
echo "No isoinfo available"
|
||||
echo "Install mkisofs to view ISO images"
|
||||
fi ;;
|
||||
|
||||
*.bz2)
|
||||
if [ -x "`which bunzip2`" ]; then bunzip2 -dc "$1"
|
||||
else echo "No bunzip2 available"; fi ;;
|
||||
|
||||
*.cpi|*.cpio)
|
||||
cpio -itv < "$1" ;;
|
||||
|
||||
*.gz|*.z|*.dz)
|
||||
gzip -dc "$1" ;;
|
||||
|
||||
*.gif|*.jpeg|*.jpg|*.pcd|*.png|*.tga|*.tiff|*.tif)
|
||||
if [ -x "`which identify`" ]; then
|
||||
identify "$1"
|
||||
else
|
||||
echo "No identify available"
|
||||
echo "Install ImageMagick to browse images"
|
||||
fi ;;
|
||||
|
||||
*.iso)
|
||||
if [ -x "`which isoinfo`" ]; then iso_list "$1"
|
||||
else
|
||||
echo "No isoinfo available"
|
||||
echo "Install cdrtools to view ISO images"
|
||||
fi ;;
|
||||
|
||||
*.lha|*.lzh)
|
||||
if [ -x "`which lha`" ]; then lha v "$1"
|
||||
else echo "No lha available"; fi ;;
|
||||
|
||||
*.pdf)
|
||||
if [ -x "`which pdftotext`" ]; then pdftotext "$1" -
|
||||
else echo "No pdftotext available"; fi ;;
|
||||
|
||||
*.rar|*.r[0-9][0-9])
|
||||
if [ -x "`which unrar`" ]; then unrar v "$1"
|
||||
else echo "No rar or unrar available"; fi ;;
|
||||
|
||||
*.rpm)
|
||||
if [ -x "`which rpm`" ]; then
|
||||
echo "$1:"; rpm -q -i -p "$1"
|
||||
echo
|
||||
echo '*** Contents:'
|
||||
rpm -qlp "$1"
|
||||
else
|
||||
echo "rpm isn't available, no query on rpm package possible"
|
||||
fi ;;
|
||||
|
||||
*.tar)
|
||||
tar tvvf "$1" ;;
|
||||
|
||||
*.jar|*.war|*.ear|*.xpi)
|
||||
if [ -x "`which unzip`" ]; then unzip -v "$1";
|
||||
else echo "No unzip available"; fi ;;
|
||||
|
||||
*.zip)
|
||||
zipinfo -- "$1" ;;
|
||||
|
||||
esac
|
||||
}
|
||||
if [ ! -e "$1" ] ; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -d "$1" ] ; then
|
||||
/bin/ls -alF -- "$1"
|
||||
else
|
||||
# Allow for user defined filters
|
||||
if [ -x ~/.lessfilter ]; then
|
||||
~/.lessfilter "$1"
|
||||
exit 0
|
||||
else
|
||||
lesspipe "$1" 2>/dev/null
|
||||
fi
|
||||
ls -alF -- "$1"
|
||||
exit $?
|
||||
fi
|
||||
|
||||
exec 2>/dev/null
|
||||
|
||||
# Allow for user defined filters
|
||||
if [ -x ~/.lessfilter ]; then
|
||||
~/.lessfilter "$1"
|
||||
if [ $? -eq 0 ]; then
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
manfilter ()
|
||||
{
|
||||
if test -x /usr/bin/man ; then
|
||||
# See rhbz#1241543 for more info. Well, actually we firstly
|
||||
# used 'man -l', then we switched to groff, and then we again
|
||||
# switched back to 'man -l'.
|
||||
/usr/bin/man -P /usr/bin/cat -l "$1"
|
||||
elif test -x /usr/bin/groff; then
|
||||
# This is from pre-rhbz#1241543-time.
|
||||
groff -Tascii -mandoc "$1" | cat -s
|
||||
else
|
||||
echo "WARNING:"
|
||||
echo "WARNING: to better show manual pages, install 'man-db' package"
|
||||
echo "WARNING:"
|
||||
cat "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
export MAN_KEEP_FORMATTING=1
|
||||
|
||||
case "$1" in
|
||||
*.[1-9n].bz2|*.[1-9]x.bz2|*.man.bz2|*.[1-9n].[glx]z|*.[1-9]x.[glx]z|*.man.[glx]z|*.[1-9n].lzma|*.[1-9]x.lzma|*.man.lzma|*.[1-9n].zst|*.[1-9]x.zst|*.man.zst|*.[1-9n].br|*.[1-9]x.br|*.man.br)
|
||||
case "$1" in
|
||||
*.gz) DECOMPRESSOR="gzip -dc" ;;
|
||||
*.bz2) DECOMPRESSOR="bzip2 -dc" ;;
|
||||
*.lz) DECOMPRESSOR="lzip -dc" ;;
|
||||
*.zst) DECOMPRESSOR="zstd -dcq" ;;
|
||||
*.br) DECOMPRESSOR="brotli -dc" ;;
|
||||
*.xz|*.lzma) DECOMPRESSOR="xz -dc" ;;
|
||||
esac
|
||||
if [ -n "$DECOMPRESSOR" ] && $DECOMPRESSOR -- "$1" | file - | grep -q troff; then
|
||||
$DECOMPRESSOR -- "$1" | manfilter -
|
||||
exit $?
|
||||
fi ;;&
|
||||
*.[1-9n]|*.[1-9]x|*.man)
|
||||
if file "$1" | grep -q troff; then
|
||||
manfilter "$1"
|
||||
exit $?
|
||||
fi ;;&
|
||||
*.tar) tar tvvf "$1"; exit $? ;;
|
||||
*.tgz|*.tar.gz|*.tar.[zZ]) tar tzvvf "$1"; exit $? ;;
|
||||
*.tar.xz) tar Jtvvf "$1"; exit $? ;;
|
||||
*.xz|*.lzma) xz -dc -- "$1"; exit $? ;;
|
||||
*.tar.lz) tar --lzip -tvvf "$1"; exit $? ;;
|
||||
*.lz) lzip -dc -- "$1"; exit $? ;;
|
||||
*.tar.zst) tar --zstd -tvvf "$1"; exit $? ;;
|
||||
*.zst) zstd -dcq -- "$1"; exit $? ;;
|
||||
*.tar.br) brotli -dc -- "$1" | tar tvvf -; exit $? ;;
|
||||
*.br) brotli -dc -- "$1"; exit $? ;;
|
||||
*.tar.bz2|*.tbz2) bzip2 -dc -- "$1" | tar tvvf -; exit $? ;;
|
||||
*.[zZ]|*.gz) gzip -dc -- "$1"; exit $? ;;
|
||||
*.bz2) bzip2 -dc -- "$1"; exit $? ;;
|
||||
*.zip|*.jar|*.nbm) zipinfo -- "$1"; exit $? ;;
|
||||
# --nomanifest -> rhbz#1450277
|
||||
*.rpm) rpm -qpivl --changelog --nomanifest -- "$1"; exit $? ;;
|
||||
*.cpi|*.cpio) cpio -itv < "$1"; exit $? ;;
|
||||
*.gpg)
|
||||
if [ -x /usr/bin/gpg2 ]; then
|
||||
gpg2 -d "$1"
|
||||
exit $?
|
||||
elif [ -x /usr/bin/gpg ]; then
|
||||
gpg -d "$1"
|
||||
exit $?
|
||||
else
|
||||
echo "No GnuPG available."
|
||||
echo "Install gnupg2 or gnupg to show encrypted files."
|
||||
exit 1
|
||||
fi ;;
|
||||
*.gif|*.jpeg|*.jpg|*.pcd|*.png|*.tga|*.tiff|*.tif)
|
||||
if [ -x /usr/bin/identify ]; then
|
||||
identify "$1"
|
||||
exit $?
|
||||
elif [ -x /usr/bin/gm ]; then
|
||||
gm identify "$1"
|
||||
exit $?
|
||||
else
|
||||
echo "No identify available"
|
||||
echo "Install ImageMagick or GraphicsMagick to browse images"
|
||||
exit 1
|
||||
fi ;;
|
||||
*)
|
||||
if [ -x /usr/bin/file ] && [ -x /usr/bin/iconv ] && [ -x /usr/bin/cut ]; then
|
||||
case `file -b "$1"` in
|
||||
*UTF-16*) conv='UTF-16' ;;
|
||||
*UTF-32*) conv='UTF-32' ;;
|
||||
esac
|
||||
if [ -n "$conv" ]; then
|
||||
env=`echo $LANG | cut -d. -f2`
|
||||
if [ -n "$env" -a "$conv" != "$env" ]; then
|
||||
iconv -f $conv -t $env "$1"
|
||||
exit $?
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
exit 1
|
||||
esac
|
||||
|
Loading…
Reference in New Issue
Block a user