diff --git a/coreutils-colorls.csh b/coreutils-colorls.csh index 8dadaeb..79613de 100755 --- a/coreutils-colorls.csh +++ b/coreutils-colorls.csh @@ -1,51 +1,45 @@ #! /bin/csh -f # color-ls initialization -if ( "$LS_COLORS" != '' ) then - #do not override user specified LS_COLORS and use them - alias ll 'ls -l --color=tty' - alias l. 'ls -d .* --color=tty' - alias ls 'ls --color=tty' - exit +if ( $?LS_COLORS ) then + if ( $LS_COLORS != "" ) then + #do not override user specified LS_COLORS and use them + goto finish + endif endif alias ll 'ls -l' alias l. 'ls -d .*' - set COLORS=/etc/DIR_COLORS if ($?TERM) then - if ( -e "/etc/DIR_COLORS.$TERM" ) then - set COLORS="/etc/DIR_COLORS.$TERM" - endif + if ( -e "/etc/DIR_COLORS.$TERM" ) then + set COLORS="/etc/DIR_COLORS.$TERM" + endif endif -if ( -f ~/.dircolors ) then - set COLORS=~/.dircolors -endif -if ( -f ~/.dir_colors ) then - set COLORS=~/.dir_colors +if ( -e "/etc/DIR_COLORS.256color" ) then + if ( "`infocmp $TERM | sed -n 's/.*colors#\([0-9]\+\).*/\1/p'`" == "256" ) then + set COLORS=/etc/DIR_COLORS.256color + endif endif +if ( -f ~/.dircolors ) set COLORS=~/.dircolors +if ( -f ~/.dir_colors ) set COLORS=~/.dir_colors if ($?TERM) then - if ( -f ~/.dircolors."$TERM" ) then - set COLORS=~/.dircolors."$TERM" - endif - if ( -f ~/.dir_colors."$TERM" ) then - set COLORS=~/.dir_colors."$TERM" - endif + if ( -f ~/.dircolors."$TERM" ) set COLORS=~/.dircolors."$TERM" + if ( -f ~/.dir_colors."$TERM" ) set COLORS=~/.dir_colors."$TERM" endif -if ( ! -e "$COLORS" ) then - exit -endif +if ( ! -e "$COLORS" ) exit -eval `dircolors -c $COLORS` - -if ( "$LS_COLORS" == '' ) then - exit -endif +eval `dircolors -c $COLORS 2>/dev/null` +if ( "$LS_COLORS" == '' ) exit set color_none=`sed -n '/^COLOR.*none/Ip' < $COLORS` -if ( "$color_none" == '' ) then - alias ll 'ls -l --color=tty' - alias l. 'ls -d .* --color=tty' - alias ls 'ls --color=tty' +if ( "$color_none" != '' ) then + unset color_none + exit endif unset color_none + +finish: +alias ll 'ls -l --color=tty' +alias l. 'ls -d .* --color=tty' +alias ls 'ls --color=tty' diff --git a/coreutils-colorls.sh b/coreutils-colorls.sh index 87ee4e9..9caef03 100755 --- a/coreutils-colorls.sh +++ b/coreutils-colorls.sh @@ -1,28 +1,25 @@ # color-ls initialization -if [ -n "$LS_COLORS" ]; then - #do not override user LS_COLORS but use them - alias ll='ls -l --color=tty' 2>/dev/null - alias l.='ls -d .* --color=tty' 2>/dev/null - alias ls='ls --color=tty' 2>/dev/null - return +if [ -z "$LS_COLORS" ]; then + #do not override user LS_COLORS, so perform only for zero sized LS_COLORS + alias ll='ls -l' 2>/dev/null + alias l.='ls -d .*' 2>/dev/null + + COLORS=/etc/DIR_COLORS + [ -e "/etc/DIR_COLORS.$TERM" ] && COLORS="/etc/DIR_COLORS.$TERM" + [ -e "/etc/DIR_COLORS.256color" ] && \ + [ "`infocmp $TERM | sed -n 's/.*colors#\([0-9]\+\).*/\1/p'`" -eq 256 ] && \ + COLORS="/etc/DIR_COLORS.256color" + [ -e "$HOME/.dircolors" ] && COLORS="$HOME/.dircolors" + [ -e "$HOME/.dir_colors" ] && COLORS="$HOME/.dir_colors" + [ -e "$HOME/.dircolors.$TERM" ] && COLORS="$HOME/.dircolors.$TERM" + [ -e "$HOME/.dir_colors.$TERM" ] && COLORS="$HOME/.dir_colors.$TERM" + [ -e "$COLORS" ] || return + + eval `dircolors --sh "$COLORS" 2>/dev/null` + [ -z "$LS_COLORS" ] && return + egrep -qi "^COLOR.*none" $COLORS >/dev/null 2>/dev/null && return fi -alias ll='ls -l' 2>/dev/null -alias l.='ls -d .*' 2>/dev/null - -COLORS=/etc/DIR_COLORS -[ -e "/etc/DIR_COLORS.$TERM" ] && COLORS="/etc/DIR_COLORS.$TERM" -[ -e "$HOME/.dircolors" ] && COLORS="$HOME/.dircolors" -[ -e "$HOME/.dir_colors" ] && COLORS="$HOME/.dir_colors" -[ -e "$HOME/.dircolors.$TERM" ] && COLORS="$HOME/.dircolors.$TERM" -[ -e "$HOME/.dir_colors.$TERM" ] && COLORS="$HOME/.dir_colors.$TERM" -[ -e "$COLORS" ] || return - -eval `dircolors --sh "$COLORS" 2>/dev/null` -[ -z "$LS_COLORS" ] && return - -if ! egrep -qi "^COLOR.*none" $COLORS >/dev/null 2>/dev/null ; then - alias ll='ls -l --color=tty' 2>/dev/null - alias l.='ls -d .* --color=tty' 2>/dev/null - alias ls='ls --color=tty' 2>/dev/null -fi +alias ll='ls -l --color=tty' 2>/dev/null +alias l.='ls -d .* --color=tty' 2>/dev/null +alias ls='ls --color=tty' 2>/dev/null diff --git a/coreutils.spec b/coreutils.spec index 5234ac0..e2756d2 100644 --- a/coreutils.spec +++ b/coreutils.spec @@ -1,7 +1,7 @@ Summary: The GNU core utilities: a set of tools commonly used in shell scripts Name: coreutils Version: 6.10 -Release: 4%{?dist} +Release: 5%{?dist} License: GPLv3+ Group: System Environment/Base Url: http://www.gnu.org/software/coreutils/ @@ -291,6 +291,10 @@ fi /sbin/runuser %changelog +* Mon Feb 4 2008 Ondrej Vasik - 6.10-5 +- enabled 256-color support in colorls shell scripts(#429121) +- fixed syntax error in csh script(#431315) + * Thu Jan 31 2008 Ondrej Vasik - 6.10-4 - forgotten return in colorls.sh change