From 977fe02ff152e599431929156b63198a3afb369f Mon Sep 17 00:00:00 2001 From: Abhijay jain Date: Sat, 3 Jun 2023 23:25:29 +0530 Subject: [PATCH 1/2] Chore: Updated prerequsite to check Win Store ver Signed-off-by: Abhijay jain --- src/main/handlers/Utilities/Prerequisites.ts | 3 ++- .../components/Config/PrereqsView.tsx | 26 ++++++++++++++----- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/main/handlers/Utilities/Prerequisites.ts b/src/main/handlers/Utilities/Prerequisites.ts index 906956b3..0ea9e251 100644 --- a/src/main/handlers/Utilities/Prerequisites.ts +++ b/src/main/handlers/Utilities/Prerequisites.ts @@ -2,7 +2,8 @@ import { AppModel, getAppModel } from '../../../models/AppStatus' export const WindowsPrerequisites: AppModel[] = [ getAppModel('wsl', 'Windows Subsystem for Linux (WSL)', 'wsl --status;', false), - getAppModel('wslUbuntu', 'WSL Ubuntu Distribution', 'wsl --status;', false), + getAppModel('wslUbuntu', 'WSL Ubuntu Distribution', 'wsl --list --quiet Ubuntu;', false), + getAppModel('wslUbuntuStore', 'WSL Ubuntu Distribution from Windows Store', 'wsl --list --quiet Ubuntu-20.04;', false), getAppModel('dockerDesktop', 'Docker Desktop', 'docker version;', false), getAppModel('dockerDesktopUbuntu', 'Docker Desktop WSL Ubuntu Integration', 'wsl docker version;', false) ] diff --git a/src/renderer/components/Config/PrereqsView.tsx b/src/renderer/components/Config/PrereqsView.tsx index 711fdaf4..4630f6bc 100644 --- a/src/renderer/components/Config/PrereqsView.tsx +++ b/src/renderer/components/Config/PrereqsView.tsx @@ -48,11 +48,11 @@ const PrereqsView = ({ sx }: Props) => { } const processDescriptions = (status: AppModel) => { - if (status.id === 'wsl' || status.id === 'wslUbuntu') { + if (status.id === 'wsl' || status.id === 'wslUbuntu' || status.id === 'wslUbuntuStore') { status.description = ( - Make sure WSL is installed and Ubuntu is selected as default distribution.{' '} + Make sure WSL is installed and Ubuntu is selected as the default distribution.{' '} Install WSL @@ -63,18 +63,30 @@ const PrereqsView = ({ sx }: Props) => {

- To ensure 'Ubuntu' is set as default WSL distribution. You can check your default distribution by - running following command in Powershell/CMD: + To ensure 'Ubuntu' is set as the default WSL distribution, you can check your default distribution by + running the following command in PowerShell/CMD:
- wsl -l + wsl --list --quiet

- Afterwards, if Ubuntu is not selected as default, then you can do so by running following command: + Afterwards, if Ubuntu is not selected as the default, you can set it as the default by running the + following command:
- wsl -s Ubuntu + wsl --set-default Ubuntu + + )} + {status.id === 'wslUbuntuStore' && ( + <> +
+
+ + To install the Ubuntu distribution from the Windows Store, you can run the following command: + +
+ wsl --install -d Ubuntu-20.04 )}
From 3eabdb4dff5f919858199ac206301961858550d9 Mon Sep 17 00:00:00 2001 From: Abhijay jain Date: Thu, 15 Jun 2023 17:29:17 +0530 Subject: [PATCH 2/2] Chore : resolved requested changes Signed-off-by: Abhijay jain --- src/main/handlers/Utilities/Prerequisites.ts | 4 ++-- .../handlers/Utilities/Utilities.class.ts | 5 +++-- .../components/Config/PrereqsView.tsx | 19 ++++++++----------- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/main/handlers/Utilities/Prerequisites.ts b/src/main/handlers/Utilities/Prerequisites.ts index 0ea9e251..3d0cd648 100644 --- a/src/main/handlers/Utilities/Prerequisites.ts +++ b/src/main/handlers/Utilities/Prerequisites.ts @@ -2,8 +2,8 @@ import { AppModel, getAppModel } from '../../../models/AppStatus' export const WindowsPrerequisites: AppModel[] = [ getAppModel('wsl', 'Windows Subsystem for Linux (WSL)', 'wsl --status;', false), - getAppModel('wslUbuntu', 'WSL Ubuntu Distribution', 'wsl --list --quiet Ubuntu;', false), - getAppModel('wslUbuntuStore', 'WSL Ubuntu Distribution from Windows Store', 'wsl --list --quiet Ubuntu-20.04;', false), + getAppModel('wslUbuntu', 'WSL Ubuntu Distribution', 'wsl --status;', false), + getAppModel('wslUbuntuStore', 'Ubuntu from Windows Store', 'Get-service wslservice;', false), getAppModel('dockerDesktop', 'Docker Desktop', 'docker version;', false), getAppModel('dockerDesktopUbuntu', 'Docker Desktop WSL Ubuntu Integration', 'wsl docker version;', false) ] diff --git a/src/main/handlers/Utilities/Utilities.class.ts b/src/main/handlers/Utilities/Utilities.class.ts index d9d0fd21..d90ca129 100755 --- a/src/main/handlers/Utilities/Utilities.class.ts +++ b/src/main/handlers/Utilities/Utilities.class.ts @@ -103,7 +103,7 @@ class Utilities { return WindowsPrerequisites } } catch (err) { - log.error('Failed to get pre requisites.', err) + log.error('Failed to get prerequisites.', err) } return [] @@ -120,7 +120,7 @@ class Utilities { if (error || stderr) { log.error( - `Error while executing check ${prerequisite.name} command: ${prerequisite.checkCommand}.`, + `Error while executing the check ${prerequisite.name} command: ${prerequisite.checkCommand}.`, error, stderr ) @@ -129,6 +129,7 @@ class Utilities { if ( (prerequisite.id === 'wsl' && stdOutput) || (prerequisite.id === 'wslUbuntu' && stdOutput.includes(': Ubuntu')) || + (prerequisite.id === 'wslUbuntuStore' && stdOutput) || ((prerequisite.id === 'dockerDesktop' || prerequisite.id === 'dockerDesktopUbuntu') && stdOutput.includes('Server: Docker Desktop')) ) { diff --git a/src/renderer/components/Config/PrereqsView.tsx b/src/renderer/components/Config/PrereqsView.tsx index 4630f6bc..7f51716f 100644 --- a/src/renderer/components/Config/PrereqsView.tsx +++ b/src/renderer/components/Config/PrereqsView.tsx @@ -52,7 +52,7 @@ const PrereqsView = ({ sx }: Props) => { status.description = ( - Make sure WSL is installed and Ubuntu is selected as the default distribution.{' '} + Make sure WSL is installed and Ubuntu is selected as default distribution.{' '} Install WSL @@ -63,30 +63,27 @@ const PrereqsView = ({ sx }: Props) => {

- To ensure 'Ubuntu' is set as the default WSL distribution, you can check your default distribution by - running the following command in PowerShell/CMD: + To ensure 'Ubuntu' is set as default WSL distribution. You can check your default distribution by + running following command in Powershell/CMD:
- wsl --list --quiet + wsl -l

- Afterwards, if Ubuntu is not selected as the default, you can set it as the default by running the - following command: + Afterwards, if Ubuntu is not selected as default, then you can do so by running following command:
- wsl --set-default Ubuntu + wsl -s Ubuntu - )} + )}{' '} {status.id === 'wslUbuntuStore' && ( <>

- To install the Ubuntu distribution from the Windows Store, you can run the following command: + To install the Ubuntu distribution from the Windows Store, you can refer to docs above -
- wsl --install -d Ubuntu-20.04 )}