mirror of
https://github.com/fleetdm/fleet
synced 2026-04-21 21:47:20 +00:00
### Summary This PR adds support for `.zip` files as Windows Fleet Managed Apps (FMAs). Zip files on Windows are treated similarly to `.exe` files and require custom install/uninstall scripts, typically used for AppX/MSIX packages that are distributed as zip archives. ### Changes **Backend:** - Added `.zip` as a supported Windows package type in `SoftwareInstallerPlatformFromExtension` - Updated validation to require install/uninstall scripts for zip files (similar to `.exe` files) - Added `addZipPackageMetadata` function to handle zip file metadata extraction - Updated error messages to include `.zip` in the list of supported file types - Enhanced `appExists` validation to detect provisioned AppX packages (packages that are provisioned for all users but don't show up in the programs table until a user logs in) - Added version normalization logic to handle version string differences (e.g., "11.2.1495.0" vs "11.2.1495") - Updated winget ingester to recognize zip files and default to user scope for MSIX/zip installers **Frontend:** - Added `.zip` to `windowsPackageTypes` in `package_type.ts` - Updated `PackageAdvancedOptions` component to require install/uninstall scripts for zip files - Added validation rules for zip files in `PackageForm/helpers.tsx` - Updated help text and tooltips to indicate script requirements for zip packages - Updated `software_install_scripts.ts` to include zip in default script handling **Maintained Apps:** - Added Microsoft Company Portal as a maintained app example using zip files - Created install/uninstall PowerShell scripts that: - Extract zip files containing AppX packages - Provision packages for all future users (works in headless environments) - Install packages for the current user - Handle both provisioned and installed package detection **Tests:** - Updated integration tests to include `.zip` in supported file type error messages - Updated unit tests for `SoftwareInstallerPlatformFromExtension` and `SofwareInstallerSourceFromExtensionAndName` ### Use Case This enables distribution of Windows AppX/MSIX packages that are packaged as zip files (common for Microsoft Store apps like Company Portal). The implementation handles both provisioned packages (for all users) and user-installed packages, ensuring detection works in both headless and interactive environments. ### Testing - Updated existing tests to include zip file support - Added Microsoft Company Portal as a maintained app example with full install/uninstall scripts --- **Note:** This PR follows the same pattern as `.exe` file support, requiring custom install/uninstall scripts since zip files can contain various content types that need custom handling.
40 lines
1 KiB
TypeScript
40 lines
1 KiB
TypeScript
import { getExtensionFromFileName } from "./file/fileUtils";
|
|
|
|
// @ts-ignore
|
|
import installPkg from "../../pkg/file/scripts/install_pkg.sh";
|
|
// @ts-ignore
|
|
import installMsi from "../../pkg/file/scripts/install_msi.ps1";
|
|
// @ts-ignore
|
|
import installDeb from "../../pkg/file/scripts/install_deb.sh";
|
|
// @ts-ignore
|
|
import installRPM from "../../pkg/file/scripts/install_rpm.sh";
|
|
|
|
/*
|
|
* getInstallScript returns a string with a script to install the
|
|
* provided software.
|
|
* */
|
|
const getDefaultInstallScript = (fileName: string): string => {
|
|
const extension = getExtensionFromFileName(fileName);
|
|
|
|
switch (extension) {
|
|
case "pkg":
|
|
return installPkg;
|
|
case "msi":
|
|
return installMsi;
|
|
case "deb":
|
|
return installDeb;
|
|
case "rpm":
|
|
return installRPM;
|
|
case "exe":
|
|
case "zip":
|
|
case "tar.gz":
|
|
case "sh":
|
|
case "ps1":
|
|
case "ipa":
|
|
return "";
|
|
default:
|
|
throw new Error(`unsupported file extension: ${extension}`);
|
|
}
|
|
};
|
|
|
|
export default getDefaultInstallScript;
|