Skip to content

Commit

Permalink
MSI did not allow override arguments (#140)
Browse files Browse the repository at this point in the history
* MSI did not allow override arguments

fixed #137

And added code scanning
  • Loading branch information
svrooij authored Nov 29, 2024
1 parent a68d293 commit d9e1241
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
13 changes: 5 additions & 8 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
matrix:
include:
- language: csharp
build-mode: none
build-mode: manual
# CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift'
# Use `c-cpp` to analyze code written in C, C++ or both
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
Expand Down Expand Up @@ -76,15 +76,12 @@ jobs:
# to build your code.
# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
- if: matrix.build-mode == 'manual'
- if: matrix.build-mode == 'manual' && matrix.language == 'csharp'
shell: bash
run: |
echo 'If you are using a "manual" build mode for one or more of the' \
'languages you are analyzing, replace this with the commands to build' \
'your code, for example:'
echo ' make bootstrap'
echo ' make release'
exit 1
dotnet tool install --global Microsoft.OpenApi.Kiota
dotnet restore
dotnet build --configuration Release --no-restore
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
Expand Down
6 changes: 3 additions & 3 deletions src/WingetIntune/Intune/IntuneManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public IntuneManager(ILoggerFactory? loggerFactory, IFileManager fileManager, IP
var packageTempFolder = fileManager.CreateFolderForPackage(tempFolder, packageInfo.PackageIdentifier!, packageInfo.Version!);
var packageFolder = fileManager.CreateFolderForPackage(outputFolder, packageInfo.PackageIdentifier!, packageInfo.Version!);
var installerPath = await DownloadInstallerAsync(packageTempFolder, packageInfo, cancellationToken);
LoadMsiDetails(installerPath, ref packageInfo);
LoadMsiDetails(installerPath, ref packageInfo, packageOptions.OverrideArguments);
var intunePackage = await intunePackager.CreatePackage(packageTempFolder, packageFolder, packageInfo.InstallerFilename!, packageInfo, cancellationToken);
await DownloadLogoAsync(packageFolder, packageInfo.PackageIdentifier!, cancellationToken);
await WriteReadmeAsync(packageFolder, packageInfo, cancellationToken);
Expand Down Expand Up @@ -492,15 +492,15 @@ public static (string?, string?) GetMsiInfo(string setupFile, ILogger? logger)
return (null, null);
}

private void LoadMsiDetails(string installerPath, ref PackageInfo packageInfo)
private void LoadMsiDetails(string installerPath, ref PackageInfo packageInfo, string? overrideInstallerArguments = null)
{
if (string.IsNullOrEmpty(packageInfo.MsiProductCode) || string.IsNullOrEmpty(packageInfo.MsiVersion))
{
var (productCode, msiVersion) = GetMsiInfo(installerPath, logger);
packageInfo.MsiProductCode = productCode ?? packageInfo.MsiProductCode;
packageInfo.MsiVersion = msiVersion ?? packageInfo.MsiVersion;
}
packageInfo.InstallCommandLine = $"msiexec /i {packageInfo.InstallerFilename!} /qn /norestart";
packageInfo.InstallCommandLine = $"msiexec /i {packageInfo.InstallerFilename!} " + (overrideInstallerArguments ?? "/qn /norestart");
packageInfo.UninstallCommandLine = $"msiexec /x {packageInfo.MsiProductCode!} /qn /norestart";
}

Expand Down

0 comments on commit d9e1241

Please sign in to comment.