Skip to content

Commit

Permalink
Add Major Update switch parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
fvanroie committed Oct 24, 2018
1 parent 8b5e7e5 commit 238bed9
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion Public/Firmware/Update-OPNsenseFirmware.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,26 @@ Function Update-OPNsenseFirmware {
SupportsShouldProcess = $true,
ConfirmImpact = "High"
)]
Param()
Param(
[Switch]$Major
)
if ($pscmdlet.ShouldProcess($MyInvocation.MyCommand.Module.PrivateData['OPNsenseApi'])) {

if ([bool]::Parse($Major)) {
$form = 'upgrade=maj'
} else {
$form = 'upgrade'
}

$result = Invoke-OPNsenseCommand core firmware upgrade -Form 'upgrade' -Verbose:$VerbosePreference

if ($result.status -eq 'ok') {
$result = Get-OPNsenseUpdateStatus -Title "Update OPNsense" -Verbose:$VerbosePreference
if ($result.status -eq "Reboot") {
Write-Warning "The OPNsense server will now reboot."
}
}

return $result
}
}

0 comments on commit 238bed9

Please sign in to comment.