From 8dfa58d46e9f7b8c31398f5b73ad8fb506f85eed Mon Sep 17 00:00:00 2001 From: srdusr Date: Thu, 30 May 2024 02:00:38 +0200 Subject: Testing --- .config/powershell/bootstrap.ps1 | 65 ++++++++++++++++++++++++++-------------- 1 file changed, 42 insertions(+), 23 deletions(-) (limited to '.config/powershell/bootstrap.ps1') diff --git a/.config/powershell/bootstrap.ps1 b/.config/powershell/bootstrap.ps1 index 3fd5d8b..b90386a 100644 --- a/.config/powershell/bootstrap.ps1 +++ b/.config/powershell/bootstrap.ps1 @@ -302,29 +302,6 @@ if (!(Test-Path -Path "$home\.config\powershell\Microsoft.PowerShell_profile.ps1 handle_error "PowerShell profile does not exist. Please create it at $home\.config\powershell\Microsoft.PowerShell_profile.ps1" } -# Install Chocolatey -Write-Host "Installing Chocolatey" -Write-Host "----------------------------------------" -Set-ExecutionPolicy Bypass -Scope Process -Force -[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072 -Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) - -# Check if Chocolatey installed successfully -if (-not (Get-Command choco -ErrorAction SilentlyContinue)) { - handle_error "Chocolatey installation failed." -} - -# Install Applications -Write-Host "Installing Applications" -Write-Host "----------------------------------------" -$apps = @("ripgrep", "fd", "sudo", "win32yank", "neovim", "microsoft-windows-terminal") -foreach ($app in $apps) { - choco install $app -y - if ($LASTEXITCODE -ne 0) { - handle_error "Installation of $app failed." - } -} - # Define the `config` alias in the current session function global:config { git --git-dir="$env:USERPROFILE\.cfg" --work-tree="$env:USERPROFILE" $args @@ -384,6 +361,48 @@ function install_dotfiles { install_dotfiles +. $PROFILE + +# Install Chocolatey if not installed +Write-Host "Installing Chocolatey" +Write-Host "----------------------------------------" + +Set-ExecutionPolicy Bypass -Scope Process -Force + +if (-not (Get-Command choco -ErrorAction SilentlyContinue)) { + [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072 + Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) + + # Check if Chocolatey installed successfully + if (-not (Get-Command choco -ErrorAction SilentlyContinue)) { + handle_error "Chocolatey installation failed." + } +} else { + Write-Host "Chocolatey is already installed." +} + +# Install Applications +Write-Host "Installing Applications" +Write-Host "----------------------------------------" + +# Define the list of applications to install +$apps = @("ripgrep", "fd", "sudo", "win32yank", "neovim", "microsoft-windows-terminal") + +foreach ($app in $apps) { + # Check if the application is already installed + if (-not (choco list --local-only | Select-String -Pattern "^$app\s")) { + Write-Host "Installing $app" + choco install $app -y + + if ($LASTEXITCODE -ne 0) { + handle_error "Installation of $app failed." + } else { + Write-Host "$app installed successfully." + } + } else { + Write-Host "$app is already installed." + } +} # WSL Write-Host "Configuring WSL" wsl --install -d Ubuntu -- cgit v1.2.3