mirror of
https://github.com/fleetdm/fleet
synced 2026-05-22 08:28:52 +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>
96 lines
1.9 KiB
Go
96 lines
1.9 KiB
Go
package file
|
|
|
|
import (
|
|
_ "embed"
|
|
)
|
|
|
|
//go:embed scripts/install_pkg.sh
|
|
var installPkgScript string
|
|
|
|
//go:embed scripts/install_msi.ps1
|
|
var installMsiScript string
|
|
|
|
//go:embed scripts/install_deb.sh
|
|
var installDebScript string
|
|
|
|
//go:embed scripts/install_rpm.sh
|
|
var installRPMScript string
|
|
|
|
// GetInstallScript returns a script that can be used to install the given extension
|
|
func GetInstallScript(extension string) string {
|
|
switch extension {
|
|
case "msi":
|
|
return installMsiScript
|
|
case "deb":
|
|
return installDebScript
|
|
case "rpm":
|
|
return installRPMScript
|
|
case "pkg":
|
|
return installPkgScript
|
|
default:
|
|
return ""
|
|
}
|
|
}
|
|
|
|
//go:embed scripts/remove_exe.ps1
|
|
var removeExeScript string
|
|
|
|
//go:embed scripts/remove_pkg.sh
|
|
var removePkgScript string
|
|
|
|
//go:embed scripts/remove_msi.ps1
|
|
var removeMsiScript string
|
|
|
|
//go:embed scripts/remove_deb.sh
|
|
var removeDebScript string
|
|
|
|
//go:embed scripts/remove_rpm.sh
|
|
var removeRPMScript string
|
|
|
|
// GetRemoveScript returns a script that can be used to remove an
|
|
// installer with the given extension.
|
|
func GetRemoveScript(extension string) string {
|
|
switch extension {
|
|
case "msi":
|
|
return removeMsiScript
|
|
case "deb":
|
|
return removeDebScript
|
|
case "rpm":
|
|
return removeRPMScript
|
|
case "pkg":
|
|
return removePkgScript
|
|
case "exe":
|
|
return removeExeScript
|
|
default:
|
|
return ""
|
|
}
|
|
}
|
|
|
|
//go:embed scripts/uninstall_pkg.sh
|
|
var uninstallPkgScript string
|
|
|
|
//go:embed scripts/uninstall_msi.ps1
|
|
var uninstallMsiScript string
|
|
|
|
//go:embed scripts/uninstall_deb.sh
|
|
var uninstallDebScript string
|
|
|
|
//go:embed scripts/uninstall_rpm.sh
|
|
var uninstallRPMScript string
|
|
|
|
// GetUninstallScript returns a script that can be used to uninstall a
|
|
// software item with the given extension.
|
|
func GetUninstallScript(extension string) string {
|
|
switch extension {
|
|
case "msi":
|
|
return uninstallMsiScript
|
|
case "deb":
|
|
return uninstallDebScript
|
|
case "rpm":
|
|
return uninstallRPMScript
|
|
case "pkg":
|
|
return uninstallPkgScript
|
|
default:
|
|
return ""
|
|
}
|
|
}
|