From 05201f1108f11db03cc9bd9ae6048ace1de6af95 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Thu, 1 Aug 2024 16:32:03 +0200 Subject: [PATCH] Configure clock for dualboot systems --- scripts/Windows/OS/Install.ps1 | 18 ++++++++++++++++++ scripts/Windows/Scripts/Config.ps1 | 3 +++ 2 files changed, 21 insertions(+) diff --git a/scripts/Windows/OS/Install.ps1 b/scripts/Windows/OS/Install.ps1 index 10182eaf..7576cf2e 100644 --- a/scripts/Windows/OS/Install.ps1 +++ b/scripts/Windows/OS/Install.ps1 @@ -85,7 +85,25 @@ function Start-InstallationLoop { } switch (Get-Stage) { + ([SetupStage]::Configure) { + if (Get-Config "valhalla.windows.dualboot.enable") { + # Fix synchronization between Linux and Windows clocks. + Set-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\TimeZoneInformation" -Name "RealTimeIsUniversal" -Value 1 -Type "DWord"; + + # Force time resynchronization + $service = Get-Service W32Time; + $stopped = ($service.Status -eq "Stopped"); + Start-Service $service; + w32tm /resync /force; + + if ($stopped) { + Stop-Service $service; + } + } + } ([SetupStage]::Install) { + Write-Host "Entering install phase"; + Set-IsFinished $true; } Default {} } diff --git a/scripts/Windows/Scripts/Config.ps1 b/scripts/Windows/Scripts/Config.ps1 index a4bcf477..311b13b7 100644 --- a/scripts/Windows/Scripts/Config.ps1 +++ b/scripts/Windows/Scripts/Config.ps1 @@ -4,6 +4,7 @@ using namespace System.Security.Principal; enum SetupStage { Initialize + Configure Install } @@ -171,6 +172,8 @@ $null = New-Module { param( $Value ) + + Set-SetupOption $finishedOption $true; } <#