PortValhalla/scripts/Windows/OS/Install.ps1

30 lines
983 B
PowerShell

#!/bin/pwsh
. "$PSScriptRoot/Drivers.ps1";
. "$PSScriptRoot/Manage.ps1";
. "$PSScriptRoot/Upgrade.ps1";
. "$PSScriptRoot/User.ps1";
. "$PSScriptRoot/../Scripts/Context.ps1";
function Invoke-WindowsInstallation([Context] $context)
{
Write-Host "Starting Installation and Restoration of Windows";
. "$PSScriptRoot/../Scripts/Prerequisites.ps1";
Update-WindowsInstallation $context;
if (-not $context.Get("DriversInstalled")) {
Write-Host "Installing Drivers";
Write-Information "Looking for driver installation function";
if ((Get-Command Install-PortValhallaDrivers -ErrorAction SilentlyContinue)) {
Write-Information "Driver installation function was found. Starting installation";
Install-PortValhallaDrivers $context;
}
Write-Information "Finished installing drivers";
$context.Set("DriversInstalled", 1);
}
New-PersonalUser $context;
Restore-WindowsInstallation $context;
}