Skip to content

Commit 9f8397a

Browse files
committed
cygwin: use forward slash path separators with gpg
While here, Push-Location into ${Cygwin} to not have to convert existing path separators in variables to forward slashes.
1 parent 12aac57 commit 9f8397a

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

windows/cygwin.ps1

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,24 +46,28 @@ New-Item -Type Directory "${GpgHome}" -Force
4646
New-Item -Type File "${GpgHome}\common.conf" -Force
4747

4848
# Fetch and verify Cygwin.
49+
Push-Location ${Cygwin}
4950
try {
50-
if (-Not (Test-Path ${Cygwin}\${Setup} -PathType leaf)) {
51+
if (-Not (Test-Path .\${Setup} -PathType leaf)) {
5152
Invoke-WebRequest ${URL}/${Setup} `
52-
-OutFile ${Cygwin}\${Setup}
53+
-OutFile .\${Setup}
5354
}
54-
if (-Not (Test-Path ${Cygwin}\${Setup}.sig -PathType leaf)) {
55+
if (-Not (Test-Path .\${Setup}.sig -PathType leaf)) {
5556
Invoke-WebRequest ${URL}/${Setup}.sig `
56-
-OutFile ${Cygwin}\${Setup}.sig
57+
-OutFile .\${Setup}.sig
5758
}
58-
& $GPG --homedir ${GpgHome} --list-keys
59-
& $GPG --homedir ${GpgHome} --quiet --no-default-keyring `
60-
--keyring ${PSScriptRoot}/cygwin.gpg `
61-
--verify ${Cygwin}\${Setup}.sig ${Cygwin}\${Setup}
59+
Copy-Item "$PSScriptRoot\cygwin.gpg" -Destination "${Cygwin}"
60+
& $GPG --homedir ./.gnupg --list-keys
61+
& $GPG --homedir ./.gnupg --quiet --no-default-keyring `
62+
--keyring ./cygwin.gpg `
63+
--verify ./${Setup}.sig ./${Setup}
6264
if ($LastExitCode -ne 0) {
6365
throw "GPG signature verification failed"
6466
}
6567
} catch {
6668
throw "Failed to fetch and verify Cygwin"
69+
} finally {
70+
Pop-Location
6771
}
6872

6973
# Bootstrap Cygwin.

0 commit comments

Comments
 (0)