github.com/prysmaticlabs/prysm@v1.4.4/scripts/common.sh (about)

     1  #!/bin/bash
     2  
     3  function color() {
     4      # Usage: color "31;5" "string"
     5      # Some valid values for color:
     6      # - 5 blink, 1 strong, 4 underlined
     7      # - fg: 31 red,  32 green, 33 yellow, 34 blue, 35 purple, 36 cyan, 37 white
     8      # - bg: 40 black, 41 red, 44 blue, 45 purple
     9      printf '\033[%sm%s\033[0m\n' "$@"
    10  }
    11  
    12  system=""
    13  case "$OSTYPE" in
    14  darwin*) system="darwin" ;;
    15  linux*) system="linux" ;;
    16  msys*) system="windows" ;;
    17  cygwin*) system="windows" ;;
    18  *) exit 1 ;;
    19  esac
    20  readonly system
    21  
    22  # Get locations of pb.go and pb.gw.go files.
    23  findutil="find"
    24  # On OSX `find` is not GNU find compatible, so require "findutils" package.
    25  if [ "$system" == "darwin" ]; then
    26      if [[ ! -x "/usr/local/bin/gfind" ]]; then
    27          color 31 "Make sure that GNU 'findutils' package is installed: brew install findutils"
    28          exit 1
    29      else
    30          export findutil="gfind"  # skipcq: SH-2034
    31      fi
    32  fi