Skip to content

Commit cdfc808

Browse files
authored
Merge pull request #5058 from unsuman/fix/update-template-rocky-grep
fix(hack): make `update-template-rocky.sh` compatible for GNU and BSD based `grep`
2 parents 6782076 + 785c0e9 commit cdfc808

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

hack/update-template-rocky.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ function rocky_latest_image_entry_for_url_spec() {
115115
# Rocky 10 requires explicit minor version paths (e.g., 10.1) as the major version path (10) is unreliable.
116116
local major_version latest_minor
117117
major_version=$(jq -r '.major_version' <<<"${url_spec}")
118-
latest_minor=$(curl -s "https://dl.rockylinux.org/pub/rocky/" | grep -oP "(?<=href=[\"'])${major_version}\.[0-9]+(?=/[\"'])" | sort -V | tail -1)
118+
latest_minor=$(curl -s "https://dl.rockylinux.org/pub/rocky/" | grep -oE "href=[\"']${major_version}\.[0-9]+/" | sed -E "s/href=[\"']//;s/\///" | sort -V | tail -1)
119119
# Use the discovered minor version, falling back to the major version if discovery fails
120120
major_version_url_spec=$(jq -e -r --arg v "${latest_minor:-$major_version}" '.path_version = $v' <<<"${url_spec}")
121121
major_version_image_directory=$(rocky_image_directory_from_url_spec "${major_version_url_spec}")

0 commit comments

Comments
 (0)