@@ -126,7 +126,7 @@ find_preview_version_from_git_tags() {
126126 local requested_version=${! variable_name}
127127 local repository_url=$2
128128
129- if [ -z " ${googlegit_cmd_name } " ]; then
129+ if [ -z " ${git_cmd_name } " ]; then
130130 if type git > /dev/null 2>&1 ; then
131131 git_cmd_name=" git"
132132 else
@@ -135,22 +135,22 @@ find_preview_version_from_git_tags() {
135135 fi
136136 fi
137137
138- # Fetch tags from remote repository
138+ # Fetch tags from remote repository (match both -preview.X and -rc.X tags)
139139 local tags
140- tags=$( git ls-remote --tags " ${repository_url} " 2> /dev/null | grep -oP ' refs/tags/v\K[0-9]+\.[0-9]+\.[0-9]+-preview\.[0-9]+' | sort -V)
140+ tags=$( git ls-remote --tags " ${repository_url} " 2> /dev/null | grep -oP ' refs/tags/v\K[0-9]+\.[0-9]+\.[0-9]+-( preview|rc) \.[0-9]+' | sort -V)
141141
142142 if [ -z " ${tags} " ]; then
143- echo " No preview tags found in repository."
143+ echo " No preview/rc tags found in repository."
144144 return 1
145145 fi
146146
147147 local version=" "
148148
149149 if [ " ${requested_version} " = " preview" ] || [ " ${requested_version} " = " latest" ]; then
150- # Get the latest preview version
150+ # Get the latest preview/rc version
151151 version=$( echo " ${tags} " | tail -n 1)
152152 elif [[ " ${requested_version} " =~ ^[0-9]+\. [0-9]+$ ]]; then
153- # Partial version provided (e.g., "7.6"), find latest preview matching that major.minor
153+ # Partial version provided (e.g., "7.6"), find latest preview/rc matching that major.minor
154154 version=$( echo " ${tags} " | grep " ^${requested_version} \." | tail -n 1)
155155 elif [[ " ${requested_version} " =~ ^[0-9]+\. [0-9]+\. [0-9]+-preview$ ]]; then
156156 # Version like "7.6.0-preview" provided, find latest preview for that version
@@ -161,6 +161,11 @@ find_preview_version_from_git_tags() {
161161 if echo " ${tags} " | grep -q " ^${requested_version} $" ; then
162162 version=" ${requested_version} "
163163 fi
164+ elif [[ " ${requested_version} " =~ ^[0-9]+\. [0-9]+\. [0-9]+-rc\. [0-9]+$ ]]; then
165+ # Exact RC version provided, verify it exists
166+ if echo " ${tags} " | grep -q " ^${requested_version} $" ; then
167+ version=" ${requested_version} "
168+ fi
164169 fi
165170
166171 if [ -z " ${version} " ]; then
@@ -382,7 +387,7 @@ install_using_github() {
382387 fi
383388 pwsh_url=" https://github.com/PowerShell/PowerShell"
384389 # Check if we need to find a preview version or stable version
385- if [[ " ${POWERSHELL_VERSION} " == * " preview" * ]] || [ " ${POWERSHELL_VERSION} " = " preview" ]; then
390+ if [[ " ${POWERSHELL_VERSION} " == * " preview" * ]] || [ " ${POWERSHELL_VERSION} " = " preview" ] || [[ " ${POWERSHELL_VERSION} " == * " -rc. " * ]] ; then
386391 echo " Finding preview version..."
387392 find_preview_version_from_git_tags POWERSHELL_VERSION " ${pwsh_url} "
388393 else
@@ -446,9 +451,9 @@ if ! type pwsh >/dev/null 2>&1; then
446451 POWERSHELL_ARCHIVE_ARCHITECTURES=" ${POWERSHELL_ARCHIVE_ARCHITECTURES_ALMALINUX} "
447452 fi
448453
449- if [[ " ${POWERSHELL_ARCHIVE_ARCHITECTURES} " = * " ${POWERSHELL_ARCHIVE_ARCHITECTURES_UBUNTU} " * ]] && [[ " ${POWERSHELL_ARCHIVE_VERSION_CODENAMES} " = * " ${VERSION_CODENAME} " * ]] && [[ " ${POWERSHELL_VERSION} " != * " preview" * ]]; then
454+ if [[ " ${POWERSHELL_ARCHIVE_ARCHITECTURES} " = * " ${POWERSHELL_ARCHIVE_ARCHITECTURES_UBUNTU} " * ]] && [[ " ${POWERSHELL_ARCHIVE_VERSION_CODENAMES} " = * " ${VERSION_CODENAME} " * ]] && [[ " ${POWERSHELL_VERSION} " != * " preview" * ]] && [[ " ${POWERSHELL_VERSION} " != * " -rc. " * ]] ; then
450455 install_using_apt || use_github=" true"
451- elif [[ " ${POWERSHELL_ARCHIVE_ARCHITECTURES} " = * " ${POWERSHELL_ARCHIVE_ARCHITECTURES_ALMALINUX} " * ]] && [[ " ${POWERSHELL_VERSION} " != * " preview" * ]]; then
456+ elif [[ " ${POWERSHELL_ARCHIVE_ARCHITECTURES} " = * " ${POWERSHELL_ARCHIVE_ARCHITECTURES_ALMALINUX} " * ]] && [[ " ${POWERSHELL_VERSION} " != * " preview" * ]] && [[ " ${POWERSHELL_VERSION} " != * " -rc. " * ]] ; then
452457 install_using_dnf && install_powershell_dnf || use_github=" true"
453458 else
454459 use_github=" true"
0 commit comments