Ask for live scripts only once

This commit is contained in:
Manuel Thalmann 2024-09-03 12:08:35 +02:00
parent a7b40d2376
commit c6d261bc89

View file

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