Skip to content

Commit

Permalink
#1112: Version-prefix not working as expected (#1137)
Browse files Browse the repository at this point in the history
  • Loading branch information
Leosssss authored Jun 2, 2023
1 parent 0e5f21e commit d396136
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions scripts/src/main/resources/scripts/functions
Original file line number Diff line number Diff line change
Expand Up @@ -1272,16 +1272,22 @@ function doInstall() {
else
doFail "Version is unspecified for ${software} but could not be found in ${available_versions}."
fi
elif [ "${version:${#version}-1}" = "*" ]
elif [ "${version:(-1)}" = "*" ]
then
doDebug "Resolving version prefix ${version}"
local version_prefix="${version:0:${#version}-1}"
local version_prefix="${version::-1}" # remove last character (*)
doUpdateMirrors
local available_versions="${DEVON_IDE_HOME}/mirrors/${software}/available-versions"
if [ -e "${available_versions}" ]
then
local regex_digit="0-9"
local version_prefix_regex="^${version_prefix//./[.]}"
if [[ ${version_prefix:(-1)} =~ [${regex_digit}] ]]
then
version_prefix_regex="${version_prefix_regex}[^${regex_digit}]"
fi
local resolved_version
resolved_version="$(grep "^${version_prefix}[^0-9]" "${available_versions}" | head -n 1)"
resolved_version="$(grep "${version_prefix_regex}" "${available_versions}" | head -n 1)"
if [ -n "${resolved_version}" ]
then
doDebug "Resolved version prefix ${version} to ${resolved_version}"
Expand Down

0 comments on commit d396136

Please sign in to comment.