Skip to content

Commit

Permalink
Add support for Ubuntu 24.04 (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vampire committed May 27, 2024
1 parent 9be6f77 commit 0a96987
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 22 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/test.main.kts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ val openSuseLeap15_2 = mapOf(
"default-absent-tool" to "which"
)

val ubuntu2404 = mapOf(
"wsl-id" to "Ubuntu-24.04",
"user-id" to "Ubuntu-24.04",
"match-pattern" to "*Ubuntu*24.04*",
"default-absent-tool" to "dos2unix"
)

val ubuntu2204 = mapOf(
"wsl-id" to "Ubuntu",
"user-id" to "Ubuntu-22.04",
Expand Down Expand Up @@ -111,6 +118,7 @@ val distributions = listOf(
alpine,
kali,
openSuseLeap15_2,
ubuntu2404,
ubuntu2204,
ubuntu2004,
ubuntu1804,
Expand Down
85 changes: 65 additions & 20 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,10 @@ jobs:
user-id: 'openSUSE-Leap-15.2'
match-pattern: '*openSUSE*Leap*15.2*'
default-absent-tool: 'which'
- wsl-id: 'Ubuntu-24.04'
user-id: 'Ubuntu-24.04'
match-pattern: '*Ubuntu*24.04*'
default-absent-tool: 'dos2unix'
- wsl-id: 'Ubuntu'
user-id: 'Ubuntu-22.04'
match-pattern: '*Ubuntu*22.04*'
Expand Down Expand Up @@ -840,6 +844,10 @@ jobs:
user-id: 'openSUSE-Leap-15.2'
match-pattern: '*openSUSE*Leap*15.2*'
default-absent-tool: 'which'
- wsl-id: 'Ubuntu-24.04'
user-id: 'Ubuntu-24.04'
match-pattern: '*Ubuntu*24.04*'
default-absent-tool: 'dos2unix'
- wsl-id: 'Ubuntu'
user-id: 'Ubuntu-22.04'
match-pattern: '*Ubuntu*22.04*'
Expand Down Expand Up @@ -940,6 +948,10 @@ jobs:
user-id: 'openSUSE-Leap-15.2'
match-pattern: '*openSUSE*Leap*15.2*'
default-absent-tool: 'which'
- wsl-id: 'Ubuntu-24.04'
user-id: 'Ubuntu-24.04'
match-pattern: '*Ubuntu*24.04*'
default-absent-tool: 'dos2unix'
- wsl-id: 'Ubuntu'
user-id: 'Ubuntu-22.04'
match-pattern: '*Ubuntu*22.04*'
Expand Down Expand Up @@ -1073,6 +1085,10 @@ jobs:
user-id: 'openSUSE-Leap-15.2'
match-pattern: '*openSUSE*Leap*15.2*'
default-absent-tool: 'which'
- wsl-id: 'Ubuntu-24.04'
user-id: 'Ubuntu-24.04'
match-pattern: '*Ubuntu*24.04*'
default-absent-tool: 'dos2unix'
- wsl-id: 'Ubuntu'
user-id: 'Ubuntu-22.04'
match-pattern: '*Ubuntu*22.04*'
Expand Down Expand Up @@ -1302,6 +1318,10 @@ jobs:
user-id: 'openSUSE-Leap-15.2'
match-pattern: '*openSUSE*Leap*15.2*'
default-absent-tool: 'which'
- wsl-id: 'Ubuntu-24.04'
user-id: 'Ubuntu-24.04'
match-pattern: '*Ubuntu*24.04*'
default-absent-tool: 'dos2unix'
- wsl-id: 'Ubuntu'
user-id: 'Ubuntu-22.04'
match-pattern: '*Ubuntu*22.04*'
Expand Down Expand Up @@ -1514,16 +1534,21 @@ jobs:
match-pattern: '*openSUSE*Leap*15.2*'
default-absent-tool: 'which'
distribution5:
wsl-id: 'Ubuntu-24.04'
user-id: 'Ubuntu-24.04'
match-pattern: '*Ubuntu*24.04*'
default-absent-tool: 'dos2unix'
distribution6:
wsl-id: 'Ubuntu'
user-id: 'Ubuntu-20.04'
match-pattern: '*Ubuntu*20.04*'
default-absent-tool: 'dos2unix'
distribution6:
distribution7:
wsl-id: 'Ubuntu-18.04'
user-id: 'Ubuntu-18.04'
match-pattern: '*Ubuntu*18.04*'
default-absent-tool: 'dos2unix'
distribution7:
distribution8:
wsl-id: 'Ubuntu-16.04'
user-id: 'Ubuntu-16.04'
match-pattern: '*Ubuntu*16.04*'
Expand All @@ -1549,16 +1574,21 @@ jobs:
match-pattern: '*openSUSE*Leap*15.2*'
default-absent-tool: 'which'
distribution5:
wsl-id: 'Ubuntu-24.04'
user-id: 'Ubuntu-24.04'
match-pattern: '*Ubuntu*24.04*'
default-absent-tool: 'dos2unix'
distribution6:
wsl-id: 'Ubuntu'
user-id: 'Ubuntu-22.04'
match-pattern: '*Ubuntu*22.04*'
default-absent-tool: 'dos2unix'
distribution6:
distribution7:
wsl-id: 'Ubuntu-18.04'
user-id: 'Ubuntu-18.04'
match-pattern: '*Ubuntu*18.04*'
default-absent-tool: 'dos2unix'
distribution7:
distribution8:
wsl-id: 'Ubuntu-16.04'
user-id: 'Ubuntu-16.04'
match-pattern: '*Ubuntu*16.04*'
Expand Down Expand Up @@ -1615,6 +1645,12 @@ jobs:
distribution: '${{ matrix.distributions.distribution7.user-id }}'
set-as-default: 'false'
- id: 'step-8'
name: 'Execute action for ${{ matrix.distributions.distribution8.user-id }}'
uses: './'
with:
distribution: '${{ matrix.distributions.distribution8.user-id }}'
set-as-default: 'false'
- id: 'step-9'
name: 'Test - wsl-bash_${{ matrix.distributions.distribution1.user-id }} should use the correct distribution'
shell: 'wsl-bash_Debian {0}'
run: |-
Expand All @@ -1623,7 +1659,7 @@ jobs:
if: |-
always()
&& (steps.step-1.outcome == 'success')
- id: 'step-9'
- id: 'step-10'
name: 'Test - wsl-bash_${{ matrix.distributions.distribution2.user-id }} should use the correct distribution'
shell: 'wsl-bash_Alpine {0}'
run: |-
Expand All @@ -1632,7 +1668,7 @@ jobs:
if: |-
always()
&& (steps.step-2.outcome == 'success')
- id: 'step-10'
- id: 'step-11'
name: 'Test - wsl-bash_${{ matrix.distributions.distribution3.user-id }} should use the correct distribution'
shell: 'wsl-bash_kali-linux {0}'
run: |-
Expand All @@ -1641,7 +1677,7 @@ jobs:
if: |-
always()
&& (steps.step-3.outcome == 'success')
- id: 'step-11'
- id: 'step-12'
name: 'Test - wsl-bash_${{ matrix.distributions.distribution4.user-id }} should use the correct distribution'
shell: 'wsl-bash_openSUSE-Leap-15.2 {0}'
run: |-
Expand All @@ -1650,41 +1686,50 @@ jobs:
if: |-
always()
&& (steps.step-4.outcome == 'success')
- id: 'step-12'
- id: 'step-13'
name: 'Test - wsl-bash_${{ matrix.distributions.distribution5.user-id }} should use the correct distribution'
shell: 'wsl-bash_Ubuntu-22.04 {0}'
shell: 'wsl-bash_Ubuntu-24.04 {0}'
run: |-
cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true)
[[ "$(cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true))" == ${{ matrix.distributions.distribution5.match-pattern }} ]]
if: |-
always()
&& (steps.step-5.outcome == 'success')
&& (matrix.distributions.distribution5.user-id != 'Ubuntu-20.04')
- id: 'step-13'
name: 'Test - wsl-bash_${{ matrix.distributions.distribution5.user-id }} should use the correct distribution'
shell: 'wsl-bash_Ubuntu-20.04 {0}'
- id: 'step-14'
name: 'Test - wsl-bash_${{ matrix.distributions.distribution6.user-id }} should use the correct distribution'
shell: 'wsl-bash_Ubuntu-22.04 {0}'
run: |-
cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true)
[[ "$(cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true))" == ${{ matrix.distributions.distribution5.match-pattern }} ]]
[[ "$(cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true))" == ${{ matrix.distributions.distribution6.match-pattern }} ]]
if: |-
always()
&& (steps.step-5.outcome == 'success')
&& (matrix.distributions.distribution5.user-id != 'Ubuntu-22.04')
- id: 'step-14'
&& (steps.step-6.outcome == 'success')
&& (matrix.distributions.distribution6.user-id != 'Ubuntu-20.04')
- id: 'step-15'
name: 'Test - wsl-bash_${{ matrix.distributions.distribution6.user-id }} should use the correct distribution'
shell: 'wsl-bash_Ubuntu-18.04 {0}'
shell: 'wsl-bash_Ubuntu-20.04 {0}'
run: |-
cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true)
[[ "$(cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true))" == ${{ matrix.distributions.distribution6.match-pattern }} ]]
if: |-
always()
&& (steps.step-6.outcome == 'success')
- id: 'step-15'
&& (matrix.distributions.distribution6.user-id != 'Ubuntu-22.04')
- id: 'step-16'
name: 'Test - wsl-bash_${{ matrix.distributions.distribution7.user-id }} should use the correct distribution'
shell: 'wsl-bash_Ubuntu-16.04 {0}'
shell: 'wsl-bash_Ubuntu-18.04 {0}'
run: |-
cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true)
[[ "$(cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true))" == ${{ matrix.distributions.distribution7.match-pattern }} ]]
if: |-
always()
&& (steps.step-7.outcome == 'success')
- id: 'step-17'
name: 'Test - wsl-bash_${{ matrix.distributions.distribution8.user-id }} should use the correct distribution'
shell: 'wsl-bash_Ubuntu-16.04 {0}'
run: |-
cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true)
[[ "$(cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true))" == ${{ matrix.distributions.distribution8.match-pattern }} ]]
if: |-
always()
&& (steps.step-8.outcome == 'success')
1 change: 1 addition & 0 deletions action-types.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ inputs:
- Debian
- kali-linux
- openSUSE-Leap-15.2
- Ubuntu-24.04
- Ubuntu-22.04
- Ubuntu-20.04
- Ubuntu-18.04
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ inputs:
'Ubuntu-22.04' and 'Ubuntu-20.04' can not be used together at the same time.
They use the same WSL distribution ID, so the second that is used will not be installed
as the first one will be found as already installed by WSL distribution ID.
Valid values: 'Alpine', 'Debian', 'kali-linux', 'openSUSE-Leap-15.2', 'Ubuntu-22.04', 'Ubuntu-20.04', 'Ubuntu-18.04', 'Ubuntu-16.04'
Valid values: 'Alpine', 'Debian', 'kali-linux', 'openSUSE-Leap-15.2', 'Ubuntu-24.04', 'Ubuntu-22.04', 'Ubuntu-20.04', 'Ubuntu-18.04', 'Ubuntu-16.04'
required: false
default: Debian

