diff --git a/GREP_COLORS b/GREP_COLORS new file mode 100644 index 0000000..1ef53a6 --- /dev/null +++ b/GREP_COLORS @@ -0,0 +1,4 @@ +# Configuration file for the color grep utility + +# 'none' shuts colorization off. +#COLOR none diff --git a/colorgrep.csh b/colorgrep.csh index 18fed0f..1d9e94e 100644 --- a/colorgrep.csh +++ b/colorgrep.csh @@ -1 +1,16 @@ +#! /bin/csh -f + +# color-grep initialization + +set COLORS=/etc/GREP_COLORS + +if ( -e "$COLORS" ) then + set color_none=`sed -n '/^COLOR.*none/Ip' < $COLORS` + if ( "$color_none" != '' ) then + unset color_none + exit + endif + unset color_none +endif + alias grep 'grep --color=auto' diff --git a/colorgrep.sh b/colorgrep.sh index 3de87cc..5c61838 100644 --- a/colorgrep.sh +++ b/colorgrep.sh @@ -1 +1,14 @@ +# color-grep initialization + +# Skip the rest for noninteractive shells. +[ -z "$PS1" ] && return + +COLORS= + +[ -e "/etc/GREP_COLORS" ] && COLORS="/etc/GREP_COLORS" + +if [ -n "$COLORS" ]; then + grep -qi "^COLOR.*none" $COLORS >/dev/null 2>/dev/null && return +fi + alias grep='grep --color=auto' 2>/dev/null diff --git a/grep.spec b/grep.spec index 329779d..02aebf2 100644 --- a/grep.spec +++ b/grep.spec @@ -3,16 +3,17 @@ Summary: Pattern matching utilities Name: grep Version: 2.6.3 -Release: 3%{?dist} +Release: 4%{?dist} License: GPLv3+ Group: Applications/Text Source: ftp://ftp.gnu.org/pub/gnu/grep/grep-%{version}.tar.xz Source1: colorgrep.sh Source2: colorgrep.csh +Source3: GREP_COLORS URL: http://www.gnu.org/software/grep/ Requires(post): /sbin/install-info Requires(preun): /sbin/install-info -BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) +BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) BuildRequires: pcre-devel >= 3.9-10, texinfo, gettext BuildRequires: autoconf automake # Speedups DFA UTF-8 period patterns. @@ -57,6 +58,7 @@ gzip $RPM_BUILD_ROOT%{_infodir}/grep* rm -f $RPM_BUILD_ROOT%{_infodir}/dir mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/profile.d install -pm 644 %{SOURCE1} %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/profile.d +install -pm 644 %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir} %find_lang %name @@ -75,15 +77,21 @@ if [ $1 = 0 ]; then fi %files -f %{name}.lang -%defattr(-,root,root) +%defattr(-,root,root,-) %doc ABOUT-NLS AUTHORS THANKS TODO NEWS README ChangeLog COPYING %{_bindir}/* %config(noreplace) %{_sysconfdir}/profile.d/colorgrep.*sh +%config(noreplace) %{_sysconfdir}/GREP_COLORS %{_infodir}/*.info*.gz %{_mandir}/*/* %changelog +* Fri Jun 11 2010 Jaroslav Škarvada - 2.6.3-4 +- Colors can be globally disabled via /etc/GREP_COLORS (#602867) +- Fixed indentation in spec +- Fixed defattr in spec + * Mon Jun 07 2010 Jaroslav Škarvada - 2.6.3-3 - Added auto-color profile.d scripts (thanks to Ville Skyttä #600832) - Removed description macro from changelog