mirror of
https://github.com/fleetdm/fleet
synced 2026-05-19 23:18:51 +00:00
For #27267. Below is what's shown immediately after selecting an EXE: <img width="1254" alt="image" src="https://github.com/user-attachments/assets/a28d8565-de88-448a-bdbc-92aefc34ad55" /> TODO: * Tests * GitOps requirements changes * Disabling add button/adding errors when required scripts aren't specified # Checklist for submitter If some of the following don't apply, delete the relevant line. - [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/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] Added/updated automated tests - [x] A detailed QA plan exists on the associated ticket (if it isn't there, work with the product group's QA engineer to add it) - [x] Manual QA for all new/changed functionality --------- Co-authored-by: Luke Heath <luke@fleetdm.com> Co-authored-by: Noah Talerman <47070608+noahtalerman@users.noreply.github.com> Co-authored-by: RachelElysia <rachel@fleetdm.com>
32 lines
902 B
TypeScript
32 lines
902 B
TypeScript
// @ts-ignore
|
|
import uninstallPkg from "../../pkg/file/scripts/uninstall_pkg.sh";
|
|
// @ts-ignore
|
|
import uninstallMsi from "../../pkg/file/scripts/uninstall_msi.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 = fileName.split(".").pop();
|
|
switch (extension) {
|
|
case "pkg":
|
|
return uninstallPkg;
|
|
case "msi":
|
|
return uninstallMsi;
|
|
case "deb":
|
|
return uninstallDeb;
|
|
case "rpm":
|
|
return uninstallRPM;
|
|
case "exe":
|
|
return "";
|
|
default:
|
|
throw new Error(`unsupported file extension: ${extension}`);
|
|
}
|
|
};
|
|
|
|
export default getDefaultUninstallScript;
|