-
Notifications
You must be signed in to change notification settings - Fork 384
/
Copy pathupdate.ps1
43 lines (36 loc) · 1.37 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
33
34
35
36
37
38
39
40
41
42
43
Import-Module AU
$releases = 'https://www.gomlab.com/gomplayer-media-player/'
$versions = 'https://www.gomlab.com/ajax/update.gom?page=1&lang=eng&product=GOMPLAYER&update_lang=eng'
$softwareName = 'GOM Player'
function global:au_BeforeUpdate {
# We need this, otherwise the checksum won't get created
# Since windows 8 or later is skipped.
$Latest.ChecksumType32 = 'sha256'
$Latest.Checksum32 = Get-RemoteChecksum $Latest.URL32
}
function global:au_SearchReplace {
@{
".\tools\chocolateyInstall.ps1" = @{
"(?i)^(\s*softwareName\s*=\s*)'.*'" = "`${1}'$softwareName'"
"(?i)^(\s*url\s*=\s*)'.*'" = "`${1}'$($Latest.URL32)'"
"(?i)^(\s*checksum\s*=\s*)'.*'" = "`${1}'$($Latest.Checksum32)'"
"(?i)^(\s*checksumType\s*=\s*)'.*'" = "`${1}'$($Latest.ChecksumType32)'"
}
}
}
function global:au_GetLatest {
$download_page = Invoke-WebRequest -Uri $releases -UseBasicParsing
$re = '\.exe$'
$url32 = $download_page.Links | ? href -match $re | select -first 1 -expand href
$verRe = '((?:\d+\.){2,3}\d+)'
$version_page = Invoke-WebRequest -Uri $versions -UseBasicParsing
if ($version_page.Content -match $verRe) {
$version32 = $Matches[1]
}
@{
URL32 = $url32
Version = Get-FixVersion $version32 -OnlyFixBelowVersion '2.3.34'
}
}
# Fixes checksum by including global:au_BeforeUpdate
update -ChecksumFor none