call utilities in colorls.* scripts with full path (#1222140)

This commit is contained in:
Ondřej Vašík 2015-06-04 10:47:11 +02:00
parent ac62214984
commit 58ee24949f
3 changed files with 21 additions and 18 deletions

View File

@ -16,7 +16,7 @@ set COLORS=/etc/DIR_COLORS
if ($?TERM) then
if ( -e "/etc/DIR_COLORS.256color" ) then
if ( "`tput colors`" == "256" ) then
if ( "`/usr/bin/tput colors`" == "256" ) then
set COLORS=/etc/DIR_COLORS.256color
endif
endif
@ -30,29 +30,29 @@ if ($?TERM) then
if ( -f ~/.dircolors."$TERM" ) set COLORS=~/.dircolors."$TERM"
if ( -f ~/.dir_colors."$TERM" ) set COLORS=~/.dir_colors."$TERM"
endif
set INCLUDE="`cat "$COLORS" | grep '^INCLUDE' | cut -d ' ' -f2-`"
set INCLUDE="`/usr/bin/cat "$COLORS" | /usr/bin/grep '^INCLUDE' | /usr/bin/cut -d ' ' -f2-`"
if ( ! -e "$COLORS" ) exit
set _tmp="`mktemp .colorlsXXX -q --tmpdir=/tmp`"
set _tmp="`/usr/bin/mktemp .colorlsXXX -q --tmpdir=/tmp`"
#if mktemp fails, exit when include was active, otherwise use $COLORS file
if ( "$_tmp" == '' ) then
if ( "$INCLUDE" == '' ) then
eval "`dircolors -c $COLORS`"
eval "`/usr/bin/dircolors -c $COLORS`"
endif
goto cleanup
endif
if ( "$INCLUDE" != '' ) cat "$INCLUDE" >> $_tmp
grep -v '^INCLUDE' "$COLORS" >> $_tmp
if ( "$INCLUDE" != '' ) /usr/bin/cat "$INCLUDE" >> $_tmp
/usr/bin/grep -v '^INCLUDE' "$COLORS" >> $_tmp
eval "`dircolors -c $_tmp`"
eval "`/usr/bin/dircolors -c $_tmp`"
rm -f $_tmp
/usr/bin/rm -f $_tmp
if ( "$LS_COLORS" == '' ) exit
cleanup:
set color_none=`sed -n '/^COLOR.*none/Ip' < $COLORS`
set color_none=`/usr/bin/sed -n '/^COLOR.*none/Ip' < $COLORS`
if ( "$color_none" != '' ) then
unset color_none
exit

View File

@ -15,7 +15,7 @@ if [ -z "$USER_LS_COLORS" ]; then
for colors in "$HOME/.dir_colors.$TERM" "$HOME/.dircolors.$TERM" \
"$HOME/.dir_colors" "$HOME/.dircolors"; do
[ -e "$colors" ] && COLORS="$colors" && \
INCLUDE="`cat "$COLORS" | grep '^INCLUDE' | cut -d ' ' -f2-`" && \
INCLUDE="`/usr/bin/cat "$COLORS" | /usr/bin/grep '^INCLUDE' | /usr/bin/cut -d ' ' -f2-`" && \
break
done
@ -23,7 +23,7 @@ if [ -z "$USER_LS_COLORS" ]; then
COLORS="/etc/DIR_COLORS.$TERM"
[ -z "$COLORS" ] && [ -e "/etc/DIR_COLORS.256color" ] && \
[ "x`tty -s && tput colors 2>/dev/null`" = "x256" ] && \
[ "x`/usr/bin/tty -s && /usr/bin/tput colors 2>/dev/null`" = "x256" ] && \
COLORS="/etc/DIR_COLORS.256color"
[ -z "$COLORS" ] && [ -e "/etc/DIR_COLORS" ] && \
@ -34,16 +34,16 @@ if [ -z "$USER_LS_COLORS" ]; then
if [ -e "$INCLUDE" ];
then
TMP="`mktemp .colorlsXXX -q --tmpdir=/tmp`"
TMP="`/usr/bin/mktemp .colorlsXXX -q --tmpdir=/tmp`"
[ -z "$TMP" ] && return
cat "$INCLUDE" >> $TMP
grep -v '^INCLUDE' "$COLORS" >> $TMP
/usr/bin/cat "$INCLUDE" >> $TMP
/usr/bin/grep -v '^INCLUDE' "$COLORS" >> $TMP
eval "`dircolors --sh $TMP 2>/dev/null`"
rm -f $TMP
eval "`/usr/bin/dircolors --sh $TMP 2>/dev/null`"
/usr/bin/rm -f $TMP
else
eval "`dircolors --sh $COLORS 2>/dev/null`"
eval "`/usr/bin/dircolors --sh $COLORS 2>/dev/null`"
fi
[ -z "$LS_COLORS" ] && return

View File

@ -1,7 +1,7 @@
Summary: A set of basic GNU tools commonly used in shell scripts
Name: coreutils
Version: 8.23
Release: 6%{?dist}
Release: 7%{?dist}
License: GPLv3+
Group: System Environment/Base
Url: http://www.gnu.org/software/coreutils/
@ -373,6 +373,9 @@ fi
%{_sbindir}/chroot
%changelog
* Thu Jun 04 2015 Ondrej Vasik <ovasik@redhat.com> - 8.23-7
- call utilities in colorls.* scripts with full path (#1222140)
* Mon Dec 01 2014 Ondrej Vasik <ovasik@redhat.com> - 8.23-6
- have the LC_TIME subdirs with lang macro (#1169027)