-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathupdate.ps1
More file actions
30 lines (24 loc) · 903 Bytes
/
update.ps1
File metadata and controls
30 lines (24 loc) · 903 Bytes
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
$ErrorActionPreference = 'Stop'
import-module Chocolatey-AU
Import-Module ..\..\scripts\au_extensions.psm1
$releases = 'https://litecoin.org/'
function global:au_SearchReplace {
@{
'tools/chocolateyInstall.ps1' = @{
"(^[$]url\s*=\s*)('.*')" = "`$1'$($Latest.URL32)'"
"(^[$]checksum\s*=\s*)('.*')" = "`$1'$($Latest.Checksum32)'"
"(^[$]checksumType\s*=\s*)('.*')" = "`$1'$($Latest.ChecksumType32)'"
}
}
}
function global:au_AfterUpdate($Package) {
Invoke-VirusTotalScan $Package
}
function global:au_GetLatest {
$page = Invoke-WebRequest -Uri $releases
$url32 = ($page.links | Where-Object { $_.href -match 'exe$'}).href | Select-Object -First 1
$version=$url32.Split('-') | Where-Object {$_ -Match '\.'} | Where-Object {$_ -notmatch ".exe$"} | Where-Object {$_ -notmatch '\/'}
$Latest = @{ URL32 = $url32; Version = $version }
return $Latest
}
update -ChecksumFor 32