Make nix config accessible in scripts
This commit is contained in:
parent
d9e32dd7cb
commit
40b0bafcac
|
@ -1,5 +1,6 @@
|
||||||
#!/bin/pwsh
|
#!/bin/pwsh
|
||||||
$env:WIN_COMPUTER_NAME ??= "win11";
|
$env:WIN_COMPUTER_NAME ??= "win11";
|
||||||
$env:SETUP_SCRIPT_NAME ??= "$PSScriptRoot/Install.ps1";
|
$env:SETUP_SCRIPT_NAME ??= "$PSScriptRoot/Install.ps1";
|
||||||
|
$env:CONFIG_MODULE ??= "$PSScriptRoot/../config.nix";
|
||||||
|
|
||||||
. "$PSScriptRoot/../../../scripts/Windows/OS/Setup.ps1";
|
. "$PSScriptRoot/../../../scripts/Windows/OS/Setup.ps1";
|
||||||
|
|
|
@ -3,6 +3,9 @@ $Global:InformationPreference = "Continue";
|
||||||
$Global:ErrorActionPreference = "Inquire";
|
$Global:ErrorActionPreference = "Inquire";
|
||||||
$null = $env:WIN_COMPUTER_NAME;
|
$null = $env:WIN_COMPUTER_NAME;
|
||||||
$null = $env:SETUP_SCRIPT_NAME;
|
$null = $env:SETUP_SCRIPT_NAME;
|
||||||
|
$null = $env:CONFIG_MODULE;
|
||||||
|
|
||||||
|
$config = ConvertFrom-Json (Get-Content "$env:CONFIG_MODULE.json");
|
||||||
|
|
||||||
[xml]$unattendedConfig = [xml]::new();
|
[xml]$unattendedConfig = [xml]::new();
|
||||||
$unattendedConfig.PreserveWhitespace = $true;
|
$unattendedConfig.PreserveWhitespace = $true;
|
||||||
|
@ -51,6 +54,7 @@ function Get-ScriptPathInjection($path) {
|
||||||
$newCommand.SelectSingleNode("./ua:CommandLine", $namespace).InnerText = `
|
$newCommand.SelectSingleNode("./ua:CommandLine", $namespace).InnerText = `
|
||||||
"powershell -Command " + `
|
"powershell -Command " + `
|
||||||
"`$env:INSTALLER_SCRIPT = $(Get-ScriptPathInjection $env:SETUP_SCRIPT_NAME);" + `
|
"`$env:INSTALLER_SCRIPT = $(Get-ScriptPathInjection $env:SETUP_SCRIPT_NAME);" + `
|
||||||
|
"`$env:CONFIG_MODULE = $(Get-ScriptPathInjection $env:CONFIG_MODULE);" + `
|
||||||
"Invoke-Expression $(Get-ScriptPathInjection "$PSScriptRoot/InitialBoot.ps1");";
|
"Invoke-Expression $(Get-ScriptPathInjection "$PSScriptRoot/InitialBoot.ps1");";
|
||||||
|
|
||||||
$orderElement = $newCommand.SelectSingleNode("./ua:Order", $namespace);
|
$orderElement = $newCommand.SelectSingleNode("./ua:Order", $namespace);
|
||||||
|
|
Loading…
Reference in a new issue