@@ -12,9 +12,9 @@ inputs:
1212 install-dir :
1313 # by default, install to C:\cygwin rather than the platform dependent
1414 # default to make everything simpler
15- description : Installation directory
15+ description : Installation directory (path overrides work-vol for install-dir)
1616 required : false
17- default : C:\cygwin
17+ default : ' '
1818 check-sig :
1919 description : Should the setup.ini file signature be checked?
2020 required : false
@@ -37,6 +37,10 @@ inputs:
3737 description : Check the hash of the installer
3838 required : false
3939 default : ' true'
40+ work-vol :
41+ description : Volume on which to store \setup.exe, \cygwin-packages, \cygwin
42+ required : false
43+ default : ' C:'
4044
4145runs :
4246 using : " composite"
5155 echo "unknown platform $platform"
5256 exit 1
5357 }
58+ $vol = '${{ inputs.work-vol }}'
59+ $setupExe = "$vol\setup.exe"
5460 $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) {
5763 throw "The downloaded setup has a zero length!"
5864 }
5965
6975 if ($expectedHash -eq '') {
7076 Write-Output -InputObject "::warning::Unable to find the hash for the file $setupFileName in https://cygwin.com/sha512.sum"
7177 } else {
72- $actualHash = $(Get-FileHash -LiteralPath C:\setup.exe -Algorithm SHA512).Hash
78+ $actualHash = $(Get-FileHash -LiteralPath $setupExe -Algorithm SHA512).Hash
7379 if ($actualHash -ine $expectedHash) {
7480 throw "Invalid hash of the downloaded setup!`nExpected: $expectedHash`nActual : $actualHash"
7581 } else {
@@ -78,10 +84,12 @@ runs:
7884 }
7985 }
8086
87+ $installDir = '${{ inputs.install-dir }}' -ne '' ? '${{ inputs.install-dir }}' : "$vol\cygwin"
88+
8189 $args = @(
8290 '-qnO',
83- '-l', 'C: \cygwin-packages' ,
84- '-R', '${{ inputs.install-dir }}'
91+ '-l', "$vol \cygwin-packages" ,
92+ '-R', "$installDir"
8593 )
8694
8795 if ( '${{ inputs.allow-test-packages }}' -eq 'true' ) {
@@ -124,16 +132,19 @@ runs:
124132
125133 # because setup is a Windows GUI app, make it part of a pipeline to make
126134 # PowerShell wait for it to exit
127- & C:\setup.exe $args | Out-Default
135+ & $setupExe $args | Out-Default
128136 shell: pwsh
129137
130138 - if : ${{ inputs.add-to-path == 'true' }}
131- run : echo "${{ inputs.install-dir }}\bin" >> $env:GITHUB_PATH
139+ run : |
140+ $installDir = '${{ inputs.install-dir }}' -ne '' ? '${{ inputs.install-dir }}' : '${{ inputs.work-vol }}\cygwin'
141+ echo "$installDir\bin" >> $env:GITHUB_PATH
132142 shell : pwsh
133143
134144 - run : |
135145 # run login shell to copy skeleton profile files
136- ${{ inputs.install-dir }}\bin\bash.exe --login
146+ $installDir = '${{ inputs.install-dir }}' -ne '' ? '${{ inputs.install-dir }}' : '${{ inputs.work-vol }}\cygwin'
147+ & "$installDir\bin\bash.exe" --login
137148 shell: pwsh
138149
139150branding :
0 commit comments