mirror of
https://github.com/fleetdm/fleet
synced 2026-05-22 16:39:01 +00:00
for #18325 # 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] Input data is properly validated, `SELECT *` is avoided, SQL injection is prevented (using placeholders for values in statements) - [x] Added/updated tests - [x] Manual QA for all new/changed functionality --------- Co-authored-by: Martin Angers <martin.n.angers@gmail.com>
63 lines
1.2 KiB
Go
63 lines
1.2 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_exe.ps1
|
|
var installExeScript string
|
|
|
|
//go:embed scripts/install_deb.sh
|
|
var installDebScript string
|
|
|
|
// GetInstallScript returns a script that can be used to install the
|
|
// the given extension
|
|
func GetInstallScript(extension string) string {
|
|
switch extension {
|
|
case "msi":
|
|
return installMsiScript
|
|
case "deb":
|
|
return installDebScript
|
|
case "pkg":
|
|
return installPkgScript
|
|
case "exe":
|
|
return installExeScript
|
|
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
|
|
|
|
// 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 "pkg":
|
|
return removePkgScript
|
|
case "exe":
|
|
return removeExeScript
|
|
default:
|
|
return ""
|
|
}
|
|
}
|