Set up shared WSL
This commit is contained in:
parent
e4883badcc
commit
026b236783
|
@ -12,6 +12,7 @@ $null = New-Module {
|
||||||
. "$PSScriptRoot/../Scripts/Hooks.ps1";
|
. "$PSScriptRoot/../Scripts/Hooks.ps1";
|
||||||
. "$PSScriptRoot/../Scripts/PowerManagement.ps1";
|
. "$PSScriptRoot/../Scripts/PowerManagement.ps1";
|
||||||
. "$PSScriptRoot/../Scripts/Registry.ps1";
|
. "$PSScriptRoot/../Scripts/Registry.ps1";
|
||||||
|
. "$PSScriptRoot/../Scripts/Security.ps1";
|
||||||
. "$PSScriptRoot/../Scripts/Update.ps1";
|
. "$PSScriptRoot/../Scripts/Update.ps1";
|
||||||
. "$PSScriptRoot/../Scripts/Users.ps1";
|
. "$PSScriptRoot/../Scripts/Users.ps1";
|
||||||
. "$PSScriptRoot/../../Common/Scripts/Config.ps1";
|
. "$PSScriptRoot/../../Common/Scripts/Config.ps1";
|
||||||
|
@ -35,6 +36,8 @@ $null = New-Module {
|
||||||
Starts the installation loop.
|
Starts the installation loop.
|
||||||
#>
|
#>
|
||||||
function Start-InstallationLoop {
|
function Start-InstallationLoop {
|
||||||
|
$wslLocation = "$env:ProgramData\PortValhalla\Ubuntu";
|
||||||
|
|
||||||
while (-not (Get-IsFinished)) {
|
while (-not (Get-IsFinished)) {
|
||||||
switch (Get-Stage) {
|
switch (Get-Stage) {
|
||||||
($null) {
|
($null) {
|
||||||
|
@ -93,7 +96,15 @@ $null = New-Module {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (-not (& { $null = wsl -l; $?; })) {
|
if (-not (& { $null = wsl -l; $?; })) {
|
||||||
ubuntu install --root;
|
$wslRoot = Split-Path -Parent $wslLocation;
|
||||||
|
|
||||||
|
if (-not (Test-Path -PathType $wslRoot)) {
|
||||||
|
$null = New-Item -ItemType Directory $wslRoot;
|
||||||
|
}
|
||||||
|
|
||||||
|
Copy-Item -Recurse -Force (Get-AppxPackage "*Ubuntu*").InstallLocation $wslLocation;
|
||||||
|
Set-UserPermissions $wslLocation;
|
||||||
|
& "$wslLocation\ubuntu.exe" install --root;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,6 +134,11 @@ $null = New-Module {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default {
|
default {
|
||||||
|
if (-not (& { $null = wsl -l; $? })) {
|
||||||
|
wsl --import-in-place "PortValhalla" "$wslLocation/ext4.vhdx";
|
||||||
|
wsl --set-default "PortValhalla";
|
||||||
|
}
|
||||||
|
|
||||||
if (Test-Admin) {
|
if (Test-Admin) {
|
||||||
$null = Import-Module PSWindowsUpdate;
|
$null = Import-Module PSWindowsUpdate;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue