Skip to content

Commit

Permalink
Fix doSystemAndReleaseMatch to handle arm64 (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
fishfacemcgee authored Oct 30, 2024
1 parent 4bf38ae commit 24eb3aa
Showing 1 changed file with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,7 @@ private String downloadFileOrReturnPathIfAlreadyExists(String fileName, String z
}

private boolean doSystemAndReleaseMatch(String arch, String os) {
return arch.equals(SystemUtils.OS_ARCH)
&& (SystemUtils.IS_OS_WINDOWS && os.equals("windows") ||
SystemUtils.IS_OS_LINUX && os.equals("linux"))
||
SystemUtils.IS_OS_MAC && os.equals("darwin");
return arch.equals(this.getArch()) && os.equals(this.getOs());
}

public String downloadTerraformVersion(String terraformVersion) throws IOException {
Expand Down Expand Up @@ -294,6 +290,16 @@ public String getOs() {
return "linux";
}

private String getArch() {
if (SystemUtils.OS_ARCH == null) {
throw new IllegalArgumentException("System architecture not detected");
}
if (SystemUtils.OS_ARCH.equals("aarch64")) {
return "arm64";
}
return SystemUtils.OS_ARCH;
}

private String unzipTerraformVersion(String terraformVersion, File terraformZipFile) throws IOException {
createVersionDirectory(terraformVersion, TERRAFORM_DIRECTORY);
String newFilePath = null;
Expand Down

0 comments on commit 24eb3aa

Please sign in to comment.