From 4d4df6acc87e0f41d1bb2af73831d0d4b4b0714d Mon Sep 17 00:00:00 2001 From: SOSMLG <117748270+SOSMLG@users.noreply.github.com> Date: Mon, 23 Nov 2026 14:11:09 -0800 Subject: [PATCH] refactor: unify daily and IoT into one installer --- AGENTS.md | 2 +- Install.ps1 | 9 +--- Validate.ps1 | 4 +- docs/CLI.md | 4 +- scripts/Install.ps1 | 26 ++++++++++- .../modules/iot/IotMain.ps1 | 43 +------------------ 6 files changed, 33 insertions(+), 55 deletions(-) rename install-Win-Iot.ps1 => scripts/modules/iot/IotMain.ps1 (84%) diff --git a/AGENTS.md b/AGENTS.md index 4defdb8..f7b8de4 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -5,7 +5,7 @@ One Windows setup repo with two profiles: - `daily`: `scripts/Install.ps1`, modular, engineering workstation. -- `iot`: `install-Win-Iot.ps1`, slim Win10/Win11 IoT LTSC build. +- `iot`: `scripts/modules/iot/`, slim Win10/Win11 IoT LTSC build. `Install.ps1` and `Validate.ps1` are the front doors. `config/` is the only config tree. Docs live in `docs/`. Ventoy answer files live in `ventoy/script/`. diff --git a/Install.ps1 b/Install.ps1 index 41114e7..3e28d13 100644 --- a/Install.ps1 +++ b/Install.ps1 @@ -44,18 +44,13 @@ if ($Status -and $Profile -ne 'daily') { throw '-Status is only available for the daily profile.' } -if ($Profile -eq 'iot') { - $entry = Join-Path $root 'install-Win-Iot.ps1' -} -else { - $entry = Join-Path $root 'scripts\Install.ps1' -} +$entry = Join-Path $root 'scripts\Install.ps1' if (-not (Test-Path -LiteralPath $entry)) { throw "Missing profile entry point: $entry" } -$arguments = @() +$arguments = @('-Profile', $Profile) if ($DryRun) { $arguments += '-DryRun' } if ($Force) { $arguments += '-Force' } if ($Only.Count -gt 0) { $arguments += @('-Only', ($Only -join ',')) } diff --git a/Validate.ps1 b/Validate.ps1 index 057cdc1..5712e11 100644 --- a/Validate.ps1 +++ b/Validate.ps1 @@ -5,7 +5,7 @@ .DESCRIPTION -Profile daily calls scripts/Validate.ps1 and is the default. - -Profile iot calls install-Win-Iot.ps1 -Verify. + -Profile iot calls scripts/Install.ps1 -Profile iot -Verify. Neither path writes settings. #> [CmdletBinding()] @@ -18,7 +18,7 @@ $ErrorActionPreference = 'Stop' $root = Split-Path -Parent $MyInvocation.MyCommand.Path if ($Profile -eq 'iot') { - & powershell -NoProfile -ExecutionPolicy Bypass -File (Join-Path $root 'install-Win-Iot.ps1') -Verify + & powershell -NoProfile -ExecutionPolicy Bypass -File (Join-Path $root 'scripts\Install.ps1') -Profile iot -Verify } else { & powershell -NoProfile -ExecutionPolicy Bypass -File (Join-Path $root 'scripts\Validate.ps1') diff --git a/docs/CLI.md b/docs/CLI.md index e6bda80..ce39a02 100644 --- a/docs/CLI.md +++ b/docs/CLI.md @@ -6,12 +6,12 @@ to the profile script unchanged. | command | profile | target | | --- | --- | --- | | `Install.ps1 -Profile daily` | daily | `scripts/Install.ps1` | -| `Install.ps1 -Profile iot` | iot | `install-Win-Iot.ps1` | +| `Install.ps1 -Profile iot` | iot | `scripts/Install.ps1 -Profile iot` | | `Install.ps1 -Profile daily -Verify` | daily | `Validate.ps1 -Profile daily` | | `Install.ps1 -Profile iot -Verify` | iot | `Validate.ps1 -Profile iot` | | `Install.ps1 -Profile daily -Status` | daily | saved daily state only | | `Validate.ps1` | daily | `scripts/Validate.ps1` | -| `Validate.ps1 -Profile iot` | iot | `install-Win-Iot.ps1 -Verify` | +| `Validate.ps1 -Profile iot` | iot | `scripts/Install.ps1 -Profile iot -Verify` | `Install.ps1 -Verify` is an alias for the matching validator. Neither validation path writes settings, state, logs, transcripts, or reports. `Setup.cmd` always diff --git a/scripts/Install.ps1 b/scripts/Install.ps1 index 714f982..c03db14 100644 --- a/scripts/Install.ps1 +++ b/scripts/Install.ps1 @@ -40,6 +40,7 @@ #> [CmdletBinding()] param( + [ValidateSet('daily', 'iot')][string]$Profile = 'daily', [switch]$Status, [switch]$DryRun, [string[]]$Only = @(), @@ -49,7 +50,24 @@ param( [string]$GitName, [string]$GitEmail, [string]$TiaInstaller, - [string]$MatlabInstaller + [string]$MatlabInstaller, + [string]$StateDir = 'C:\Windows\Logs\Win-Iot-Setup\state', + [string]$BuildConfig = '', + [string]$Arch = '', + [switch]$DetectHardware, + [switch]$Minimal, + [switch]$Unattended, + [switch]$NoWingetBootstrap, + [string]$OfflineDir = '', + [string]$LogDir = 'C:\Windows\Logs\Win-Iot-Setup', + [string]$DriverDir = '', + [switch]$ConfigsOnly, + [switch]$Reboot, + [switch]$Fixes, + [switch]$Verify, + [switch]$SkipHashVerify, + [switch]$Idempotent, + [string[]]$SkipApps = @() ) Set-StrictMode -Version Latest @@ -58,6 +76,12 @@ $ErrorActionPreference = 'Stop' $libPath = Join-Path $PSScriptRoot 'lib\Common.ps1' . $libPath +if ($Profile -eq 'iot') { + # IoT profile: run the modular IoT implementation from scripts/modules/iot. + . (Join-Path $PSScriptRoot 'modules\iot\IotMain.ps1') + exit 0 +} + if ($Status) { $statusState = Get-StackState $statusOrder = @('preflight', 'os', 'packages', 'apps', 'engineering', 'developer', 'omniroute', 'theme', 'configs', 'validate') diff --git a/install-Win-Iot.ps1 b/scripts/modules/iot/IotMain.ps1 similarity index 84% rename from install-Win-Iot.ps1 rename to scripts/modules/iot/IotMain.ps1 index 2de249c..1e70923 100644 --- a/install-Win-Iot.ps1 +++ b/scripts/modules/iot/IotMain.ps1 @@ -1,49 +1,8 @@ -<# -.SYNOPSIS - My Win10/Win11 IoT (Enterprise) LTSC setup. Unattended, rerunnable. -.DESCRIPTION - Built for a tiny10 box with no store and usually no network - on first boot. PS 5.1, stock Windows desktop, LibreWolf, VSCodium. - No extra shell, no extra window manager. Stock colors everywhere. - Engines per app, first hit wins: staged -OfflineDir files, winget, - github releases, direct vendor URLs. Log lands in C:\Windows\Logs\Win-Iot-Setup - either way. -.EXAMPLE - powershell -ExecutionPolicy Bypass -File install-Win-Iot.ps1 - powershell -ExecutionPolicy Bypass -File install-Win-Iot.ps1 -Unattended -OfflineDir D:\Offline - powershell -ExecutionPolicy Bypass -File install-Win-Iot.ps1 -Unattended -DriverDir D:\Drivers -Reboot - powershell -ExecutionPolicy Bypass -File install-Win-Iot.ps1 -Minimal -Unattended - powershell -ExecutionPolicy Bypass -File install-Win-Iot.ps1 -ConfigsOnly - (configs-only: re-copy user configs to their real locations, nothing else.) -#> -[CmdletBinding()] -param( - [switch]$SkipHashVerify, - [switch]$Idempotent, - [switch]$Force, - [string]$StateDir = 'C:\Windows\Logs\Win-Iot-Setup\state', - [string]$BuildConfig = '', - [string]$Arch = '', - [switch]$DetectHardware, - [switch]$Minimal, - [switch]$Unattended, - [switch]$NoWingetBootstrap, - [string]$OfflineDir = '', - [string]$LogDir = 'C:\Windows\Logs\Win-Iot-Setup', - [string]$DriverDir = '', - [switch]$ConfigsOnly, - [switch]$Reboot, - [switch]$Fixes, - [switch]$DryRun, - [switch]$Verify, - [string[]]$Only = @(), - [string[]]$SkipApps = @() -) $ErrorActionPreference = 'Continue' Set-StrictMode -Version 2 [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 -$Repo = Split-Path $MyInvocation.MyCommand.Path -Parent +$Repo = $script:RepoRoot # -ConfigsOnly re-deploys user configs (VSCodium, Vesktop, qBittorrent, opencode, # terminal, ...) and nothing else. install phases are gated below. # log, state, and transcript start after -Verify, so the read-only path writes nothing.