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

The do-we-need-to-upgrade.ps1 script doesn't pull the correct Major version #30

Open
turpie opened this issue Oct 10, 2023 · 2 comments

Comments

@turpie
Copy link

turpie commented Oct 10, 2023

The do-we-need-to-upgrade.ps1 is notifying us of updates to old PaperCut major versions.

PS C:\scripts> . 'C:\scripts\do-we-need-to-upgrade.ps1'
Got the API Key!
Latest PaperCut release is 20.1.9. Installed Release is 22.1.4
PaperCut  20.1.9 already checked. Nothing to do here

How can we query for updates applicable to just the Major version that we are currently on? And later Major versions?

@turpie
Copy link
Author

turpie commented Oct 10, 2023

I fixed it on our site by changing:

$CURRENT_RELEASE = [System.Version]((Invoke-RestMethod -uri http://www.papercut.com/products/mf/release-history.atom).id[0]  `
        -replace "^tag:papercut.com,[0-9]+-[0-9]+-[0-9]+:$PRODUCT\/releases\/v(\d+)-(\d+)-(\d+)", '$1.$2.$3')

to:

$releases = Invoke-RestMethod -uri http://www.papercut.com/products/mf/release-history.atom
$releases |ForEach-Object {
        $version = [System.Version]$_.id.Split('/v')[-1].Replace('-','.')
        if($version -gt $latest.version){
            $latest = $_
            $latest | Add-Member -MemberType NoteProperty -Name "version" -Value $version
        }
}
$CURRENT_RELEASE = $latest.version

@Joffcom
Copy link
Contributor

Joffcom commented Oct 10, 2023

Looks like the original version didn’t take fixes to older releases into consideration. Would be worth creating a PR to get the change merged in.

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

No branches or pull requests

2 participants