0

I want to take this command

To upgrade an existing GYB install, run:

bash <(curl -s -S -L https://git.io/gyb-install) -l

The -l at the end tells the download script to upgrade to latest version and not perform the project setup steps. This will preserve your current settings and existing backups.

and make it something that work in windows PowerShell.

The end goal is to make a windows script that updates to the latest release of a program called GYB https://github.com/GAM-team/got-your-back/releases automatically.

I don't have any code to offer since I don't have any good ideas to accomplish what I want.

Any help would be appreciated.

5
  • 1
    The web page "git.io/gyb-install" contains the bash install script. Curl just pulls that bash install script to your device, which is then run with bash. You could easily pull the bash script to your device with windows powershell in a similar way, but you're not going to be able to run it with windows powershell. Commented Mar 25, 2022 at 19:38
  • There is my problem really. I have no idea how to get that script to run in a windows machine with out going to great lengths. I hoping there might be a way to translate this to windows and then I can run it in powershell. Commented Mar 25, 2022 at 19:43
  • 1
    Try out this script for downloading the latest release from github as a starting point and ask another question on a specific error if you get stuck. gist.github.com/MarkTiedemann/c0adc1701f3f5c215fc2c2d5b1d5efd3 Commented Mar 25, 2022 at 19:51
  • 1
    The comments mention a specific link for latest version too, worth a shot Commented Mar 25, 2022 at 19:53
  • make that an answer and I will try it out and close this. Thanks Commented Mar 25, 2022 at 19:53

2 Answers 2

1

Rather than using their bash script, just downloading the latest file with that name from github with powershell worked ok for me.

Try this one (original from https://gist.github.com/MarkTiedemann/c0adc1701f3f5c215fc2c2d5b1d5efd3)

$repo = "GAM-team/got-your-back"
$releases = "https://api.github.com/repos/$repo/releases"

Write-Host Determining latest release
$tag = (Invoke-WebRequest $releases | ConvertFrom-Json)[0].tag_name
$file = "gyb-$($tag.Replace('v',''))-windows-x86_64.msi" #filename happens to have tag without the v prefix, this could probably be improved by someone who knows github better

$download = "https://github.com/$repo/releases/download/$tag/$file"

Write-Host Dowloading latest release
Invoke-WebRequest $download -Out $file #saves to current path, you probably want to specify folder here
Sign up to request clarification or add additional context in comments.

Comments

1

This is what I did. Thanks to the answer above.

$repo = "GAM-team/got-your-back"
$releases = "https://api.github.com/repos/$repo/releases"
$InstalledGYB = 'v' + (& C:\gyb\gyb.exe --short-version)

Write-Host "Determining latest release" -ForegroundColor Yellow
$tag = (Invoke-WebRequest $releases | ConvertFrom-Json)[0].tag_name
$CurrentRelease = "gyb-$($tag.Replace('v',''))-windows-x86_64.msi" #filename happens to have tag without the v prefix, this could probably be improved by someone who knows github better

If ($InstalledGYB -ne $Tag) {
    $download = "https://github.com/$repo/releases/download/$tag/$CurrentRelease"

    Write-Host "Dowloading latest release" -ForegroundColor Yellow
    Invoke-WebRequest $download -OutFile "C:\GYB\$CurrentRelease"

    Start-Process -Filepath "C:\GYB\$CurrentRelease" -ArgumentList "/passive" -Wait | Wait-Process -Timeout 60
    Remove-Item "C:\GYB\$CurrentReleasea" -Force -ErrorAction SilentlyContinue
}
Else {
    Write-Host "GYB Current" -ForegroundColor Green
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.