Skip to content

Commit

Permalink
Merge pull request #147 from svrooij/feature/partial-package
Browse files Browse the repository at this point in the history
Allow setting preferred installer
  • Loading branch information
svrooij authored Dec 5, 2024
2 parents d9e1241 + 926780b commit 118f882
Show file tree
Hide file tree
Showing 21 changed files with 454 additions and 363 deletions.
3 changes: 2 additions & 1 deletion src/Svrooij.WinTuner.CmdLets/Commands/ConnectWtWinTuner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,10 @@ public override async Task ProcessRecordAsync(CancellationToken cancellationToke
_logger?.LogInformation("Connecting to Intune using {ParameterSetName}", ParameterSetName);
AuthenticationProvider = CreateAuthenticationProvider(cancellationToken);

// Try getting a token at this point helps solve a lot of issues.
var token = await GetTokenAsync(cancellationToken);
if (Test)
{
var token = await GetTokenAsync(cancellationToken);
_logger?.LogInformation("Got token {Token}", token);
WriteObject(token);
}
Expand Down
3 changes: 2 additions & 1 deletion src/Svrooij.WinTuner.CmdLets/Commands/GetWtToken.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.IdentityModel.Tokens.Jwt;
using System.Linq;
using System.Management.Automation;
using System.Threading;
using System.Threading.Tasks;
Expand Down Expand Up @@ -54,7 +55,7 @@ protected override async Task ProcessAuthenticatedAsync(IAuthenticationProvider
{
// Decode the jwt token and output the claims to the logs
var jwt = new JwtSecurityToken(token);
_logger?.LogInformation("Token claims: {@Claims}", jwt.Claims);
_logger?.LogInformation("Token claims: {Claims}", string.Join("\r\n", jwt.Claims.Select(c => $"{c.Type}\t{c.Value}")));
}

WriteObject(token);
Expand Down
14 changes: 13 additions & 1 deletion src/Svrooij.WinTuner.CmdLets/Commands/NewWtWingetPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,17 @@ public class NewWtWingetPackage : DependencyCmdlet<Startup>
HelpMessage = "Override the installer arguments")]
public string? InstallerArguments { get; set; }

/// <summary>
/// Prefered installer type, (default: Msi)
/// </summary>
[Parameter(
Mandatory = false,
Position = 9,
ValueFromPipeline = false,
ValueFromPipelineByPropertyName = false,
HelpMessage = "Prefered installer type")]
public WingetIntune.Models.InstallerType PreferedInstaller { get; set; } = WingetIntune.Models.InstallerType.Msi;

[ServiceDependency]
private ILogger<NewWtWingetPackage> logger;

Expand Down Expand Up @@ -164,7 +175,8 @@ public override async Task ProcessRecordAsync(CancellationToken cancellationToke
InstallerContext = InstallerContext,
PackageScript = PackageScript,
Locale = Locale,
OverrideArguments = InstallerArguments
OverrideArguments = InstallerArguments,
InstallerType = PreferedInstaller
},
cancellationToken: cancellationToken);

