@@ -12,9 +12,9 @@ inputs:
12
12
install-dir :
13
13
# by default, install to C:\cygwin rather than the platform dependent
14
14
# default to make everything simpler
15
- description : Installation directory
15
+ description : Installation directory (overrides work-vol)
16
16
required : false
17
- default : C:\cygwin
17
+ default : ' '
18
18
check-sig :
19
19
description : Should the setup.ini file signature be checked?
20
20
required : false
@@ -37,6 +37,10 @@ inputs:
37
37
description : Check the hash of the installer
38
38
required : false
39
39
default : ' true'
40
+ work-vol :
41
+ description : Volume on which to store setup and packages, and install Cygwin
42
+ required : false
43
+ default : ' C:'
40
44
41
45
runs :
42
46
using : " composite"
51
55
echo "unknown platform $platform"
52
56
exit 1
53
57
}
58
+ $vol = '${{ inputs.work-vol }}'
59
+ $setupExe = "$vol\setup.exe"
54
60
$setupFileName = "setup-$platform.exe"
55
- Invoke-WebRequest "https://cygwin.com/$setupFileName" -OutFile C:\setup.exe
56
- if ((Get-Item -LiteralPath 'C:\setup.exe' ).Length -eq 0) {
61
+ Invoke-WebRequest "https://cygwin.com/$setupFileName" -OutFile $setupExe
62
+ if ((Get-Item -LiteralPath $setupExe ).Length -eq 0) {
57
63
throw "The downloaded setup has a zero length!"
58
64
}
59
65
69
75
if ($expectedHash -eq '') {
70
76
Write-Output -InputObject "::warning::Unable to find the hash for the file $setupFileName in https://cygwin.com/sha512.sum"
71
77
} else {
72
- $actualHash = $(Get-FileHash -LiteralPath C:\setup.exe -Algorithm SHA512).Hash
78
+ $actualHash = $(Get-FileHash -LiteralPath $setupExe -Algorithm SHA512).Hash
73
79
if ($actualHash -ine $expectedHash) {
74
80
throw "Invalid hash of the downloaded setup!`nExpected: $expectedHash`nActual : $actualHash"
75
81
} else {
@@ -78,15 +84,20 @@ runs:
78
84
}
79
85
}
80
86
87
+ $installDir = "$vol\cygwin"
88
+ if ('${{ inputs.install-dir }}' -ne '') {
89
+ $installDir = '${{ inputs.install-dir }}'
90
+ }
91
+
81
92
$packages = '${{ inputs.packages }}'
82
93
$pkg_list = $packages.Split('', [System.StringSplitOptions]::RemoveEmptyEntries)
83
94
$pkg_list = $pkg_list | % { $_.Trim() }
84
95
$pkg_list = $pkg_list | % { $_.Trim(',') }
85
96
86
97
$args = @(
87
98
'-qnO',
88
- '-l', 'C: \cygwin-packages' ,
89
- '-R', '${{ inputs.install-dir }}'
99
+ '-l', "$vol \cygwin-packages" ,
100
+ '-R', "$installDir"
90
101
)
91
102
92
103
if ( '${{ inputs.allow-test-packages }}' -eq 'true' ) {
@@ -133,16 +144,14 @@ runs:
133
144
134
145
# because setup is a Windows GUI app, make it part of a pipeline to make
135
146
# PowerShell wait for it to exit
136
- & C:\setup.exe $args | Out-Default
137
- shell: powershell
147
+ & $setupExe $args | Out-Default
138
148
139
- - if : ${{ inputs.add-to-path == 'true' }}
140
- run : echo "${{ inputs.install-dir }} \bin" >> $env:GITHUB_PATH
141
- shell : powershell
149
+ if (' ${{ inputs.add-to-path }}' -eq 'true') {
150
+ echo "$installDir \bin" >> $env:GITHUB_PATH
151
+ }
142
152
143
- - run : |
144
153
# run login shell to copy skeleton profile files
145
- ${{ inputs.install-dir }} \bin\bash.exe --login
154
+ & "$installDir \bin\bash.exe" --login
146
155
shell: powershell
147
156
148
157
branding :
0 commit comments