Expand Down
1 change: 1 addition & 0 deletions readme/README_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ The values currently supported by this action are:
* `Alpine`
* `kali-linux`
* `openSUSE-Leap-15.2`
* `Ubuntu-24.04`
* `Ubuntu-22.04`
* `Ubuntu-20.04`
* `Ubuntu-18.04`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ val distributions = listOf(
Ubuntu1604,
Ubuntu1804,
Ubuntu2004,
Ubuntu2204
Ubuntu2204,
Ubuntu2404
).associateBy { it.userId }

sealed class Distribution(
Expand Down Expand Up @@ -246,6 +247,16 @@ abstract class AptGetBasedDistribution : Distribution {
}
}

object Ubuntu2404 : AptGetBasedDistribution(
wslId = "Ubuntu-24.04",
distributionName = "Ubuntu",
version = SemVer("24.4.0", jso<SemVerRangeOptions>()),
// work-around for missing shortlink on https://learn.microsoft.com/en-us/windows/wsl/install-manual#downloading-distributions
//downloadUrl = URL("https://aka.ms/wslubuntu2404"),
productId = "9nz3klhxdjp5",
installerFile = "ubuntu2404.exe"
)

object Ubuntu2204 : AptGetBasedDistribution(
wslId = "Ubuntu",
userId = "Ubuntu-22.04",
Expand Down

0 comments on commit 0a96987

Please sign in to comment.