Expand Down
10 changes: 10 additions & 0 deletions src/Svrooij.WinTuner.CmdLets/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ Source of WinTuner PowerShell module, available in the [PowerShell Gallery][link

Documentation can be found [here](https://wintuner.app/docs/category/wintuner-powershell).

## Development

To regenerate the documentation, run the following command from the root of this repo:

```powershell
# Install the tool
# dotnet tool install --global SvRooij.PowerShell.Docs --version 0.1.1
PS> pwsh-docs --dll .\src\Svrooij.WinTuner.CmdLets\bin\Debug\net6.0\Svrooij.WinTuner.CmdLets.dll --use-xml-docs --maml-file .\src\Svrooij.WinTuner.CmdLets\Svrooij.WinTuner.CmdLets.dll-Help.xml
```

[badge_license]: https://img.shields.io/github/license/svrooij/WingetIntune?style=for-the-badge
[link_license]: https://github.com/svrooij/WingetIntune/blob/main/LICENSE.txt
[badge_powershell]: https://img.shields.io/powershellgallery/v/WinTuner?style=for-the-badge&logo=powershell&logoColor=white
Expand Down
50 changes: 50 additions & 0 deletions src/Svrooij.WinTuner.CmdLets/Svrooij.WinTuner.CmdLets.dll-Help.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1659,6 +1659,31 @@ You could run this on a weekly bases.
</dev:type>
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="9" aliases="none">
<maml:name>PreferedInstaller</maml:name>
<maml:description>
<maml:para>Prefered installer type</maml:para>
</maml:description>
<command:parameterValueGroup>
<command:parameterValue required="false" variableLength="false">Unknown</command:parameterValue>
<command:parameterValue required="false" variableLength="false">Msi</command:parameterValue>
<command:parameterValue required="false" variableLength="false">Msix</command:parameterValue>
<command:parameterValue required="false" variableLength="false">Appx</command:parameterValue>
<command:parameterValue required="false" variableLength="false">Exe</command:parameterValue>
<command:parameterValue required="false" variableLength="false">Zip</command:parameterValue>
<command:parameterValue required="false" variableLength="false">Inno</command:parameterValue>
<command:parameterValue required="false" variableLength="false">Nullsoft</command:parameterValue>
<command:parameterValue required="false" variableLength="false">Wix</command:parameterValue>
<command:parameterValue required="false" variableLength="false">Burn</command:parameterValue>
<command:parameterValue required="false" variableLength="false">Pwa</command:parameterValue>
<command:parameterValue required="false" variableLength="false">Portable</command:parameterValue>
</command:parameterValueGroup>
<command:parameterValue required="false" variableLength="false">InstallerType</command:parameterValue>
<dev:type>
<maml:name>InstallerType</maml:name>
</dev:type>
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
</command:syntaxItem>
</command:syntax>
<command:parameters>
Expand Down Expand Up @@ -1773,6 +1798,31 @@ You could run this on a weekly bases.
</dev:type>
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="9" aliases="none">
<maml:name>PreferedInstaller</maml:name>
<maml:description>
<maml:para>Prefered installer type</maml:para>
</maml:description>
<command:parameterValueGroup>
<command:parameterValue required="false" variableLength="false">Unknown</command:parameterValue>
<command:parameterValue required="false" variableLength="false">Msi</command:parameterValue>
<command:parameterValue required="false" variableLength="false">Msix</command:parameterValue>
<command:parameterValue required="false" variableLength="false">Appx</command:parameterValue>
<command:parameterValue required="false" variableLength="false">Exe</command:parameterValue>
<command:parameterValue required="false" variableLength="false">Zip</command:parameterValue>
<command:parameterValue required="false" variableLength="false">Inno</command:parameterValue>
<command:parameterValue required="false" variableLength="false">Nullsoft</command:parameterValue>
<command:parameterValue required="false" variableLength="false">Wix</command:parameterValue>
<command:parameterValue required="false" variableLength="false">Burn</command:parameterValue>
<command:parameterValue required="false" variableLength="false">Pwa</command:parameterValue>
<command:parameterValue required="false" variableLength="false">Portable</command:parameterValue>
</command:parameterValueGroup>
<command:parameterValue required="false" variableLength="false">InstallerType</command:parameterValue>
<dev:type>
<maml:name>InstallerType</maml:name>
</dev:type>
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
</command:parameters>
<command:returnValues>
<command:returnValue>
Expand Down
63 changes: 32 additions & 31 deletions src/Svrooij.WinTuner.CmdLets/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -149,45 +149,46 @@
},
"Microsoft.Extensions.DependencyInjection": {
"type": "Transitive",
"resolved": "8.0.0",
"contentHash": "V8S3bsm50ig6JSyrbcJJ8bW2b9QLGouz+G1miK3UTaOWmMtFwNNNzUf4AleyDWUmTrWMLNnFSLEQtxmxgNQnNQ==",
"resolved": "8.0.1",
"contentHash": "BmANAnR5Xd4Oqw7yQ75xOAYODybZQRzdeNucg7kS5wWKd2PNnMdYtJ2Vciy0QLylRmv42DGl5+AFL9izA6F1Rw==",
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0"
"Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.2"
}
},
"Microsoft.Extensions.DependencyInjection.Abstractions": {
"type": "Transitive",
"resolved": "8.0.1",
"contentHash": "fGLiCRLMYd00JYpClraLjJTNKLmMJPnqxMaiRzEBIIvevlzxz33mXy39Lkd48hu1G+N21S7QpaO5ZzKsI6FRuA=="
"resolved": "8.0.2",
"contentHash": "3iE7UF7MQkCv1cxzCahz+Y/guQbTqieyxyaWKhrRO91itI9cOKO76OHeQDahqG4MmW5umr3CcCvGmK92lWNlbg=="
},
"Microsoft.Extensions.Http": {
"type": "Transitive",
"resolved": "8.0.0",
"contentHash": "cWz4caHwvx0emoYe7NkHPxII/KkTI8R/LC9qdqJqnKv2poTJ4e2qqPGQqvRoQ5kaSA4FU5IV3qFAuLuOhoqULQ==",
"resolved": "8.0.1",
"contentHash": "kDYeKJUzh0qeg/AI+nSr3ffthmXYQTEb0nS9qRC7YhSbbuN4M4NPbaB77AJwtkTnCV9XZ7qYj3dkZaNcyl73EA==",
"dependencies": {
"Microsoft.Extensions.Configuration.Abstractions": "8.0.0",
"Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0",
"Microsoft.Extensions.Logging": "8.0.0",
"Microsoft.Extensions.Logging.Abstractions": "8.0.0",
"Microsoft.Extensions.Options": "8.0.0"
"Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.2",
"Microsoft.Extensions.Logging": "8.0.1",
"Microsoft.Extensions.Logging.Abstractions": "8.0.2",
"Microsoft.Extensions.Options": "8.0.2"
}
},
"Microsoft.Extensions.Logging": {
"type": "Transitive",
"resolved": "8.0.0",
"contentHash": "tvRkov9tAJ3xP51LCv3FJ2zINmv1P8Hi8lhhtcKGqM+ImiTCC84uOPEI4z8Cdq2C3o9e+Aa0Gw0rmrsJD77W+w==",
"resolved": "8.0.1",
"contentHash": "4x+pzsQEbqxhNf1QYRr5TDkLP9UsLT3A6MdRKDDEgrW7h1ljiEPgTNhKYUhNCCAaVpQECVQ+onA91PTPnIp6Lw==",
"dependencies": {
"Microsoft.Extensions.DependencyInjection": "8.0.0",
"Microsoft.Extensions.Logging.Abstractions": "8.0.0",
"Microsoft.Extensions.Options": "8.0.0"
"Microsoft.Extensions.DependencyInjection": "8.0.1",
"Microsoft.Extensions.Logging.Abstractions": "8.0.2",
"Microsoft.Extensions.Options": "8.0.2"
}
},
"Microsoft.Extensions.Logging.Abstractions": {
"type": "Transitive",
"resolved": "8.0.1",
"contentHash": "RIFgaqoaINxkM2KTOw72dmilDmTrYA0ns2KW4lDz4gZ2+o6IQ894CzmdL3StM2oh7QQq44nCWiqKqc4qUI9Jmg==",
"resolved": "8.0.2",
"contentHash": "nroMDjS7hNBPtkZqVBbSiQaQjWRDxITI8Y7XnDs97rqG3EbzVTNLZQf7bIeUJcaHOV8bca47s1Uxq94+2oGdxA==",
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.1"
"Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.2",
"System.Diagnostics.DiagnosticSource": "8.0.1"
}
},
"Microsoft.Extensions.Logging.Configuration": {
Expand Down Expand Up @@ -692,12 +693,12 @@
},
"SvRooij.ContentPrep": {
"type": "Transitive",
"resolved": "0.1.3-alpha0001",
"contentHash": "9exebiAiEz1cn5XKxivypRmpG0t0ykSFrenU8GtwYzv3JrIlkXT6WdntsVYr181ebWhdAWOU4cjR5IgMjDqQMg==",
"resolved": "0.2.2",
"contentHash": "U76+iUs+6ITR/kXNW5ylZj87yQ4UPmqUOConek8Tus16/lfwLNbItGPed8P/wbj/+517FU0pGyFUQiedY4mSfA==",
"dependencies": {
"Microsoft.Extensions.Logging.Abstractions": "7.0.1",
"Microsoft.NETCore.Platforms": "7.0.4",
"System.Runtime.CompilerServices.Unsafe": "6.0.0"
"System.Runtime.CompilerServices.Unsafe": "6.1.0"
}
},
"System.ClientModel": {
Expand Down Expand Up @@ -771,8 +772,8 @@
},
"System.Diagnostics.DiagnosticSource": {
"type": "Transitive",
"resolved": "6.0.1",
"contentHash": "KiLYDu2k2J82Q9BJpWiuQqCkFjRBWVq4jDzKKWawVi9KWzyD0XG3cmfX0vqTQlL14Wi9EufJrbL0+KCLTbqWiQ==",
"resolved": "8.0.1",
"contentHash": "vaoWjvkG1aenR2XdjaVivlCV9fADfgyhW5bZtXT23qaEea0lWiUljdQuze4E31vKM7ZWJaSUsbYIKE3rnzfZUg==",
"dependencies": {
"System.Runtime.CompilerServices.Unsafe": "6.0.0"
}
Expand Down Expand Up @@ -943,8 +944,8 @@
},
"System.Runtime.CompilerServices.Unsafe": {
"type": "Transitive",
"resolved": "6.0.0",
"contentHash": "/iUeP3tq1S0XdNNoMz5C9twLSrM/TH+qElHkXWaPvuNOt+99G75NrV0OS2EqHx5wMN7popYjpc8oTjC1y16DLg=="
"resolved": "6.1.0",
"contentHash": "5o/HZxx6RVqYlhKSq8/zronDkALJZUT2Vz0hx43f0gwe8mwlM0y2nYlqdBwLMzr262Bwvpikeb/yEwkAa5PADg=="
},
"System.Security.AccessControl": {
"type": "Transitive",
Expand Down Expand Up @@ -1108,7 +1109,7 @@
"winget.communityrepository": {
"type": "Project",
"dependencies": {
"Microsoft.Extensions.Logging.Abstractions": "[8.0.1, )",
"Microsoft.Extensions.Logging.Abstractions": "[8.0.2, )",
"YamlDotNet": "[16.0.0, )"
}
},
Expand All @@ -1118,15 +1119,15 @@
"Azure.Core": "[1.44.1, )",
"Microsoft.Bcl.AsyncInterfaces": "[8.0.0, )",
"Microsoft.CSharp": "[4.7.0, )",
"Microsoft.Extensions.Http": "[8.0.0, )",
"Microsoft.Extensions.Logging.Abstractions": "[8.0.1, )",
"Microsoft.Extensions.Http": "[8.0.1, )",
"Microsoft.Extensions.Logging.Abstractions": "[8.0.2, )",
"Microsoft.Extensions.Options": "[8.0.2, )",
"Microsoft.Graph.Beta": "[5.78.0-preview, )",
"Microsoft.Graph.Core": "[3.2.0, )",
"Microsoft.Identity.Client.Broker": "[4.66.2, )",
"Microsoft.Identity.Client.Extensions.Msal": "[4.66.2, )",
"Riok.Mapperly": "[3.6.0, )",
"SvRooij.ContentPrep": "[0.1.3-alpha0001, )",
"SvRooij.ContentPrep": "[0.2.2, )",
"System.IdentityModel.Tokens.Jwt": "[8.0.2, )",
"WinTuner.Proxy.Client": "[1.0.0, )",
"Winget.CommunityRepository": "[1.0.0, )"
Expand All @@ -1135,7 +1136,7 @@
"wintuner.proxy.client": {
"type": "Project",
"dependencies": {
"Microsoft.Extensions.Http": "[8.0.0, )",
"Microsoft.Extensions.Http": "[8.0.1, )",
"Microsoft.Kiota.Abstractions": "[1.14.0, )",
"Microsoft.Kiota.Http.HttpClientLibrary": "[1.14.0, )",
"Microsoft.Kiota.Serialization.Json": "[1.14.0, )",
Expand Down
2 changes: 1 addition & 1 deletion src/WinTuner.Proxy.Client/WinTuner.Proxy.Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<PackageReference Include="Microsoft.Kiota.Abstractions" Version="1.14.0" />
<PackageReference Include="Microsoft.Kiota.Http.HttpClientLibrary" Version="1.14.0" />
<PackageReference Include="Microsoft.Kiota.Serialization.Json" Version="1.14.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.1" />
<PackageReference Include="System.Text.Json" Version="8.0.5" />
</ItemGroup>
<Target Name="GenerateRestClient" DependsOnTargets="CleanGenerateRestClient;AutoGenerateRestClient">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
<NoWarn>1701;1702;CS8618</NoWarn>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.2" />
<PackageReference Include="System.Text.Json" Version="8.0.5" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net8.0' ">
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.4">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.2" />
<PackageReference Include="YamlDotNet" Version="16.0.0" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/WingetIntune.Cli/WingetIntune.Cli.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<ItemGroup>
<PackageReference Include="Azure.Identity" Version="1.13.1" />
<PackageReference Include="ConsoleTables" Version="2.6.1" />
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="8.0.1" />
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
<PackageReference Include="System.CommandLine.Hosting" Version="0.4.0-alpha.22272.1" />
</ItemGroup>
Expand Down
Loading

0 comments on commit 118f882

Please sign in to comment.