public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Mike Frysinger" <vapier@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: app-shells/bash/files/
Date: Wed,  3 Feb 2016 18:52:02 +0000 (UTC)	[thread overview]
Message-ID: <1454525501.43785a6ff3210efdb6807a42fb02ed74b440019c.vapier@gentoo> (raw)

commit:     43785a6ff3210efdb6807a42fb02ed74b440019c
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Tue Feb  2 20:23:37 2016 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Wed Feb  3 18:51:41 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=43785a6f

app-shells/bash: bashrc: enable fallback TERM color checking for everyone

We provide rudimentary TERM checking for BSD which doesn't have dircolors,
but this logic works just as well for all systems such as embedded.  Make
this code run whenever dircolors does not exist.

 app-shells/bash/files/bashrc | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/app-shells/bash/files/bashrc b/app-shells/bash/files/bashrc
index f3618fc..87a5562 100644
--- a/app-shells/bash/files/bashrc
+++ b/app-shells/bash/files/bashrc
@@ -49,18 +49,12 @@ case ${TERM} in
 		;;
 esac
 
-use_color=false
-#BSD#@# BSD doesn't typically come with dircolors so we need
-#BSD#@# to hardcode some terminals in here.
-#BSD#@case ${TERM} in
-#BSD#@	[aEkx]term*|rxvt*|gnome*|konsole*|screen|cons25) use_color=true;;
-#BSD#@esac
-
 # Set colorful PS1 only on colorful terminals.
 # dircolors --print-database uses its own built-in database
 # instead of using /etc/DIR_COLORS.  Try to use the external file
 # first to take advantage of user additions.  Use internal bash
 # globbing instead of external grep binary.
+use_color=false
 safe_term=${TERM//[^[:alnum:]]/?}   # sanitize TERM
 match_lhs=""
 [[ -f ~/.dir_colors   ]] && match_lhs="${match_lhs}$(<~/.dir_colors)"
@@ -79,7 +73,15 @@ if ${use_color} ; then
 			eval $(dircolors -b /etc/DIR_COLORS)
 		fi
 	fi
+else
+	# Some systems (e.g. BSD & embedded) don't typically come with
+	# dircolors so we need to hardcode some terminals in here.
+	case ${TERM} in
+	[aEkx]term*|rxvt*|gnome*|konsole*|screen|cons25) use_color=true;;
+	esac
+fi
 
+if ${use_color} ; then
 	if [[ ${EUID} == 0 ]] ; then
 		PS1+='\[\033[01;31m\]\h\[\033[01;34m\] \W \$\[\033[00m\] '
 	else


             reply	other threads:[~2016-02-03 18:52 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-03 18:52 Mike Frysinger [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-01-04 22:47 [gentoo-commits] repo/gentoo:master commit in: app-shells/bash/files/ Conrad Kostecki
2024-12-07 12:48 Sam James
2024-12-07 12:48 Sam James
2024-12-06 23:12 Conrad Kostecki
2023-12-31  2:38 Conrad Kostecki
2023-04-26 21:08 Mike Gilbert
2023-04-25 21:30 Sam James
2023-03-04 19:29 Sven Wegener
2022-11-16 18:36 Conrad Kostecki
2022-09-11 23:13 Mike Gilbert
2021-07-10 21:16 Conrad Kostecki
2021-05-29 18:51 Lars Wendler
2020-12-01 13:16 Lars Wendler
2020-06-13 16:24 Mike Gilbert
2019-09-15  7:53 Mike Frysinger
2018-06-26 15:05 Mike Gilbert
2018-01-04 23:48 Sven Wegener
2017-10-20  7:45 Patrice Clement
2017-06-10 12:02 Jason Donenfeld
2017-06-10  3:07 Jason Donenfeld
2017-06-10  3:06 Jason Donenfeld
2016-07-16  9:54 Patrice Clement
2016-06-23  6:03 Mike Frysinger
2016-06-23  5:31 Mike Frysinger
2016-02-03 18:52 Mike Frysinger
2016-02-03 18:52 Mike Frysinger
2016-02-03 18:52 Mike Frysinger
2016-02-03 18:52 Mike Frysinger
2016-02-03 18:52 Mike Frysinger
2016-01-26  7:23 Mike Frysinger
2016-01-26  7:23 Mike Frysinger
2016-01-26  7:23 Mike Frysinger
2015-12-02 18:59 Mike Frysinger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1454525501.43785a6ff3210efdb6807a42fb02ed74b440019c.vapier@gentoo \
    --to=vapier@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox