Skip to content

Commit c4d4f46

Browse files
authored
fix: restrict install.sh to versions >=2.0.0 (#87)
1 parent 42386c3 commit c4d4f46

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

scripts/install.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,22 @@ if [ "$arch" = "aarch64" ]; then
2020
fi
2121

2222
version=${INFRACOST_VERSION:-latest}
23+
24+
# This script only installs versions >=2.0.0; older versions are at https://github.com/infracost/infracost.
25+
if [ "$version" != "latest" ]; then
26+
major=$(echo "$version" | sed 's/^v//' | cut -d. -f1)
27+
if ! echo "$major" | grep -qE '^[0-9]+$'; then
28+
echo "Error: invalid version format: $version"
29+
exit 1
30+
fi
31+
if [ "$major" -lt 2 ]; then
32+
echo "Error: version $version is not supported by this script."
33+
echo "This script only installs versions >=2.0.0 from the infracost/cli repository."
34+
echo "For older versions, see https://github.com/infracost/infracost."
35+
exit 1
36+
fi
37+
fi
38+
2339
url="https://infracost.io/downloads/${version}"
2440
tar="infracost-$os-$arch.tar.gz"
2541
echo "Downloading version ${version} of infracost-$os-$arch..."

0 commit comments

Comments
 (0)