diff --git a/coreutils-colorls.csh b/coreutils-colorls.csh index e244afb..3243484 100755 --- a/coreutils-colorls.csh +++ b/coreutils-colorls.csh @@ -10,6 +10,8 @@ endif alias ll 'ls -l' alias l. 'ls -d .*' set COLORS=/etc/DIR_COLORS +set TMP="`mktemp .colorlsXXX`" + if ($?TERM) then if ( -e "/etc/DIR_COLORS.$TERM" ) then set COLORS="/etc/DIR_COLORS.$TERM" @@ -26,10 +28,14 @@ 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-`" if ( ! -e "$COLORS" ) exit -eval "`dircolors -c $COLORS`" +if ( "$INCLUDE" != '' ) cat "$INCLUDE" > $TMP +cat "$COLORS" | grep -v '^INCLUDE' >> $TMP + +eval "`dircolors -c $TMP`" if ( "$LS_COLORS" == '' ) exit set color_none=`sed -n '/^COLOR.*none/Ip' < $COLORS` @@ -38,6 +44,7 @@ if ( "$color_none" != '' ) then exit endif unset color_none +rm -f $TMP finish: alias ll 'ls -l --color=auto' diff --git a/coreutils-colorls.sh b/coreutils-colorls.sh index dc5c223..adb3574 100755 --- a/coreutils-colorls.sh +++ b/coreutils-colorls.sh @@ -10,11 +10,15 @@ if [ -z "$USER_LS_COLORS" ]; then # Skip the rest for noninteractive shells. [ -z "$PS1" ] && return + INCLUDE= COLORS= + TMP="`mktemp .colorlsXXX`" for colors in "$HOME/.dir_colors.$TERM" "$HOME/.dircolors.$TERM" \ "$HOME/.dir_colors" "$HOME/.dircolors"; do - [ -e "$colors" ] && COLORS="$colors" && break + [ -e "$colors" ] && COLORS="$colors" && \ + INCLUDE="`cat "$COLORS" | grep '^INCLUDE' | cut -d ' ' -f2-`" && \ + break done [ -z "$COLORS" ] && [ -e "/etc/DIR_COLORS.256color" ] && \ @@ -30,9 +34,13 @@ if [ -z "$USER_LS_COLORS" ]; then # Existence of $COLORS already checked above. [ -n "$COLORS" ] || return - eval "`dircolors --sh "$COLORS" 2>/dev/null`" + [ -e "$INCLUDE" ] && cat "$INCLUDE" > $TMP + cat "$COLORS" | grep -v '^INCLUDE' >> $TMP + + eval "`dircolors --sh $TMP 2>/dev/null`" [ -z "$LS_COLORS" ] && return grep -qi "^COLOR.*none" $COLORS >/dev/null 2>/dev/null && return + rm -f $TMP fi alias ll='ls -l --color=auto' 2>/dev/null diff --git a/coreutils.spec b/coreutils.spec index 4dd7094..7d8f09b 100644 --- a/coreutils.spec +++ b/coreutils.spec @@ -1,7 +1,7 @@ Summary: A set of basic GNU tools commonly used in shell scripts Name: coreutils Version: 8.21 -Release: 8%{?dist} +Release: 9%{?dist} License: GPLv3+ Group: System Environment/Base Url: http://www.gnu.org/software/coreutils/ @@ -375,6 +375,9 @@ fi %{_sbindir}/chroot %changelog +* Mon Mar 11 2013 Ondrej Oprala 8.21-9 +- add support for INCLUDE in colorls scripts (#818069) + * Mon Mar 04 2013 Ondrej Vasik 8.21-8 - fix factor on AArch64 (M.Salter, #917735)