From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id C52C358974 for ; Wed, 3 Feb 2016 18:52:08 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 9CA9C21C007; Wed, 3 Feb 2016 18:52:06 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 0B4B921C007 for ; Wed, 3 Feb 2016 18:52:05 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id A5368340976 for ; Wed, 3 Feb 2016 18:52:04 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 9B0578F4 for ; Wed, 3 Feb 2016 18:52:02 +0000 (UTC) From: "Mike Frysinger" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Mike Frysinger" Message-ID: <1454525501.43785a6ff3210efdb6807a42fb02ed74b440019c.vapier@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: app-shells/bash/files/ X-VCS-Repository: repo/gentoo X-VCS-Files: app-shells/bash/files/bashrc X-VCS-Directories: app-shells/bash/files/ X-VCS-Committer: vapier X-VCS-Committer-Name: Mike Frysinger X-VCS-Revision: 43785a6ff3210efdb6807a42fb02ed74b440019c X-VCS-Branch: master Date: Wed, 3 Feb 2016 18:52:02 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 8c893681-13a8-40a8-b93d-f7371a35adde X-Archives-Hash: aff31fde44fbdb0f6bae27fcb45b0721 commit: 43785a6ff3210efdb6807a42fb02ed74b440019c Author: Mike Frysinger gentoo org> AuthorDate: Tue Feb 2 20:23:37 2016 +0000 Commit: Mike Frysinger gentoo 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