fix: check installed grep is GNU variant
This commit is contained in:
parent
eebf51ac47
commit
eac902123e
|
@ -7,17 +7,28 @@ set -efx -o pipefail
|
|||
alias curl="curl -L"
|
||||
alias rm="rm -rf"
|
||||
|
||||
## Use GNU grep, busybox grep is too slow
|
||||
## Use GNU grep, busybox grep is not as performant
|
||||
. "/etc/os-release"
|
||||
DISTRO="$ID"
|
||||
|
||||
if [ -z "$(grep --help | grep 'GNU')" ]; then
|
||||
if [ "$DISTRO" = "alpine" ]; then
|
||||
echo "Please install GNU grep 'apk add grep'"
|
||||
exit 1
|
||||
check_grep() {
|
||||
if [ -z "$(grep --help | grep 'GNU')" ]; then
|
||||
if [ -x "/usr/bin/grep" ]; then
|
||||
echo "grep found. try alias"
|
||||
alias grep="/usr/bin/grep"
|
||||
check_grep
|
||||
else
|
||||
if [ "$DISTRO" = "alpine" ]; then
|
||||
echo "Please install GNU grep 'apk add grep'"
|
||||
else
|
||||
echo "GNU grep not found"
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
alias grep="/usr/bin/grep"
|
||||
fi
|
||||
}
|
||||
|
||||
check_grep
|
||||
|
||||
|
||||
## Detect Musl C library
|
||||
|
|
Loading…
Reference in New Issue