Added script to check whether grep is coloured
Resolves: rhbz#1034631
This commit is contained in:
parent
fbfc56265c
commit
4ca30e887d
@ -1,13 +1,9 @@
|
||||
|
||||
# color-grep initialization
|
||||
|
||||
if ( -r /etc/GREP_COLORS ) then
|
||||
set color_none=`sed -n '/^COLOR.*none/Ip' < /etc/GREP_COLORS`
|
||||
if ( "$color_none" != '' ) then
|
||||
unset color_none
|
||||
exit
|
||||
endif
|
||||
unset color_none
|
||||
/usr/libexec/grepconf.sh -c
|
||||
if ( $status == 1 ) then
|
||||
exit
|
||||
endif
|
||||
|
||||
alias grep 'grep --color=auto'
|
||||
|
@ -1,8 +1,6 @@
|
||||
# color-grep initialization
|
||||
|
||||
if [ -r /etc/GREP_COLORS ]; then
|
||||
grep -qi "^COLOR.*none" /etc/GREP_COLORS >/dev/null 2>/dev/null && return
|
||||
fi
|
||||
/usr/libexec/grepconf.sh -c || return
|
||||
|
||||
alias grep='grep --color=auto' 2>/dev/null
|
||||
alias egrep='egrep --color=auto' 2>/dev/null
|
||||
|
@ -3,13 +3,14 @@
|
||||
Summary: Pattern matching utilities
|
||||
Name: grep
|
||||
Version: 2.20
|
||||
Release: 4%{?dist}
|
||||
Release: 5%{?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
|
||||
Source4: grepconf.sh
|
||||
# upstream ticket 39444
|
||||
Patch0: grep-2.20-man-fix-gs.patch
|
||||
# upstream ticket 39445
|
||||
@ -57,6 +58,7 @@ 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}
|
||||
install -Dpm 755 %{SOURCE4} $RPM_BUILD_ROOT%{_libexecdir}/grepconf.sh
|
||||
|
||||
%find_lang %name
|
||||
|
||||
@ -85,8 +87,13 @@ fi
|
||||
%config(noreplace) %{_sysconfdir}/GREP_COLORS
|
||||
%{_infodir}/*.info*.gz
|
||||
%{_mandir}/*/*
|
||||
%{_libexecdir}/grepconf.sh
|
||||
|
||||
%changelog
|
||||
* Wed Aug 20 2014 Jaroslav Škarvada <jskarvad@redhat.com> - 2.20-5
|
||||
- Added script to check whether grep is coloured
|
||||
Resolves: rhbz#1034631
|
||||
|
||||
* Sat Aug 16 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.20-4
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
|
||||
|
||||
|
11
grepconf.sh
Normal file
11
grepconf.sh
Normal file
@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
case "$1" in
|
||||
-c | --interactive-color)
|
||||
! grep -qsi "^COLOR.*none" /etc/GREP_COLORS
|
||||
;;
|
||||
*)
|
||||
echo >&2 "Invalid / no option passed, so far only -c | --interactive-color is supported."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
Loading…
Reference in New Issue
Block a user