mirror of
https://github.com/saltstack/salt-bootstrap.git
synced 2025-04-16 09:40:21 +00:00
Allow tweaking colour support from an environment variable.
* Passing something like `BS_COLORS=0` disables colour support and is the same as passing `-N` to the script.
This commit is contained in:
parent
7792f4c8c0
commit
f6080c0422
1 changed files with 9 additions and 1 deletions
|
@ -18,10 +18,18 @@ set -o nounset # Treat unset variables as an error
|
|||
ScriptVersion="1.4"
|
||||
ScriptName="bootstrap-salt.sh"
|
||||
|
||||
#===============================================================================
|
||||
# Environment variables taken into account.
|
||||
#-------------------------------------------------------------------------------
|
||||
# * BS_COLORS: If 0 disables colour support
|
||||
#===============================================================================
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# LET THE BLACK MAGIC BEGIN!!!!
|
||||
#===============================================================================
|
||||
|
||||
|
||||
# Bootstrap script truth values
|
||||
BS_TRUE=1
|
||||
BS_FALSE=0
|
||||
|
@ -30,7 +38,7 @@ BS_FALSE=0
|
|||
# NAME: __detect_color_support
|
||||
# DESCRIPTION: Try to detect color support.
|
||||
#-------------------------------------------------------------------------------
|
||||
COLORS=$(tput colors 2>/dev/null || echo 0)
|
||||
COLORS=${BS_COLORS:-$(tput colors 2>/dev/null || echo 0)}
|
||||
__detect_color_support() {
|
||||
if [ $? -eq 0 ] && [ "$COLORS" -gt 2 ]; then
|
||||
RC="\033[1;31m"
|
||||
|
|
Loading…
Add table
Reference in a new issue