diff options
| author | srdusr <trevorgray@srdusr.com> | 2024-06-13 00:54:51 +0200 |
|---|---|---|
| committer | srdusr <trevorgray@srdusr.com> | 2024-06-13 00:54:51 +0200 |
| commit | 4ccbe0270c25ecab492508b5b0209ae53b9c35bd (patch) | |
| tree | bdb141f22716abab6c668dc309f34838c216174b /.config/powershell | |
| parent | 68b6f7c08f07612010c3435894e5554b0492e498 (diff) | |
| download | dotfiles-4ccbe0270c25ecab492508b5b0209ae53b9c35bd.tar.gz dotfiles-4ccbe0270c25ecab492508b5b0209ae53b9c35bd.zip | |
Testing
Diffstat (limited to '.config/powershell')
| -rw-r--r-- | .config/powershell/bloatware.ps1 | 10 | ||||
| -rw-r--r-- | .config/powershell/bootstrap.ps1 | 12 |
2 files changed, 21 insertions, 1 deletions
diff --git a/.config/powershell/bloatware.ps1 b/.config/powershell/bloatware.ps1 index 369079d..2c8dacb 100644 --- a/.config/powershell/bloatware.ps1 +++ b/.config/powershell/bloatware.ps1 @@ -1,5 +1,15 @@ # bloatware.ps1 +# Check if the powershell-yaml module is installed, if not, install it +if (-not (Get-Module powershell-yaml -ListAvailable)) { + $policy = Get-PSRepository -Name 'PSGallery' | Select-Object -ExpandProperty InstallationPolicy + Set-PSRepository -Name 'PSGallery' -InstallationPolicy Trusted + Install-Module powershell-yaml + Set-PSRepository -Name 'PSGallery' -InstallationPolicy $policy +} + +Import-Module powershell-yaml + # Define the path to the YAML file $yamlFilePath = "$HOME\packages.yml" diff --git a/.config/powershell/bootstrap.ps1 b/.config/powershell/bootstrap.ps1 index 3d95afa..71d971f 100644 --- a/.config/powershell/bootstrap.ps1 +++ b/.config/powershell/bootstrap.ps1 @@ -45,7 +45,7 @@ Write-Host "Configuring PowerShell" Write-Host "----------------------------------------" # Get the "MyDocuments" path for the current user, excluding OneDrive -$UserMyDocumentsPath = [System.Environment]::GetFolderPath('MyDocuments').Replace("OneDrive", "") + "\Documents" +$UserMyDocumentsPath = [System.Environment]::GetFolderPath('MyDocuments').Replace("OneDrive", "") $PowerShellProfileDirectory = "$UserMyDocumentsPath\PowerShell" $PowerShellLegacySymlink = "$UserMyDocumentsPath\WindowsPowerShell" @@ -100,6 +100,16 @@ if (-not (Get-Command choco -ErrorAction SilentlyContinue)) { Write-Host "Installing Applications" Write-Host "----------------------------------------" +# Check if the powershell-yaml module is installed, if not, install it +if (-not (Get-Module powershell-yaml -ListAvailable)) { + $policy = Get-PSRepository -Name 'PSGallery' | Select-Object -ExpandProperty InstallationPolicy + Set-PSRepository -Name 'PSGallery' -InstallationPolicy Trusted + Install-Module powershell-yaml + Set-PSRepository -Name 'PSGallery' -InstallationPolicy $policy +} + +Import-Module powershell-yaml + # Load packages.yml $packagesFile = "$HOME\packages.yml" $packages = Get-Content $packagesFile | ConvertFrom-Yaml |
