-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
override-manifest.ps1
35 lines (29 loc) · 1.14 KB
/
override-manifest.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#Requires -RunAsAdministrator
[cmdletbinding(PositionalBinding = $false)]
param (
[Parameter(Mandatory = $true)][string]$TarFile,
[string]$Flavor = "corsairnix",
[string]$Version = "corsairnix-v0.1",
[string]$FriendlyName = "Corsairnix version 0.1 based on AzureLinux")
Set-StrictMode -Version latest
# $TarPath = Resolve-Path $TarPath
# $hash = (Get-Filehash $TarPath -Algorithm SHA256).Hash
$wc = [System.Net.WebClient]::new()
$hash = (Get-FileHash -InputStream ($wc.OpenRead($TarFile)) -Algorithm SHA256).Hash
$manifest= @{
ModernDistributions=@{
"$Flavor" = @(
@{
"Name" = "$Version"
Default = $true
FriendlyName = "$FriendlyName"
Amd64Url = @{
Url = "$TarFile"
Sha256 = "0x$($hash)"
}
})
}
}
$manifestFile = "$PSScriptRoot/manifest.json"
$manifest | ConvertTo-Json -Depth 5 | Out-File -encoding ascii $manifestFile
Set-ItemProperty -Path "HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\Lxss" -Name DistributionListUrlAppend -Value "file://$manifestFile" -Type String -Force