Skip to content

Commit

Permalink
Add support for specifying multiple sites
Browse files Browse the repository at this point in the history
Signed-off-by: Konrad Gräfe <kgraefe@paktolos.net>
  • Loading branch information
kgraefe authored and jon-turney committed Apr 7, 2023
1 parent db47559 commit a12ef94
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Parameters
| platform | x86_64 | Install the x86 or x86\_64 version of Cygwin.
| packages | *none* | List of additional packages to install.
| install-dir | C:\cygwin | Installation directory
| site | http://mirrors.kernel.org/sourceware/cygwin/ | Mirror site to install from
| site | http://mirrors.kernel.org/sourceware/cygwin/ | Mirror sites to install from, separated by whitespace
| check-sig | true | Whether to check the setup.ini signature
| add-to-path | true | Whether to add Cygwin's `/bin` directory to the system `PATH`

Expand Down
29 changes: 16 additions & 13 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ inputs:
required: false
default: true
site:
description: Download site URL
description: Download site URLs separated by whitespace
required: false
add-to-path:
description: Should Cygwin's bin directory be added to the system PATH?
Expand All @@ -46,24 +46,27 @@ runs:
$pkg_list = $pkg_list | % { $_.Trim() }
$pkg_list = $pkg_list | % { $_.Trim(',') }
# default site if not specified
if (! '${{ inputs.site }}' ) {
if ($platform -eq 'x86') {
$site = 'http://mirrors.kernel.org/sourceware/cygwin-archive/20221123'
} else {
$site = 'http://mirrors.kernel.org/sourceware/cygwin/'
}
} else {
$site = '${{ inputs.site }}'
}
$args = @(
'-qgnO',
'-s', $site,
'-l', 'C:\cygwin-packages',
'-R', '${{ inputs.install-dir }}'
)
# default site if not specified
if ( '${{ inputs.site }}' ) {
$sites = '${{ inputs.site }}'
} elseif ($platform -eq 'x86') {
$sites = 'http://mirrors.kernel.org/sourceware/cygwin-archive/20221123'
} else {
$sites = 'http://mirrors.kernel.org/sourceware/cygwin/'
}
$site_list = $sites.Split('', [System.StringSplitOptions]::RemoveEmptyEntries)
$site_list = $site_list | % { $_.Trim() }
foreach ($site in $site_list) {
$args += '-s'
$args += $site
}
if ($pkg_list.Count -gt 0) {
$args += '-P'
$args += $pkg_list -Join(',')
Expand Down

0 comments on commit a12ef94

Please sign in to comment.