fix: check installed grep is GNU variant
This commit is contained in:
parent
aa48d9aea0
commit
a4b04fcb7a
|
@ -10,17 +10,29 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
## Use GNU grep, busybox grep is too slow
|
## Use GNU grep, busybox grep is not as performant
|
||||||
. "/etc/os-release"
|
DISTRO=""
|
||||||
DISTRO="$ID"
|
if [ -f "/etc/os-release" ]; then
|
||||||
|
. "/etc/os-release"
|
||||||
|
DISTRO="$ID"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -z "$(grep --help | grep 'GNU')" ]; then
|
check_grep() {
|
||||||
|
if [ -z "$(grep --help | grep 'GNU')" ]; then
|
||||||
|
if [ -x "/usr/bin/grep" ]; then
|
||||||
|
alias grep="/usr/bin/grep"
|
||||||
|
check_grep
|
||||||
|
else
|
||||||
if [ "$DISTRO" = "alpine" ]; then
|
if [ "$DISTRO" = "alpine" ]; then
|
||||||
echo "Please install GNU grep 'apk add grep'"
|
echo "Please install GNU grep 'apk add grep'"
|
||||||
|
else
|
||||||
|
echo "GNU grep not found"
|
||||||
|
fi
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
alias grep="/usr/bin/grep"
|
fi
|
||||||
fi
|
}
|
||||||
|
check_grep
|
||||||
|
|
||||||
|
|
||||||
rm -rf "tmp/"
|
rm -rf "tmp/"
|
||||||
|
|
Loading…
Reference in New Issue