updated install script to use the global parameters, removed separate $SelfUpdateParameters

This commit is contained in:
Kevin Woley
2025-01-27 10:15:13 -08:00
parent c8776b42c0
commit c433c44b70
3 changed files with 40 additions and 12 deletions
+6 -4
View File
@@ -169,18 +169,20 @@ function Invoke-Maintenance {
$maintenance_success = $false
}
if($AllowResticSelfUpdate -eq $true) {
# Invoke restic self-update to check for a newer version
# This is enabled by default unless configuration disables self-update
if ([String]::IsNullOrEmpty($SelfUpdateEnabled) -or ($SelfUpdateEnabled -eq $true)) {
# check for updated restic version
"[[Maintenance]] Checking for new version of restic..." | Out-File -Append $SuccessLog
Invoke-Expression "$ResticExe $SelfUpdateParameters self-update 3>&1 2>> $ErrorLog | Out-File -Append $SuccessLog"
Invoke-Expression "$ResticExe self-update 3>&1 2>> $ErrorLog | Out-File -Append $SuccessLog"
if(-not $?) {
"[[Maintenance]] Self-update of restic.exe completed with errors" | Tee-Object -Append $ErrorLog | Out-File -Append $SuccessLog
$maintenance_success = $false
}
"[[Maintenance]] End $(Get-Date)" | Out-File -Append $SuccessLog
}
"[[Maintenance]] End $(Get-Date)" | Out-File -Append $SuccessLog
if($maintenance_success -eq $true) {
$Script:ResticStateLastMaintenance = Get-Date
$Script:ResticStateMaintenanceCounter = 0