Ask for live scripts only once

This commit is contained in:
Manuel Thalmann 2024-09-03 12:08:35 +02:00
parent 86a3f87f70
commit cb3e16005d

View file

@ -104,16 +104,20 @@ $null = New-Module {
} }
if ($env:DEBUG) { if ($env:DEBUG) {
if ( $liveScriptOption = "LiveScripts";
(Get-Item $env:INSTALLER_SCRIPT).IsReadOnly -and
(Test-Qemu) -and if (($null -eq (Get-SetupOption $liveScriptOption)) -and (Test-Qemu)) {
($Host.UI.PromptForChoice( $result = $Host.UI.PromptForChoice(
"Confirm", "Confirm",
"Do you wish to swap to live scripts?", "Do you wish to swap to live scripts?",
[ChoiceDescription[]]@( [ChoiceDescription[]]@(
[ChoiceDescription]::new("&No", "Use scripts stored in the virtual machine"), [ChoiceDescription]::new("&No", "Use scripts stored in the virtual machine"),
[ChoiceDescription]::new("&Yes", "Use live scripts stored on the host")), [ChoiceDescription]::new("&Yes", "Use live scripts stored on the host")),
0) -eq 1)) { 0);
Set-SetupOption $liveScriptOption $result;
if ($result -eq 1) {
Install-ChocoPackage winfsp qemu-guest-agent; Install-ChocoPackage winfsp qemu-guest-agent;
Get-Service VirtioFsSvc | Start-Service -PassThru | Set-Service -StartupType Automatic; Get-Service VirtioFsSvc | Start-Service -PassThru | Set-Service -StartupType Automatic;
@ -136,6 +140,7 @@ $null = New-Module {
exit; exit;
} }
} }
}
if (-not (Test-Command "gsudo")) { if (-not (Test-Command "gsudo")) {
Install-ChocoPackage gsudo; Install-ChocoPackage gsudo;