install-opentofu.ps1
Invokes PowerShell HTTP request cmdletKnown installer archive context
SHA-25689ce65dfcbcc4dbe64f2595c98bc87bb6f2e1639de18ff90ecc91651a273e5bb
Evidence
1<#
2Copyright (c) The OpenTofu Authors
3SPDX-License-Identifier: Apache-2.0
4License: https://github.com/opentofu/get.opentofu.org/blob/main/LICENSE
5
6.SYNOPSIS
7Install OpenTofu.
8
9.DESCRIPTION
10This script installs OpenTofu via any of the supported methods. Please run it with the -h or -help parameter
11to get a detailed help description.
12
⋯8 lines
88:6… Parameter(Mandatory = $false)]
89 [string]$cosignOidcIssuer = "https://token.actions.githubusercontent.com",
90
91 [Parameter(Mandatory = $false)]
⋯4 lines
135:57… penTofu"
136} else {
137 $defaultInstallPath = Join-Path (Join-Path $Env:LOCALAPPDATA "Programs") "OpenTofu"
138}
139$defaultCosignPath = "cosign.exe"
140$defaultCosignOidcIssuer = "https://token.actions.githubusercontent.c …
221:9… m(
222 $message
223 )
224 try
225 {
226 [Console]::Error.WriteLine("${red}${message}${normal}")
227 } catch {}
228}
229
230function tempdir() {
231 $tempPath = [System.IO.Path]::GetTempPath()
232 $randomName = [System.IO.Path]::GetRandomFileName()
233 $path = Join-Path $tempPath $randomName
234 New-Item -Path $path -ItemType directory
235}
236
237function unpackStandalone() {
238 logInfo "Unpacking ZIP file to $installPath..."
239 try
240 {
241 New-Item -Path $installPath -ItemType directory -Force
242 }
243 catch
244 {
245 $msg = $_.ToString()
246 throw [InstallFailedException]::new("Failed to create target …
252:9… logInfo "Unzipping $internalZipFile to $installPath..."
253 Expand-Archive -LiteralPath $internalZipFile -DestinationPath $installPath -Force
254 }
255 catch
256 {
257 $msg = $_.ToString()
258 t …