Ask for live scripts only once
This commit is contained in:
parent
a7b40d2376
commit
c6d261bc89
1 changed files with 28 additions and 23 deletions
|
@ -104,36 +104,41 @@ $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)) {
|
||||
Install-ChocoPackage winfsp qemu-guest-agent;
|
||||
Get-Service VirtioFsSvc | Start-Service -PassThru | Set-Service -StartupType Automatic;
|
||||
0);
|
||||
|
||||
while (-not (Test-Path Z:\)) {
|
||||
Start-Sleep 0.1;
|
||||
Set-SetupOption $liveScriptOption $result;
|
||||
|
||||
if ($result -eq 1) {
|
||||
Install-ChocoPackage winfsp qemu-guest-agent;
|
||||
Get-Service VirtioFsSvc | Start-Service -PassThru | Set-Service -StartupType Automatic;
|
||||
|
||||
while (-not (Test-Path Z:\)) {
|
||||
Start-Sleep 0.1;
|
||||
}
|
||||
|
||||
foreach ($name in @("CONFIG_MODULE", "INSTALLER_SCRIPT")) {
|
||||
$variable = Get-Item "Env:\$name";
|
||||
|
||||
$path = Join-Path `
|
||||
"Z:\Repositories\PortValhalla" `
|
||||
([System.IO.Path]::GetRelativePath("$PSScriptRoot/../../..", $variable.Value));
|
||||
|
||||
Set-Item "Env:\$name" $path;
|
||||
Write-Host "The new value of ``$name`` is ``$path``";
|
||||
}
|
||||
|
||||
Restart-Intermediate;
|
||||
exit;
|
||||
}
|
||||
|
||||
foreach ($name in @("CONFIG_MODULE", "INSTALLER_SCRIPT")) {
|
||||
$variable = Get-Item "Env:\$name";
|
||||
|
||||
$path = Join-Path `
|
||||
"Z:\Repositories\PortValhalla" `
|
||||
([System.IO.Path]::GetRelativePath("$PSScriptRoot/../../..", $variable.Value));
|
||||
|
||||
Set-Item "Env:\$name" $path;
|
||||
Write-Host "The new value of ``$name`` is ``$path``";
|
||||
}
|
||||
|
||||
Restart-Intermediate;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue