Add function for generating startup command

This commit is contained in:
Manuel Thalmann 2024-08-21 18:26:58 +02:00
parent bd9234e3bb
commit 43a9d867bb

View file

@ -43,15 +43,14 @@ $null = New-Module {
Generates a script for executing the installer. Generates a script for executing the installer.
#> #>
function Get-StartupScript { function Get-StartupScript {
"pwsh " + (Get-StartupArguments); "pwsh -Command " + (Get-StartupCommand);
} }
<# <#
.SYNOPSIS .SYNOPSIS
Generates arguments for running the installer using `pwsh`. Generates a command for running the installer using `pwsh`.
#> #>
function Get-StartupArguments { function Get-StartupCommand {
"-Command " +
($env:PWSH_PATH ? "`$env:PWSH_PATH = $(ConvertTo-Injection $env:PWSH_PATH);" : "") + ($env:PWSH_PATH ? "`$env:PWSH_PATH = $(ConvertTo-Injection $env:PWSH_PATH);" : "") +
($env:DEBUG ? "`$env:DEBUG = $([int]$env:DEBUG);" : "") + ($env:DEBUG ? "`$env:DEBUG = $([int]$env:DEBUG);" : "") +
"`$env:INSTALLER_SCRIPT = $(ConvertTo-Injection (Resolve-Path $env:INSTALLER_SCRIPT));" + "`$env:INSTALLER_SCRIPT = $(ConvertTo-Injection (Resolve-Path $env:INSTALLER_SCRIPT));" +