forked from flcdrg/au-packages
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update.ps1
60 lines (47 loc) · 2.04 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import-module au
$releases = 'https://www.scootersoftware.com/download.php'
function global:au_SearchReplace {
@{
'tools\chocolateyInstall.ps1' = @{
"(^\`$version\s*=\s*)('.*')" = "`$1'$($Latest.Version)'"
"(^\`$checksum\s*=\s*)('.*')" = "`$1'$($Latest.Checksum_EN)'"
"(^\`$checksumde\s*=\s*)('.*')" = "`$1'$($Latest.Checksum_DE)'"
"(^\`$checksumfr\s*=\s*)('.*')" = "`$1'$($Latest.Checksum_FR)'"
"(^\`$checksumjp\s*=\s*)('.*')" = "`$1'$($Latest.Checksum_JP)'"
"(^\`$checksumzh\s*=\s*)('.*')" = "`$1'$($Latest.Checksum_ZH)'"
}
}
}
function global:au_GetLatest {
# 32bit
$download_page = Invoke-WebRequest -Uri $releases
#https://www.scootersoftware.com/BCompare-4.2.1.22354.exe
$content = $download_page.Content.Trim()
$content -match "BCompare-(?<version>\d+\.\d+\.\d+\.\d+)\.exe"
$version = $Matches.version
$url_en = "https://www.scootersoftware.com/BCompare-$($version).exe"
# https://www.scootersoftware.com/BCompare-de-4.2.1.22354.exe
# https://www.scootersoftware.com/BCompare-fr-4.2.1.22354.exe
# https://www.scootersoftware.com/BCompare-jp-4.2.1.22354.exe
$url_de = "https://www.scootersoftware.com/BCompare-de-$($version).exe"
$url_fr = "https://www.scootersoftware.com/BCompare-fr-$($version).exe"
$url_jp = "https://www.scootersoftware.com/BCompare-jp-$($version).exe"
$url_zh = "https://www.scootersoftware.com/BCompare-zh-$($version).exe"
$Latest = @{
URL_EN = $url_en
URL_DE = $url_de
URL_FR = $url_fr
URL_JP = $url_jp
URL_ZH = $url_zh
Version = $version
}
return $Latest
}
function global:au_BeforeUpdate() {
$Latest.Checksum_EN = Get-RemoteChecksum $Latest.URL_EN
$Latest.Checksum_DE = Get-RemoteChecksum $Latest.URL_DE
$Latest.Checksum_FR = Get-RemoteChecksum $Latest.URL_FR
$Latest.Checksum_JP = Get-RemoteChecksum $Latest.URL_JP
$Latest.Checksum_ZH = Get-RemoteChecksum $Latest.URL_ZH
}
update -ChecksumFor none