Add instructions for command line installation on pkg gen (#25166)

#25004
This commit is contained in:
Dante Catalfamo 2025-01-06 13:04:12 -05:00 committed by GitHub
parent d46c427f5b
commit d48c9baafa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 21 additions and 2 deletions

View file

@ -0,0 +1 @@
- Display command line installation instructions when a package is generated

View file

@ -377,13 +377,31 @@ func packageCommand() *cli.Command {
}
path, _ = filepath.Abs(path)
pathBase := filepath.Base(path)
var installInstructions = "double-click the installer"
var deviceType string
switch c.String("type") {
case "pkg":
installInstructions += fmt.Sprintf(" or run the command `sudo installer -pkg \"%s\" -target /`", pathBase)
deviceType = "macOS"
case "deb":
installInstructions += fmt.Sprintf(" or run the command `sudo apt install \"%s\"`", pathBase)
deviceType = "Debian-based Linux"
case "rpm":
installInstructions += fmt.Sprintf(" or run the command `sudo dnf install \"%s\"`", pathBase)
deviceType = "RPM-based Linux"
case "msi":
installInstructions += fmt.Sprintf(" or run the command `msiexec /i \"%s\"` as administrator", pathBase)
deviceType = "Windows"
}
fmt.Printf(`
Success! You generated fleetd at %s
To add this device to Fleet, double-click to install fleetd.
To add a new %s device to Fleet, %s.
To add other devices to Fleet, distribute fleetd using Chef, Ansible, Jamf, or Puppet. Learn how: https://fleetdm.com/learn-more-about/enrolling-hosts
`, path)
`, path, deviceType, installInstructions)
if !disableOpenFolder {
open.Start(filepath.Dir(path)) //nolint:errcheck
}