Skip to content

Commit

Permalink
Update generate_config.sh version checking for wider compatibility (#…
Browse files Browse the repository at this point in the history
…6270)

* Update generate_config.sh version checking for wider compatibility 

fix: replace `grep -oP` with `grep -oE` for broader compatibility

The `-P` option (Perl-compatible regex) is not supported in all versions of `grep`, particularly the default BSD `grep` on macOS. This change replaces `-P` with `-E` (extended regex), which is more widely available and ensures compatibility across different environments.

Tested on macOS and Linux.

* Update generate_config.sh to remove use of platform dependent grep

Replaced version checking using free-form text. Instead, uses Docker’s built-in templating instead of parsing free-form text. This gives cross-platform consistency without dependency on particular versions of grep.
  • Loading branch information
digitalhen authored Feb 11, 2025
1 parent ac2f0c7 commit 743e88f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion generate_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ for bin in openssl curl docker git awk sha1sum grep cut; do
done

# Check Docker Version (need at least 24.X)
docker_version=$(docker -v | grep -oP '\d+\.\d+\.\d+' | head -n 1 | cut -d '.' -f 1)
docker_version=$(docker version --format '{{.Server.Version}}' | cut -d '.' -f 1)

if [[ $docker_version -lt 24 ]]; then
echo -e "\e[31mCannot find Docker with a Version higher or equals 24.0.0\e[0m"
Expand Down

0 comments on commit 743e88f

Please sign in to comment.