Compare commits
5 commits
eae1d94b26
...
019ad5693d
Author | SHA1 | Date | |
---|---|---|---|
Manuel Thalmann | 019ad5693d | ||
Manuel Thalmann | ad4ee1f9e0 | ||
Manuel Thalmann | 9e8fc6f3ca | ||
Manuel Thalmann | 5d66720106 | ||
Manuel Thalmann | 7ba4cab2e4 |
|
@ -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 (Get-AppxPackage "*Ubuntu*").InstallLocation $wslLocation;
|
||||||
|
Set-UserPermissions $wslLocation;
|
||||||
|
& "$wslLocation\ubuntu.exe" install --root;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,15 +134,22 @@ $null = New-Module {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default {
|
default {
|
||||||
$null = Import-Module PSWindowsUpdate;
|
if (-not (& { $null = wsl -l; $? })) {
|
||||||
|
wsl --import-in-place "PortValhalla" "$wslLocation/ext4.vhdx";
|
||||||
|
wsl --set-default "PortValhalla";
|
||||||
|
}
|
||||||
|
|
||||||
Invoke-Hook "Invoke-WindowsUpdate" -Fallback {
|
if (Test-Admin) {
|
||||||
Update-WindowsInstallation;
|
$null = Import-Module PSWindowsUpdate;
|
||||||
};
|
|
||||||
|
|
||||||
if ((Get-WURebootStatus -Silent)) {
|
Invoke-Hook "Invoke-WindowsUpdate" -Fallback {
|
||||||
Restart-Intermediate;
|
Update-WindowsInstallation;
|
||||||
return;
|
};
|
||||||
|
|
||||||
|
if ((Get-WURebootStatus -Silent)) {
|
||||||
|
Restart-Intermediate;
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
<#
|
<#
|
||||||
|
@ -450,7 +468,10 @@ $null = New-Module {
|
||||||
|
|
||||||
[string[]] $users = Get-Users;
|
[string[]] $users = Get-Users;
|
||||||
$currentUser = Get-CurrentUser;
|
$currentUser = Get-CurrentUser;
|
||||||
Disable-BootMessage;
|
|
||||||
|
if (Test-Admin) {
|
||||||
|
Disable-BootMessage;
|
||||||
|
}
|
||||||
|
|
||||||
if ($currentUser -lt $users.Count) {
|
if ($currentUser -lt $users.Count) {
|
||||||
$user = Get-LocalUser $users[$currentUser];
|
$user = Get-LocalUser $users[$currentUser];
|
||||||
|
|
|
@ -141,7 +141,7 @@ $null = New-Module {
|
||||||
[switch] $DefaultUser
|
[switch] $DefaultUser
|
||||||
)
|
)
|
||||||
|
|
||||||
$register = { param($Key) Register-Setup -UserKey $Key; };
|
$register = { param($UserKey) Register-Setup @PSBoundParameters; };
|
||||||
|
|
||||||
if ($DefaultUser) {
|
if ($DefaultUser) {
|
||||||
Edit-DefaultUserKey {
|
Edit-DefaultUserKey {
|
||||||
|
@ -149,11 +149,12 @@ $null = New-Module {
|
||||||
[RegistryKey] $Key
|
[RegistryKey] $Key
|
||||||
)
|
)
|
||||||
|
|
||||||
& $register -Key $Key;
|
& $register $Key;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
& $register;
|
||||||
}
|
}
|
||||||
|
|
||||||
& $register;
|
|
||||||
Read-Host "Press enter to reboot";
|
Read-Host "Press enter to reboot";
|
||||||
Restart-Computer -Force;
|
Restart-Computer -Force;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
using namespace System.Security.AccessControl;
|
||||||
|
using namespace System.Security.Principal;
|
||||||
|
|
||||||
$null = New-Module {
|
$null = New-Module {
|
||||||
$uacOption = "EnableLUA";
|
$uacOption = "EnableLUA";
|
||||||
$systemPolicyPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System";
|
$systemPolicyPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System";
|
||||||
|
@ -33,4 +36,29 @@ $null = New-Module {
|
||||||
function Disable-UAC {
|
function Disable-UAC {
|
||||||
& $uacSetter $false;
|
& $uacSetter $false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Sets read/write permissions for users at the specified path.
|
||||||
|
|
||||||
|
.PARAMETER Path
|
||||||
|
The path to allow access to users.
|
||||||
|
#>
|
||||||
|
function Set-UserPermissions {
|
||||||
|
param(
|
||||||
|
[string] $Path
|
||||||
|
)
|
||||||
|
|
||||||
|
$acl = Get-Acl $Path;
|
||||||
|
|
||||||
|
$acl.AddAccessRule(
|
||||||
|
[FileSystemAccessRule]::new(
|
||||||
|
[SecurityIdentifier]::new([WellKnownSidType]::BuiltinUsersSid, $null),
|
||||||
|
[FileSystemRights]::FullControl,
|
||||||
|
[InheritanceFlags]::ObjectInherit -bor [InheritanceFlags]::ContainerInherit,
|
||||||
|
[PropagationFlags]::InheritOnly,
|
||||||
|
[AccessControlType]::Allow));
|
||||||
|
|
||||||
|
Set-Acl $Path $acl;
|
||||||
|
}
|
||||||
};
|
};
|
|
@ -6,6 +6,7 @@ param(
|
||||||
[hashtable] $Arguments
|
[hashtable] $Arguments
|
||||||
)
|
)
|
||||||
|
|
||||||
|
. "$PSScriptRoot/../../Scripts/Security.ps1";
|
||||||
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
||||||
. "$PSScriptRoot/../../../Common/Types/InstallerAction.ps1";
|
. "$PSScriptRoot/../../../Common/Types/InstallerAction.ps1";
|
||||||
|
|
||||||
|
@ -19,18 +20,8 @@ Start-SoftwareInstaller @PSBoundParameters `
|
||||||
git clone "https://github.com/jasongin/nvs.git" $env:NVS_HOME;
|
git clone "https://github.com/jasongin/nvs.git" $env:NVS_HOME;
|
||||||
& "$env:NVS_HOME\nvs.cmd" install;
|
& "$env:NVS_HOME\nvs.cmd" install;
|
||||||
|
|
||||||
$acl = Get-Acl $env:NVS_HOME;
|
|
||||||
|
|
||||||
$acl.AddAccessRule(
|
|
||||||
[FileSystemAccessRule]::new(
|
|
||||||
[SecurityIdentifier]::new([WellKnownSidType]::BuiltinUsersSid, $null),
|
|
||||||
[FileSystemRights]::FullControl,
|
|
||||||
[InheritanceFlags]::ObjectInherit -bor [InheritanceFlags]::ContainerInherit,
|
|
||||||
[PropagationFlags]::InheritOnly,
|
|
||||||
[AccessControlType]::Allow));
|
|
||||||
|
|
||||||
Set-Acl $env:NVS_HOME $acl;
|
|
||||||
refreshenv;
|
refreshenv;
|
||||||
|
Set-UserPermissions $env:NVS_HOME;
|
||||||
& $Installer -Action ([InstallerAction]::Configure);
|
& $Installer -Action ([InstallerAction]::Configure);
|
||||||
} `
|
} `
|
||||||
-Configurator {
|
-Configurator {
|
||||||
|
|
Loading…
Reference in a new issue