-
Notifications
You must be signed in to change notification settings - Fork 136
/
test-codesigntool.ps1
47 lines (38 loc) · 1.01 KB
/
test-codesigntool.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
function TestFile {
param (
[string]$Path
)
if (Test-Path $Path -PathType Leaf) {
Write-Host "File exists: $Path";
}
else {
Write-Error "File doesn't exist: $Path";
exit 1;
}
}
function TestDirectory {
param (
[string]$Path
)
if (Test-Path $Path -PathType Container) {
Write-Host "Directory exists: $Path";
}
else {
Write-Error "Directory doesn't exist: $Path";
exit 1;
}
}
$codeSignToolDir = [IO.Path]::GetFullPath('.\CodeSignTool')
TestDirectory($codeSignToolDir)
$codeSignToolBat = Join-Path -Path $codeSignToolDir -ChildPath 'CodeSignTool.bat'
TestFile($codeSignToolBat)
Set-Location $codeSignToolDir
& $codeSignToolBat credential_info -username="$env:ES_USERNAME" -password="$env:ES_PASSWORD" -credential_id="$env:ES_CREDENTIAL_ID"
$exitCode = $LASTEXITCODE
if ($exitCode -eq 0) {
Write-Host 'Signing test completed'
}
else {
Write-Error "Signing test failed with code $exitCode"
exit $exitCode
}