PortValhalla/scripts/Windows/Software/NVS/Manage.ps1

40 lines
1.2 KiB
PowerShell

using namespace System.Security.AccessControl;
using namespace System.Security.Principal;
param(
$Action,
[hashtable] $Arguments
)
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
. "$PSScriptRoot/../../../Common/Types/InstallerAction.ps1";
Start-SoftwareInstaller @PSBoundParameters `
-Installer {
param(
[scriptblock] $Installer
)
$env:NVS_HOME = "$env:ProgramData\nvs";
git clone "https://github.com/jasongin/nvs.git" $env:NVS_HOME;
& "$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;
& $Installer -Action ([InstallerAction]::Configure);
} `
-Configurator {
nvs add latest;
nvs link latest;
};