-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate.ps1
32 lines (29 loc) · 1.07 KB
/
update.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# for auto update
[CmdletBinding()]
param (
[Parameter()]
[int]
[ValidateRange(0, [int]::MaxValue)]
$Days = 0
)
Import-Module Metaseed.Lib -DisableNameChecking
if (Test-Update $Days $MyInvocation.MyCommand.Path) {
# @(1, 20) -contains (Get-Date).day # problem: always update on that day
[void](
Start-ThreadJob -StreamingHost $host -ArgumentList $PSScriptRoot {
param($scriptRoot)
Write-Host "Updating help via a background job" -ForegroundColor yellow
$back = $ProgressPreference
# hide progress bar
$ProgressPreference = 'SilentlyContinue'
Update-Help -Recurse
$ProgressPreference = $back
. $scriptRoot\Lib\update-modules.ps1
}
)
}
[void](Start-ThreadJob -StreamingHost $host -ArgumentList "$PSScriptRoot\info.json", $Days {
param ($localInfo, $days)
Import-Module Metaseed.Lib -DisableNameChecking
Update-Installation $localInfo 'https://raw.githubusercontent.com/metasong/pwsh/master/info.json' 'https://pwsh.page.link/0' -days $days
})