From fc9ca34f51ac5e30c80c539c78dd543a1c2b7612 Mon Sep 17 00:00:00 2001 From: Ashraf wan <73482535+Ashraf-wan@users.noreply.github.com> Date: Sat, 11 Nov 2023 01:50:39 +0800 Subject: [PATCH] check if choco is installed --- installer/windows.ps1 | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/installer/windows.ps1 b/installer/windows.ps1 index 02205fc..619b705 100755 --- a/installer/windows.ps1 +++ b/installer/windows.ps1 @@ -1,8 +1,12 @@ -# Installing chocolatey +# check if chocolatey is installed Set-ExecutionPolicy AllSigned -Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) -$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User") - +if (Get-Command choco -ErrorAction SilentlyContinue) { + Write-Host "Chocolatey is already installed." +} else { + Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) + $env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User") + Write-Host "Chocolatey has been installed." +} function pack_manager_install([string]$PACK_NAME, [string]$APP_NAME) { # Checking is package installed or not.