Ensure the environment variables are always set properly

This commit is contained in:
Manuel Thalmann 2024-08-05 23:09:58 +02:00
parent d6b7adb505
commit ec5e4c6340
3 changed files with 65 additions and 52 deletions

View file

@ -1,6 +1,7 @@
#!/bin/pwsh #!/bin/pwsh
. "$PSScriptRoot/../../../scripts/Windows/Scripts/Prerequisites.ps1"; . "$PSScriptRoot/../../../scripts/Windows/Scripts/Prerequisites.ps1";
. "$PSScriptRoot/../Scripts/Context.ps1"; . "$PSScriptRoot/../Scripts/Context.ps1";
. "$PSScriptRoot/../Scripts/Operations.ps1";
. "$PSScriptRoot/../Software/Firefox/Install.ps1"; . "$PSScriptRoot/../Software/Firefox/Install.ps1";
. "$PSScriptRoot/Manage.ps1"; . "$PSScriptRoot/Manage.ps1";
. "$PSScriptRoot/User/Install.ps1"; . "$PSScriptRoot/User/Install.ps1";
@ -17,14 +18,9 @@ $null = New-Module {
Finishes the installation of a running Windows machine. Finishes the installation of a running Windows machine.
#> #>
function Start-WindowsInstallation { function Start-WindowsInstallation {
$ErrorActionPreference = 'Inquire'; Start-Operation {
$env:WSLENV = "CONFIG_MODULE/p";
if ($env:CONFIG_MODULE) {
$env:CONFIG_MODULE = Resolve-Path $env:CONFIG_MODULE;
}
Start-InstallationLoop; Start-InstallationLoop;
};
} }
<# <#

View file

@ -0,0 +1,14 @@
function Start-Operation {
param(
[scriptblock] $Action
)
$ErrorActionPreference = 'Inquire';
$env:WSLENV = "CONFIG_MODULE/p";
if ($env:CONFIG_MODULE) {
$env:CONFIG_MODULE = Resolve-Path $env:CONFIG_MODULE;
}
& $Action;
}

View file

@ -1,4 +1,5 @@
. "$PSScriptRoot/Config.ps1"; . "$PSScriptRoot/Config.ps1";
. "$PSScriptRoot/Operations.ps1";
. "$PSScriptRoot/../Types/InstallerAction.ps1"; . "$PSScriptRoot/../Types/InstallerAction.ps1";
$null = New-Module { $null = New-Module {
@ -15,6 +16,7 @@ $null = New-Module {
[hashtable] $Arguments [hashtable] $Arguments
) )
Start-Operation {
if (-not $Name) { if (-not $Name) {
$Name = Split-Path -Leaf (Split-Path -Parent ((Get-PSCallStack)[1].ScriptName)); $Name = Split-Path -Leaf (Split-Path -Parent ((Get-PSCallStack)[1].ScriptName));
} }
@ -61,5 +63,6 @@ $null = New-Module {
}; };
& $installHandler -Action $Action -Arguments $Arguments; & $installHandler -Action $Action -Arguments $Arguments;
};
} }
} }