diff --git a/library/general/src/modules/Arch.rb b/library/general/src/modules/Arch.rb index 7ff875f6e..d07cd2a71 100644 --- a/library/general/src/modules/Arch.rb +++ b/library/general/src/modules/Arch.rb @@ -498,7 +498,11 @@ def x11_setup_needed # # @return [Boolean] true if runs on WSL; false otherwise def is_wsl - SCR.Read(path(".target.string"), "/proc/sys/kernel/osrelease").to_s.include?("-Microsoft") + # As of 2020-07-24 /proc/sys/kernel/osrelease contains + # "4.4.0-19041-Microsoft" on wsl1 and + # "4.19.104-microsoft-standard" on wsl2. + # Match on lowercase "-microsoft" + SCR.Read(path(".target.string"), "/proc/sys/kernel/osrelease").to_s.downcase.include?("-microsoft") end publish function: :architecture, type: "string ()" diff --git a/library/general/test/arch_test.rb b/library/general/test/arch_test.rb index bd208c68a..18688a516 100755 --- a/library/general/test/arch_test.rb +++ b/library/general/test/arch_test.rb @@ -52,8 +52,16 @@ .and_return(osrelease) end - context "when it runs on a Microsoft kernel" do - let(:osrelease) { "5.3.11-Microsoft" } + context "when it runs on a Microsoft kernel under WSL1" do + let(:osrelease) { "4.4.0-19041-Microsoft" } + + it "returns true" do + expect(Yast::Arch.is_wsl).to eq(true) + end + end + + context "when it runs on a Microsoft kernel under WSL2" do + let(:osrelease) { "4.19.104-microsoft-standard" } it "returns true" do expect(Yast::Arch.is_wsl).to eq(true) diff --git a/package/yast2.changes b/package/yast2.changes index dd0cc8278..a1ee8e956 100644 --- a/package/yast2.changes +++ b/package/yast2.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Fri Jul 24 08:06:27 UTC 2020 - Jeff Kowalczyk + +- update is_wsl function to match wsl1 and wsl2 osrelease spellings + (boo#1174183) +- 4.2.87 + ------------------------------------------------------------------- Tue Jul 7 09:48:04 CEST 2020 - schubi@suse.de diff --git a/package/yast2.spec b/package/yast2.spec index c99a1170a..b91f45f10 100644 --- a/package/yast2.spec +++ b/package/yast2.spec @@ -17,7 +17,7 @@ Name: yast2 -Version: 4.2.86 +Version: 4.2.87 Release: 0 Summary: YaST2 Main Package License: GPL-2.0-only