38 lines
1.2 KiB
PowerShell
38 lines
1.2 KiB
PowerShell
# Definisci il percorso in cui cercare l'eseguibile
|
|
$mutagenPath = ".bin\mutagen\mutagen.exe"
|
|
|
|
# Verifica se Mutagen è già installato
|
|
if (Test-Path $mutagenPath) {
|
|
Write-Host "Mutagen e' gia' installato nella cartella: $mutagenPath"
|
|
} else {
|
|
Write-Host "Mutagen non e' stato trovato. Procedo con l'installazione..."
|
|
|
|
# URL per il download di Mutagen
|
|
$mutagenUrl = "https://github.com/mutagen-io/mutagen/releases/download/v0.18.1/mutagen_windows_amd64_v0.18.1.zip"
|
|
$downloadPath = ".bin\mutagen.zip"
|
|
$extractPath = ".bin\mutagen"
|
|
|
|
# Crea la cartella finale (se non esiste già)
|
|
if (-not (Test-Path ".bin")) {
|
|
New-Item -ItemType Directory -Path ".bin"
|
|
}
|
|
|
|
# Scarica Mutagen
|
|
Invoke-WebRequest -Uri $mutagenUrl -OutFile $downloadPath
|
|
|
|
# Estrai il file zip nella cartella "mutagen"
|
|
Expand-Archive -Path $downloadPath -DestinationPath $extractPath
|
|
|
|
# Rimuovi il file zip
|
|
$maxTries = 5
|
|
$try = 0
|
|
while ($try -lt $maxTries) {
|
|
try {
|
|
Remove-Item -Path $downloadPath -ErrorAction Stop
|
|
break # Se va a buon fine, esci dal ciclo
|
|
} catch {
|
|
Start-Sleep -Seconds 1
|
|
$try++
|
|
}
|
|
}
|
|
} |