Compare commits
7 commits
8a41a75527
...
4e62179e74
Author | SHA1 | Date | |
---|---|---|---|
Manuel Thalmann | 4e62179e74 | ||
Manuel Thalmann | 8624596e2e | ||
Manuel Thalmann | 8f8f455e84 | ||
Manuel Thalmann | 17237a0d67 | ||
Manuel Thalmann | a584d864af | ||
Manuel Thalmann | a39174fe48 | ||
Manuel Thalmann | 4d3dd0ba33 |
|
@ -1,9 +1,9 @@
|
|||
#!/bin/pwsh
|
||||
. "$PSScriptRoot/../../../scripts/Windows/Scripts/Prerequisites.ps1";
|
||||
. "$PSScriptRoot/../Scripts/Choco.ps1";
|
||||
. "$PSScriptRoot/../Scripts/Config.ps1";
|
||||
. "$PSScriptRoot/../Scripts/Hooks.ps1";
|
||||
. "$PSScriptRoot/../Scripts/PowerManagement.ps1";
|
||||
. "$PSScriptRoot/../Scripts/SetupConfig.ps1";
|
||||
. "$PSScriptRoot/../Scripts/Update.ps1";
|
||||
. "$PSScriptRoot/../Scripts/Context.ps1";
|
||||
. "$PSScriptRoot/../Software/Firefox/Install.ps1";
|
||||
|
@ -35,6 +35,8 @@ function Start-InstallationLoop {
|
|||
Import-Module $env:ChocolateyInstall/helpers/chocolateyProfile.psm1;
|
||||
refreshenv;
|
||||
};
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (-not (Test-ChocoSoftware "powershell-core")) {
|
||||
|
@ -53,8 +55,16 @@ function Start-InstallationLoop {
|
|||
if (Test-Path $env:PWSH_PATH) {
|
||||
attrib "-R" "$env:PWSH_PATH\*" /S /D;
|
||||
Remove-Item -Recurse -Force $env:PWSH_PATH;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (-not (& { wsl --status; $?; })) {
|
||||
wsl --install --no-launch;
|
||||
Restart-Intermediate;
|
||||
return;
|
||||
} else {
|
||||
Set-Stage ([SetupStage]::Install);
|
||||
ubuntu install --root;
|
||||
wsl -- sh `<`(curl -L https://nixos.org/nix/install`) --daemon --yes;
|
||||
}
|
||||
} else {
|
||||
$null = Import-Module PSWindowsUpdate;
|
||||
|
|
|
@ -8,6 +8,7 @@ function Start-Setup {
|
|||
$null = $env:WIN_COMPUTER_NAME;
|
||||
$null = $env:SETUP_SCRIPT_NAME;
|
||||
$null = $env:CONFIG_MODULE;
|
||||
$env:WSLENV = "CONFIG_MODULE/p";
|
||||
|
||||
$valhallaConfig = ConvertFrom-Json (Get-Content "$env:CONFIG_MODULE.json");
|
||||
|
||||
|
|
|
@ -13,6 +13,28 @@ $null = New-Module {
|
|||
[string] $finishedOption = "Finished";
|
||||
[RegistryKey] $key = $null;
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Converts the specified path to linux and escapes it for the use in a script.
|
||||
|
||||
.PARAMETER Path
|
||||
The path to convert.
|
||||
#>
|
||||
function ConvertTo-LinuxPath {
|
||||
param(
|
||||
[string] $Path
|
||||
)
|
||||
|
||||
$job = Start-Job {
|
||||
$env:Value = Resolve-Path $Using:Path;
|
||||
$env:WSLENV = "Value/p";
|
||||
$result = wsl -- bash -c 'echo "$Value"';
|
||||
wsl -e printf "%q" "$result";
|
||||
};
|
||||
|
||||
Receive-Job -Wait $job;
|
||||
}
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Gets the registry key containing options related to the setup.
|
||||
|
@ -38,6 +60,27 @@ $null = New-Module {
|
|||
return $key;
|
||||
}
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Gets a configuration option.
|
||||
|
||||
.PARAMETER Name
|
||||
The name of the option to get.
|
||||
#>
|
||||
function Get-Config {
|
||||
param(
|
||||
[string] $Name
|
||||
)
|
||||
|
||||
$scriptPath = "$PSScriptRoot/../../Common/Scripts/config.fish";
|
||||
|
||||
function fish {
|
||||
wsl -- nix --extra-experimental-features "nix-command flakes" nixpkgs`#fish $args
|
||||
}
|
||||
|
||||
fish -c ". $(ConvertTo-LinuxPath $scriptPath); getConfig $Name --json" | ConvertFrom-Json;
|
||||
}
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Gets the value of an option related to the setup.
|
|
@ -1,7 +1,7 @@
|
|||
using namespace Microsoft.Win32;
|
||||
. "$PSScriptRoot/Scripting.ps1";
|
||||
|
||||
$null = New-Module {
|
||||
. "$PSScriptRoot/Scripting.ps1";
|
||||
[RegistryKey] $key = $null;
|
||||
$runOncePath = "HKLM:\Software\Microsoft\Windows\CurrentVersion\RunOnce";
|
||||
$runOnceName = "PortValhalla";
|
||||
|
|
|
@ -23,10 +23,10 @@ function Update-WindowsInstallation {
|
|||
Write-Information "A Reboot is Required!";
|
||||
Write-Information "Windows will reboot now and the installation will be continued automatically.";
|
||||
return;
|
||||
} else {
|
||||
Write-Information "Updating Windows finished successfully!";
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
Write-Information "Upgrading Windows finished successfully!";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue