2020-06-03 21:15:37 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
function color() {
|
|
|
|
# Usage: color "31;5" "string"
|
|
|
|
# Some valid values for color:
|
|
|
|
# - 5 blink, 1 strong, 4 underlined
|
|
|
|
# - fg: 31 red, 32 green, 33 yellow, 34 blue, 35 purple, 36 cyan, 37 white
|
|
|
|
# - bg: 40 black, 41 red, 44 blue, 45 purple
|
|
|
|
printf '\033[%sm%s\033[0m\n' "$@"
|
|
|
|
}
|
|
|
|
|
|
|
|
system=""
|
|
|
|
case "$OSTYPE" in
|
|
|
|
darwin*) system="darwin" ;;
|
|
|
|
linux*) system="linux" ;;
|
|
|
|
msys*) system="windows" ;;
|
|
|
|
cygwin*) system="windows" ;;
|
|
|
|
*) exit 1 ;;
|
|
|
|
esac
|
|
|
|
readonly system
|
|
|
|
|
|
|
|
# Get locations of pb.go and pb.gw.go files.
|
|
|
|
findutil="find"
|
|
|
|
# On OSX `find` is not GNU find compatible, so require "findutils" package.
|
|
|
|
if [ "$system" == "darwin" ]; then
|
2023-01-31 01:17:12 +00:00
|
|
|
if [[ ! -x "/usr/local/bin/gfind" && ! -x "/opt/homebrew/bin/gfind" ]]; then
|
2020-06-03 21:15:37 +00:00
|
|
|
color 31 "Make sure that GNU 'findutils' package is installed: brew install findutils"
|
|
|
|
exit 1
|
|
|
|
else
|
2021-03-24 19:57:27 +00:00
|
|
|
export findutil="gfind" # skipcq: SH-2034
|
2020-06-03 21:15:37 +00:00
|
|
|
fi
|
|
|
|
fi
|