Skip to content

Commit

Permalink
scripts:bugfix - fixing error in url validation with latest rc and be…
Browse files Browse the repository at this point in the history
…ta (#874)

Signed-off-by: Nathan Martins <nathan.martins@zup.com.br>
  • Loading branch information
nathanmartinszup committed Dec 15, 2021
1 parent bce739e commit bf20250
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions deployments/scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,14 @@ horusecSetVersion() {
echo "Version set to $LATEST_BETA"
VERSION_DOWNLOAD=$LATEST_BETA
elif [ "$VERSION_DOWNLOAD" = "latest" ]; then
echo "Version set to $LATEST_BETA"
echo "Version set to latest"
VERSION_DOWNLOAD='latest'
elif echo $VERSION_DOWNLOAD | grep -Eq $regex; then
echo "Version set to $VERSION_DOWNLOAD"
else
echo "input not match required params: 'latest-rc' 'latest-beta' 'latest' or a semantic version compliant, check https://github.com/ZupIT/horusec/releases"
exit 1
fi
echo "Download version: $VERSION_DOWNLOAD"
}

horusecIdentifyOSLatest() {
Expand Down Expand Up @@ -145,9 +144,11 @@ horusecIdentifyOS() {
# correct download link for the version informed by the user.
isOldURLVersion() {
if [ $VERSION_DOWNLOAD != "latest" ]; then
VERSION_WITHOUT_PREFIX=$(echo "$VERSION_DOWNLOAD" | sed -e "s/v//g")

VERSION_WITHOUT_DOTS=$(echo "$VERSION_WITHOUT_PREFIX" | sed -e "s/\.//g")
VERSION_WITHOUT_V_PREFIX=$(echo "$VERSION_DOWNLOAD" | sed -e "s/v//g")
VERSION_WITHOUT_BETA_PREFIX=$(echo "$VERSION_WITHOUT_V_PREFIX" | sed -r "s/-beta\.[0-9]+//g")
VERSION_WITHOUT_RC_PREFIX=$(echo "$VERSION_WITHOUT_BETA_PREFIX" | sed -r "s/-rc\.[0-9]+//g")
VERSION_WITHOUT_DOTS=$(echo "$VERSION_WITHOUT_RC_PREFIX" | sed -e "s/\.//g")

if [ "$VERSION_WITHOUT_DOTS" -gt 264 ]; then
IS_NEW_URL=true
Expand Down

0 comments on commit bf20250

Please sign in to comment.