mirror of
https://github.com/fleetdm/fleet
synced 2026-05-06 06:48:54 +00:00
Fixes #27758. <img width="807" height="303" alt="image" src="https://github.com/user-attachments/assets/58e5b9bc-42d6-4195-868e-bf6206ec9cd5" /> # Checklist for submitter If some of the following don't apply, delete the relevant line. <!-- Note that API documentation changes are now addressed by the product design team. --> - [x] Changes file added for user-visible changes in `changes/`, `orbit/changes/` or `ee/fleetd-chrome/changes`. See [Changes files](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/guides/committing-changes.md#changes-files) for more information. - [x] Input data is properly validated, `SELECT *` is avoided, SQL injection is prevented (using placeholders for values in statements) - [x] If database migrations are included, checked table schema to confirm autoupdate - For database migrations: - [x] Checked schema for all modified table for columns that will auto-update timestamps during migration. - [x] Confirmed that updating the timestamps is acceptable, and will not cause unwanted side effects. - [x] Ensured the correct collation is explicitly set for character columns (`COLLATE utf8mb4_unicode_ci`). - [x] Added/updated automated tests - [x] Manual QA for all new/changed functionality
37 lines
1 KiB
TypeScript
37 lines
1 KiB
TypeScript
import { getExtensionFromFileName } from "./file/fileUtils";
|
|
|
|
// @ts-ignore
|
|
import uninstallPkg from "../../pkg/file/scripts/uninstall_pkg.sh";
|
|
// @ts-ignore
|
|
import uninstallMsi from "../../pkg/file/scripts/uninstall_msi_with_upgrade_code.ps1";
|
|
// @ts-ignore
|
|
import uninstallDeb from "../../pkg/file/scripts/uninstall_deb.sh";
|
|
// @ts-ignore
|
|
import uninstallRPM from "../../pkg/file/scripts/uninstall_rpm.sh";
|
|
|
|
/*
|
|
* getUninstallScript returns a string with a script to uninstall the
|
|
* provided software.
|
|
* */
|
|
const getDefaultUninstallScript = (fileName: string): string => {
|
|
const extension = getExtensionFromFileName(fileName);
|
|
|
|
switch (extension) {
|
|
case "pkg":
|
|
return uninstallPkg;
|
|
case "msi":
|
|
return uninstallMsi;
|
|
case "deb":
|
|
return uninstallDeb;
|
|
case "rpm":
|
|
return uninstallRPM;
|
|
case "exe":
|
|
return "";
|
|
case "tar.gz":
|
|
return "";
|
|
default:
|
|
throw new Error(`unsupported file extension: ${extension}`);
|
|
}
|
|
};
|
|
|
|
export default getDefaultUninstallScript;
|