Browse code

check grep color cap before adding alias

Change-Id: I34f29e965b5e89555a0a756d9eb8cbd0ef79b932
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/4504
Reviewed-by: Robert Qi <qij@vmware.com>
Tested-by: gerrit-photon <photon-checkins@vmware.com>

Priyesh Padmavilasom authored on 2017/12/12 09:19:54
Showing 1 changed files
... ...
@@ -1,7 +1,7 @@
1 1
 Summary:        Bourne-Again SHell
2 2
 Name:           bash
3 3
 Version:        4.4.12
4
-Release:        1%{?dist}
4
+Release:        2%{?dist}
5 5
 License:        GPLv3
6 6
 URL:            http://www.gnu.org/software/bash/
7 7
 Group:          System Environment/Base
... ...
@@ -93,7 +93,10 @@ if [ -f "/etc/dircolors" ] ; then
93 93
         fi
94 94
 fi
95 95
 alias ls='ls --color=auto'
96
-alias grep='grep --color=auto'
96
+grep --help | grep color  >/dev/null 2>&1
97
+if [ $? -eq 0 ]; then
98
+  alias grep='grep --color=auto'
99
+fi
97 100
 EOF
98 101
 
99 102
 cat > %{buildroot}/etc/profile.d/extrapaths.sh << "EOF"
... ...
@@ -181,7 +184,10 @@ cat > %{buildroot}/etc/bash.bashrc << "EOF"
181 181
 # with code in /etc/profile.
182 182
 
183 183
 alias ls='ls --color=auto'
184
-alias grep='grep --color=auto'
184
+grep --help | grep color  >/dev/null 2>&1
185
+if [ $? -eq 0 ]; then
186
+  alias grep='grep --color=auto'
187
+fi
185 188
 
186 189
 # Provides prompt for non-login shells, specifically shells started
187 190
 # in the X environment. [Review the LFS archive thread titled
... ...
@@ -337,6 +343,8 @@ fi
337 337
 %defattr(-,root,root)
338 338
 
339 339
 %changelog
340
+*   Mon Dec 11 2017 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 4.4.12-2
341
+-   conditionally apply grep color alias
340 342
 *   Mon Nov 13 2017 Xiaolin Li <xiaolinl@vmware.com> 4.4.12-1
341 343
 -   Upstream patch level 12 applied
342 344
 *   Mon Oct 02 2017 Kumar Kaushik <kaushikk@vmware.com> 4.4-6