diff options
| author | srdusr <trevorgray@srdusr.com> | 2024-05-30 02:00:38 +0200 |
|---|---|---|
| committer | srdusr <trevorgray@srdusr.com> | 2024-05-30 02:00:38 +0200 |
| commit | 8dfa58d46e9f7b8c31398f5b73ad8fb506f85eed (patch) | |
| tree | 6704fd0b008501e4391a508c9ef6d99cc5a5b24e /.config/powershell/bootstrap.ps1 | |
| parent | 78c0fca00bad7e02699e39434c6243f6b2809c74 (diff) | |
| download | dotfiles-8dfa58d46e9f7b8c31398f5b73ad8fb506f85eed.tar.gz dotfiles-8dfa58d46e9f7b8c31398f5b73ad8fb506f85eed.zip | |
Testing
Diffstat (limited to '.config/powershell/bootstrap.ps1')
| -rw-r--r-- | .config/powershell/bootstrap.ps1 | 65 |
1 files changed, 42 insertions, 23 deletions
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 |
