Closed ReenigneArcher closed 5 months ago
You can try https://github.com/Drawbackz/DevCon-Installer/releases/tag/1.4-rc
Let me know if it gives you any trouble.
I must be missing something. I can't get it to find Devcon
Not sure if there is something on my end that I have not accounted for but I did notice that a hash was not specified (required) and the update command was off. You can grab the hash for the version of devcon you would like to install from devcon_sources.json
Maybe this will work for you?
DownloadAndExtract `
-Uri "https://github.com/Drawbackz/DevCon-Installer/releases/download/1.4-rc/Devcon.Installer.zip" `
-OutFile "Devcon.Installer.zip"
Set-Location -Path Devcon.Installer
& "./Devcon Installer.exe" 'update'
& "./Devcon Installer.exe" 'install' '-hash' '6ECFAF7042C525DDB6C0BF0501BECFBCE85CBDF2A33B1BCA67734FEA567AF3B8' '-addpath' '-dir' 'C:\Windows\System32'
You can get the output of the application like this:
"Devcon Installer.exe" install -hash 6ECFAF7042C525DDB6C0BF0501BECFBCE85CBDF2A33B1BCA67734FEA567AF3B8 -addpath > output.txt
I am not sure if that is of any use in your situation though.
This is working over here, but I am thinking that the process is not exactly script friendly. I can do a proper job and create a stand-alone cli tool that should work properly.
# Function to download and extract a zip file
function DownloadAndExtract {
param (
[string]$Uri,
[string]$OutFile
)
$maxRetries = 5
$retryCount = 0
$success = $false
while (-not $success -and $retryCount -lt $maxRetries) {
$retryCount++
Write-Host "Downloading $Uri to $OutFile, attempt $retryCount of $maxRetries"
try {
Invoke-WebRequest -Uri $Uri -OutFile $OutFile
$success = $true
} catch {
Write-Host "Attempt $retryCount of $maxRetries failed with error: $($_.Exception.Message). Retrying..."
Start-Sleep -Seconds 5
}
}
if (-not $success) {
Write-Host "Failed to download the file after $maxRetries attempts."
exit 1
}
Expand-Archive -Path $OutFile -DestinationPath .
}
DownloadAndExtract -Uri "https://github.com/Drawbackz/DevCon-Installer/releases/download/1.4-rc/Devcon.Installer.zip" -OutFile ".\Devcon.Installer.zip"
& ".\Devcon Installer.exe" 'install' '-hash' '6ECFAF7042C525DDB6C0BF0501BECFBCE85CBDF2A33B1BCA67734FEA567AF3B8' '-addpath' '-update'
I had a small issue where the code after the installer would run before it finished installing.
This solved that and it seems to be working now (might be common knowledge, but I don't do much in PowerShell). Thanks!
Start-Process -FilePath "./Devcon Installer.exe" -Wait -ArgumentList `
'install', `
'-hash', '54004C83EE34F6A55380528A8B29F4C400E61FBB947A19E0AB9E5A193D7D961E', `
'-addpath', `
'-update', `
'-dir', 'C:\Windows\System32'
I can do a proper job and create a stand-alone cli tool that should work properly.
Making this into a GitHub action would be cool, but definitely not necessary.
Is silent installation supported? I'd like to use this in a GitHub runner.