Accepting request 538587 from Base:System
Automatic submission by obs-autosubmit OBS-URL: https://build.opensuse.org/request/show/538587 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/less?expand=0&rev=52
This commit is contained in:
commit
453a1e5832
@ -1,3 +1,10 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Oct 27 06:03:36 UTC 2017 - werner@suse.de
|
||||
|
||||
- Let lessopen.sh also handle UTF-8 for (g)roff input, only apparmor
|
||||
as breaker of /usr/bin/file re,mains as "file" is not allowed to
|
||||
read files within the tool lessopen.sh
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Apr 28 11:45:22 UTC 2017 - werner@suse.de
|
||||
|
||||
|
46
lessopen.sh
46
lessopen.sh
@ -23,10 +23,20 @@ NAME="${SRC##*/}"
|
||||
|
||||
[ ! -r "$SRC" ] && exit 1
|
||||
|
||||
TMPF=$(mktemp /tmp/less.XXXXXX) || exit 1
|
||||
TMPF_pre=$(mktemp /tmp/less.XXXXXX) || { rm -f "$TMPF"; exit 1; }
|
||||
cleaner() {
|
||||
test "$TMPF_pre" = "$SRC" -o "$TMPF_pre" = "$TMPF" && return
|
||||
rm -f "$TMPF_pre"
|
||||
}
|
||||
trap 'cleaner' EXIT SIGHUP
|
||||
TMPF=$(mktemp /tmp/less.XXXXXXXXX) || exit 1
|
||||
TMPF_pre=$(mktemp /tmp/less.XXXXXXXXX) || exit 1
|
||||
|
||||
case $LANG in
|
||||
lang=$LANG
|
||||
test -n "$LC_CTYPE" && lang="$LC_CTYPE"
|
||||
case "$lang" in
|
||||
*.UTF-8|*.UTF8)
|
||||
GROFF_DEVICE=utf8
|
||||
;;
|
||||
ja*)
|
||||
GROFF_DEVICE=nippon
|
||||
;;
|
||||
@ -36,7 +46,7 @@ case $LANG in
|
||||
esac
|
||||
|
||||
CMD=
|
||||
type=`file -L "$SRC"`
|
||||
type=`/usr/bin/file -L "$SRC"`
|
||||
case ${type#"$SRC": } in
|
||||
*"gzip compressed data"*|\
|
||||
*"compress'd data"*|\
|
||||
@ -56,20 +66,20 @@ esac
|
||||
|
||||
test -n "$CMD" && $CMD "$SRC" >"$TMPF_pre" 2>/dev/null
|
||||
|
||||
type=`file -L "$TMPF_pre"`
|
||||
type=`/usr/bin/file -L "$TMPF_pre"`
|
||||
case ${type#"$TMPF_pre": } in
|
||||
*tar\ archive*)
|
||||
if [ -x "`which tar 2>/dev/null`" ]; then
|
||||
if [ -x "`/usr/bin/which tar 2>/dev/null`" ]; then
|
||||
tar tvvf "$TMPF_pre" >"$TMPF" 2>/dev/null
|
||||
else echo "tar is not available for preprocessing" 1>&2; rm -f "$TMPF"; TMPF="$TMPF_pre"; fi
|
||||
;;
|
||||
*Microsoft\ Cabinet\ *\ data*)
|
||||
if [ -x "`which cabextract 2>/dev/null`" ]; then
|
||||
if [ -x "`/usr/bin/which cabextract 2>/dev/null`" ]; then
|
||||
cabextract -l "$TMPF_pre" >"$TMPF" 2>/dev/null
|
||||
else echo "cabextract is not available for preprocessing" 1>&2; rm -f "$TMPF"; TMPF="$TMPF_pre"; fi
|
||||
;;
|
||||
*RPM*)
|
||||
if [ -x "`which rpm 2>/dev/null`" ]; then
|
||||
if [ -x "`/usr/bin/which rpm 2>/dev/null`" ]; then
|
||||
(echo -e "=============================== Information ====================================\n";
|
||||
rpm -qip "\"$TMPF_pre\"";
|
||||
echo -e "\n\n================================= Changelog (head) =============================\n";
|
||||
@ -80,24 +90,24 @@ test -n "$CMD" && $CMD "$SRC" >"$TMPF_pre" 2>/dev/null
|
||||
else echo "rpm is not available for preprocessing" 1>&2; rm -f "$TMPF"; TMPF="$TMPF_pre"; fi
|
||||
;;
|
||||
*DVI*)
|
||||
if [ -x "`which dvi2tty 2>/dev/null`" ]; then
|
||||
if [ -x "`/usr/bin/which dvi2tty 2>/dev/null`" ]; then
|
||||
if [ "${TMPF_pre%.dvi}" != "$TMPF_pre" ] ; then
|
||||
dvi2tty -q "$TMPF_pre" >"$TMPF" 2>/dev/null
|
||||
else echo "dvi2tty requires an input file name with the suffix .dvi" 1>&2; rm -f "$TMPF"; TMPF="$TMPF_pre" ; fi
|
||||
else echo "dvi2tty is not available for preprocessing" 1>&2; rm -f "$TMPF"; TMPF="$TMPF_pre"; fi
|
||||
;;
|
||||
*PDF*)
|
||||
if [ -x "`which pdftotext 2>/dev/null`" ]; then
|
||||
if [ -x "`/usr/bin/which pdftotext 2>/dev/null`" ]; then
|
||||
pdftotext "$TMPF_pre" "$TMPF" 2>/dev/null
|
||||
else echo "pdftotext is not available for preprocessing" 1>&2; rm -f "$TMPF"; TMPF="$TMPF_pre"; fi
|
||||
;;
|
||||
*Debian\ binary\ package*)
|
||||
if [ -x "`which dpkg-deb 2>/dev/null`" ]; then
|
||||
if [ -x "`/usr/bin/which dpkg-deb 2>/dev/null`" ]; then
|
||||
dpkg-deb -c "$TMPF_pre" >"$TMPF" 2>/dev/null
|
||||
else echo "dpkg-deb is not available for preprocessing" 1>&2; rm -f "$TMPF"; TMPF="$TMPF_pre"; fi
|
||||
;;
|
||||
*\ ar\ archive*)
|
||||
if [ -x "`which nm 2>/dev/null`" ]; then
|
||||
if [ -x "`/usr/bin/which nm 2>/dev/null`" ]; then
|
||||
nm "$TMPF_pre" >"$TMPF" 2>/dev/null
|
||||
else echo "nm is not available for preprocessing" 1>&2; rm -f "$TMPF"; TMPF="$TMPF_pre"; fi
|
||||
;;
|
||||
@ -130,7 +140,7 @@ test -n "$CMD" && $CMD "$SRC" >"$TMPF_pre" 2>/dev/null
|
||||
done
|
||||
# if we have -R and colordiff, we can continue
|
||||
if [ $R_NOT_SET = false ] && \
|
||||
[ -x "`which colordiff 2>/dev/null`" ]; then
|
||||
[ -x "`/usr/bin/which colordiff 2>/dev/null`" ]; then
|
||||
colordiff < "$TMPF_pre" | cat > "$TMPF" 2>/dev/null
|
||||
else rm -f "$TMPF"; TMPF="$TMPF_pre"; fi
|
||||
;;
|
||||
@ -138,7 +148,7 @@ test -n "$CMD" && $CMD "$SRC" >"$TMPF_pre" 2>/dev/null
|
||||
if [ "$LESS_ADVANCED_PREPROCESSOR" = "yes" ]; then
|
||||
case ${type#"$TMPF_pre": } in
|
||||
*troff*)
|
||||
if [ -x "`which groff 2>/dev/null`" ]; then
|
||||
if [ -x "`/usr/bin/which groff 2>/dev/null`" ]; then
|
||||
case "$NAME" in
|
||||
*.[1-9nxp]*|*.man|*.[1-9nxp]*.*|*.man.*)
|
||||
groff -s -p -t -e -T$GROFF_DEVICE -mandoc "$TMPF_pre" >"$TMPF" 2>/dev/null ;;
|
||||
@ -152,14 +162,14 @@ test -n "$CMD" && $CMD "$SRC" >"$TMPF_pre" 2>/dev/null
|
||||
else echo "groff is not available for preprocessing" 1>&2; rm -f "$TMPF"; TMPF="$TMPF_pre"; fi
|
||||
;;
|
||||
*PostScript*)
|
||||
if [ -x "`which ps2ascii 2>/dev/null`" ]; then
|
||||
if [ -x "`/usr/bin/which ps2ascii 2>/dev/null`" ]; then
|
||||
ps2ascii "$TMPF_pre" >"$TMPF" 2>/dev/null
|
||||
else echo "ps2ascii is not available for preprocessing" 1>&2; rm -f "$TMPF"; TMPF="$TMPF_pre"; fi
|
||||
;;
|
||||
*HTML*)
|
||||
if [ -x "`which w3m 2>/dev/null`" ]; then
|
||||
if [ -x "`/usr/bin/which w3m 2>/dev/null`" ]; then
|
||||
w3m -dump -T text/html "$TMPF_pre" >"$TMPF" 2>/dev/null
|
||||
elif [ -x "`which lynx 2>/dev/null`" ]; then
|
||||
elif [ -x "`/usr/bin/which lynx 2>/dev/null`" ]; then
|
||||
lynx -dump -force_html "$TMPF_pre" >"$TMPF" 2>/dev/null
|
||||
else echo "lynx/w3m not available for preprocessing" 1>&2; rm -f "$TMPF"; TMPF="$TMPF_pre"; fi
|
||||
;;
|
||||
@ -175,6 +185,4 @@ test -n "$CMD" && $CMD "$SRC" >"$TMPF_pre" 2>/dev/null
|
||||
;;
|
||||
esac
|
||||
|
||||
test "$TMPF_pre" = "$SRC" -o "$TMPF_pre" = "$TMPF" || rm "$TMPF_pre"
|
||||
|
||||
test "$TMPF" = "$SRC" || echo "$TMPF"
|
||||
|
Loading…
x
Reference in New Issue
Block a user