Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

silent install supported? #10

Closed
ReenigneArcher opened this issue Mar 18, 2024 · 5 comments
Closed

silent install supported? #10

ReenigneArcher opened this issue Mar 18, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@ReenigneArcher
Copy link

Is silent installation supported? I'd like to use this in a GitHub runner.

@Drawbackz
Copy link
Owner

You can try https://github.com/Drawbackz/DevCon-Installer/releases/tag/1.4-rc

Let me know if it gives you any trouble.

@Drawbackz Drawbackz added the enhancement New feature or request label Mar 25, 2024
@ReenigneArcher
Copy link
Author

I must be missing something. I can't get it to find Devcon

https://github.com/LizardByte/Sunshine/pull/2296/files

@Drawbackz
Copy link
Owner

Drawbackz commented Mar 25, 2024

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.

@Drawbackz
Copy link
Owner

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'

@ReenigneArcher
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants