Skip to content

Commit a12ef94

Browse files
kgraefejon-turney
authored andcommitted
Add support for specifying multiple sites
Signed-off-by: Konrad Gräfe <[email protected]>
1 parent db47559 commit a12ef94

File tree

2 files changed

+17
-14
lines changed

2 files changed

+17
-14
lines changed

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Parameters
2323
| platform | x86_64 | Install the x86 or x86\_64 version of Cygwin.
2424
| packages | *none* | List of additional packages to install.
2525
| install-dir | C:\cygwin | Installation directory
26-
| site | http://mirrors.kernel.org/sourceware/cygwin/ | Mirror site to install from
26+
| site | http://mirrors.kernel.org/sourceware/cygwin/ | Mirror sites to install from, separated by whitespace
2727
| check-sig | true | Whether to check the setup.ini signature
2828
| add-to-path | true | Whether to add Cygwin's `/bin` directory to the system `PATH`
2929

Diff for: action.yml

+16-13
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ inputs:
2020
required: false
2121
default: true
2222
site:
23-
description: Download site URL
23+
description: Download site URLs separated by whitespace
2424
required: false
2525
add-to-path:
2626
description: Should Cygwin's bin directory be added to the system PATH?
@@ -46,24 +46,27 @@ runs:
4646
$pkg_list = $pkg_list | % { $_.Trim() }
4747
$pkg_list = $pkg_list | % { $_.Trim(',') }
4848
49-
# default site if not specified
50-
if (! '${{ inputs.site }}' ) {
51-
if ($platform -eq 'x86') {
52-
$site = 'http://mirrors.kernel.org/sourceware/cygwin-archive/20221123'
53-
} else {
54-
$site = 'http://mirrors.kernel.org/sourceware/cygwin/'
55-
}
56-
} else {
57-
$site = '${{ inputs.site }}'
58-
}
59-
6049
$args = @(
6150
'-qgnO',
62-
'-s', $site,
6351
'-l', 'C:\cygwin-packages',
6452
'-R', '${{ inputs.install-dir }}'
6553
)
6654
55+
# default site if not specified
56+
if ( '${{ inputs.site }}' ) {
57+
$sites = '${{ inputs.site }}'
58+
} elseif ($platform -eq 'x86') {
59+
$sites = 'http://mirrors.kernel.org/sourceware/cygwin-archive/20221123'
60+
} else {
61+
$sites = 'http://mirrors.kernel.org/sourceware/cygwin/'
62+
}
63+
$site_list = $sites.Split('', [System.StringSplitOptions]::RemoveEmptyEntries)
64+
$site_list = $site_list | % { $_.Trim() }
65+
foreach ($site in $site_list) {
66+
$args += '-s'
67+
$args += $site
68+
}
69+
6770
if ($pkg_list.Count -gt 0) {
6871
$args += '-P'
6972
$args += $pkg_list -Join(',')

0 commit comments

Comments
 (0)