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 ($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);
|
||||||
Install-ChocoPackage winfsp qemu-guest-agent;
|
|
||||||
Get-Service VirtioFsSvc | Start-Service -PassThru | Set-Service -StartupType Automatic;
|
|
||||||
|
|
||||||
while (-not (Test-Path Z:\)) {
|
Set-SetupOption $liveScriptOption $result;
|
||||||
Start-Sleep 0.1;
|
|
||||||
|
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