diff options
Diffstat (limited to 'windows')
| -rw-r--r-- | windows/D-Drive/.gitkeep | 0 | ||||
| -rw-r--r-- | windows/ProgramData/.gitkeep | 0 | ||||
| -rw-r--r-- | windows/System32/.gitkeep | 0 | ||||
| -rw-r--r-- | windows/Users/AppData/windows-terminal/settings.json (renamed from windows/AppData/windows-terminal/settings.json) | 0 | ||||
| -rw-r--r-- | windows/Users/Documents/PowerShell/Microsoft.PowerShell_profile.ps1 (renamed from windows/Documents/PowerShell/Microsoft.PowerShell_profile.ps1) | 0 | ||||
| -rw-r--r-- | windows/Users/Documents/PowerShell/bloatware.ps1 (renamed from windows/Documents/PowerShell/bloatware.ps1) | 12 | ||||
| -rw-r--r-- | windows/Users/Documents/PowerShell/bootstrap.ps1 (renamed from windows/Documents/PowerShell/bootstrap.ps1) | 64 | ||||
| -rw-r--r-- | windows/Users/Documents/PowerShell/initialize.ps1 (renamed from windows/Documents/PowerShell/initialize.ps1) | 0 | ||||
| -rw-r--r-- | windows/Users/install.bat (renamed from windows/install.bat) | 0 |
9 files changed, 30 insertions, 46 deletions
diff --git a/windows/D-Drive/.gitkeep b/windows/D-Drive/.gitkeep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/windows/D-Drive/.gitkeep diff --git a/windows/ProgramData/.gitkeep b/windows/ProgramData/.gitkeep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/windows/ProgramData/.gitkeep diff --git a/windows/System32/.gitkeep b/windows/System32/.gitkeep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/windows/System32/.gitkeep diff --git a/windows/AppData/windows-terminal/settings.json b/windows/Users/AppData/windows-terminal/settings.json index 71bf5bd..71bf5bd 100644 --- a/windows/AppData/windows-terminal/settings.json +++ b/windows/Users/AppData/windows-terminal/settings.json diff --git a/windows/Documents/PowerShell/Microsoft.PowerShell_profile.ps1 b/windows/Users/Documents/PowerShell/Microsoft.PowerShell_profile.ps1 index 40b5879..40b5879 100644 --- a/windows/Documents/PowerShell/Microsoft.PowerShell_profile.ps1 +++ b/windows/Users/Documents/PowerShell/Microsoft.PowerShell_profile.ps1 diff --git a/windows/Documents/PowerShell/bloatware.ps1 b/windows/Users/Documents/PowerShell/bloatware.ps1 index 2ee078a..ffee6d5 100644 --- a/windows/Documents/PowerShell/bloatware.ps1 +++ b/windows/Users/Documents/PowerShell/bloatware.ps1 @@ -10,8 +10,16 @@ if (-not (Get-Module powershell-yaml -ListAvailable)) { Import-Module powershell-yaml -# Define the path to the YAML file -$yamlFilePath = "$HOME\packages.yml" +# Locate packages.yml from common locations +$candidates = @( + Join-Path $HOME ".cfg/common/packages.yml", + Join-Path $HOME "packages.yml", + Join-Path $HOME "common/packages.yml", + Join-Path $HOME "dot_setup/packages.yml" +) +$yamlFilePath = $null +foreach ($pf in $candidates) { if (Test-Path $pf) { $yamlFilePath = $pf; break } } +if (-not $yamlFilePath) { throw "packages.yml not found in expected locations: $($candidates -join ', ')" } # Parse the YAML file $packages = ConvertFrom-Yaml -Path $yamlFilePath diff --git a/windows/Documents/PowerShell/bootstrap.ps1 b/windows/Users/Documents/PowerShell/bootstrap.ps1 index d2f4369..aa3bd5b 100644 --- a/windows/Documents/PowerShell/bootstrap.ps1 +++ b/windows/Users/Documents/PowerShell/bootstrap.ps1 @@ -219,52 +219,21 @@ function Install-Packages { return } - # Get packages for current profile and OS - $profilePackages = @() + # Install profile-specific Windows packages (profiles.<profile>.windows) if ($packages.profiles.$Profile.windows) { - $profilePackages += $packages.profiles.$Profile.windows - } - if ($packages.profiles.$Profile.common) { - $profilePackages += $packages.profiles.$Profile.common - } - - foreach ($package in $profilePackages) { - $packageName = if ($packages.packages.$package.windows) { - $packages.packages.$package.windows - } else { - $package - } - - if (Test-PackageInstalled -Manager $packageManager -Name $packageName) { - Write-Info "Already installed: $packageName" - continue - } - - Write-Info "Installing package: $packageName" - - switch ($packageManager) { - "chocolatey" { - if (-not (choco list --local-only | Select-String -Pattern "^$packageName\s")) { - choco install $packageName -y - if ($LASTEXITCODE -eq 0) { - Write-Success "Installed: $packageName" - } else { - Write-Error "Failed to install: $packageName" - } - } else { - Write-Info "Already installed: $packageName" - } - } - "winget" { - winget install $packageName --accept-package-agreements --accept-source-agreements - } - "scoop" { - scoop install $packageName + foreach ($pkg in $packages.profiles.$Profile.windows) { + if ([string]::IsNullOrWhiteSpace($pkg)) { continue } + if (Test-PackageInstalled -Manager $packageManager -Name $pkg) { Write-Info "Already installed: $pkg"; continue } + Write-Info "Installing package: $pkg" + switch ($packageManager) { + "chocolatey" { if (-not (choco list --local-only | Select-String -Pattern "^$([regex]::Escape($pkg))\s")) { choco install $pkg -y } } + "winget" { winget install --id $pkg --silent --accept-package-agreements --accept-source-agreements } + "scoop" { scoop install $pkg } } } } - # Also install top-level Windows packages list if present + # Install top-level Windows packages list if present if ($packages.windows) { foreach ($pkg in $packages.windows) { if ([string]::IsNullOrWhiteSpace($pkg)) { continue } @@ -361,10 +330,17 @@ function Deploy-Dotfiles { function Get-ProfilePackagesFile { param([string]$Profile) $candidates = @( + # Profile-specific overrides Join-Path $HOME ".cfg/profile/$Profile/packages.yml", Join-Path $HOME "profile/$Profile/packages.yml", Join-Path $HOME "dot_setup/profile/$Profile/packages.yml", - Join-Path $Script:Config.DotfilesDir "common/$($Script:Config.PackagesFile)" + # Common locations for the primary packages.yml + Join-Path $HOME ".cfg/common/$($Script:Config.PackagesFile)", + Join-Path $HOME "$($Script:Config.PackagesFile)", + Join-Path $HOME "common/$($Script:Config.PackagesFile)", + Join-Path $HOME "dot_setup/packages.yml", + Join-Path $Script:Config.DotfilesDir "common/$($Script:Config.PackagesFile)", + Join-Path $Script:Config.DotfilesDir "packages.yml" ) foreach ($pf in $candidates) { if (Test-Path $pf) { return $pf } @@ -602,14 +578,14 @@ function Start-Bootstrap { # Configure Windows if (Prompt-YesNo -Question "Apply Windows configuration from packages.yml?" -Default 'N') { - Set-WindowsConfiguration -PackagesFile $packagesPath + Set-WindowsConfiguration -PackagesFile $packagesFile } else { Write-Warning "Skipped Windows configuration by user choice" } # Enable Windows features (if admin) if (Prompt-YesNo -Question "Enable Windows optional features?" -Default 'N') { - Enable-WindowsFeatures -PackagesFile $packagesPath + Enable-WindowsFeatures -PackagesFile $packagesFile } else { Write-Warning "Skipped enabling Windows features by user choice" } diff --git a/windows/Documents/PowerShell/initialize.ps1 b/windows/Users/Documents/PowerShell/initialize.ps1 index 72f0ea4..72f0ea4 100644 --- a/windows/Documents/PowerShell/initialize.ps1 +++ b/windows/Users/Documents/PowerShell/initialize.ps1 diff --git a/windows/install.bat b/windows/Users/install.bat index 89b3ac6..89b3ac6 100644 --- a/windows/install.bat +++ b/windows/Users/install.bat |
