From d77e9c9588ebd1908678ceada29f8b57043f6f8b Mon Sep 17 00:00:00 2001 From: Michael Kriese Date: Mon, 25 Nov 2024 15:50:20 +0100 Subject: [PATCH] feat: try previous minor build definition --- bin/builder.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/bin/builder.sh b/bin/builder.sh index 0e138d3..04b45e3 100755 --- a/bin/builder.sh +++ b/bin/builder.sh @@ -29,17 +29,20 @@ function check_semver () { } if [[ ! -f "/usr/local/share/php-build/definitions/${VERSION}" ]]; then - echo "Missing build definition for ${VERSION}. Trying to find older patch build definition" + echo "Missing build definition for ${VERSION}. Trying to find older build definition." check_semver "${VERSION}" if [[ ! "${MAJOR}" || ! "${MINOR}" || ! "${PATCH}" ]]; then echo Invalid version: "${TOOL_VERSION}" >&2 exit 1 fi - oldVersion=$(find /usr/local/share/php-build/definitions -type f -name "${MAJOR}.${MINOR}.*" -printf '%f\n' | sort --version-sort -r | head -n 1) + oldVersion=$(find /usr/local/share/php-build/definitions -type f -name "${MAJOR}.${MINOR}.*" -printf '%f\n' | sort --version-sort -r | head -n 1) if [[ -z $oldVersion ]]; then - echo "No usable definition found" >&2 - exit 1 + oldVersion=$(find /usr/local/share/php-build/definitions -type f -name "${MAJOR}.$((MINOR-1)).*" -printf '%f\n' | sort --version-sort -r | head -n 1) + if [[ -z $oldVersion ]]; then + echo "No usable definition found" >&2 + exit 1 + fi fi echo "Using $oldVersion"