@@ -12,9 +12,9 @@ inputs:
1212install-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 (overrides work-vol)
1616required :false
17- default :C:\cygwin
17+ default :' '
1818check-sig :
1919description :Should the setup.ini file signature be checked?
2020required :false
@@ -37,6 +37,10 @@ inputs:
3737description :Check the hash of the installer
3838required :false
3939default :' true'
40+ work-vol :
41+ description :Volume on which to store setup and packages, and install Cygwin
42+ required :false
43+ default :' C:'
4044
4145runs :
4246using :" 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" -OutFileC:\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 -LiteralPathC:\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,15 +84,20 @@ runs:
7884 }
7985 }
8086
87+ $installDir = "$vol\cygwin"
88+ if ('${{ inputs.install-dir }}' -ne '') {
89+ $installDir = '${{ inputs.install-dir }}'
90+ }
91+
8192 $packages = '${{ inputs.packages }}'
8293 $pkg_list = $packages.Split('', [System.StringSplitOptions]::RemoveEmptyEntries)
8394 $pkg_list = $pkg_list | % { $_.Trim() }
8495 $pkg_list = $pkg_list | % { $_.Trim(',') }
8596
8697 $args = @(
8798 '-qnO',
88- '-l','C: \cygwin-packages' ,
89- '-R','${{ inputs.install-dir }}'
99+ '-l',"$vol \cygwin-packages" ,
100+ '-R',"$installDir"
90101 )
91102
92103 if ( '${{ inputs.allow-test-packages }}' -eq 'true' ) {
@@ -133,16 +144,14 @@ runs:
133144
134145 # because setup is a Windows GUI app, make it part of a pipeline to make
135146 # PowerShell wait for it to exit
136- & C:\setup.exe $args | Out-Default
137- shell: powershell
147+ & $setupExe $args | Out-Default
138148
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+ }
142152
143- -run :|
144153 # run login shell to copy skeleton profile files
145- ${{ inputs.install-dir }} \bin\bash.exe --login
154+ & "$installDir \bin\bash.exe" --login
146155 shell: powershell
147156
148157branding :