From 0a8dd22eac96f9e106615b9ed862a9f54a58d1c4 Mon Sep 17 00:00:00 2001 From: dantecatalfamo Date: Mon, 6 Jan 2025 10:59:31 -0500 Subject: [PATCH 1/7] Add instructions for command line installation on pkg gen --- cmd/fleetctl/package.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/cmd/fleetctl/package.go b/cmd/fleetctl/package.go index 1cf3978c72c7..48ec626b8476 100644 --- a/cmd/fleetctl/package.go +++ b/cmd/fleetctl/package.go @@ -377,13 +377,25 @@ func packageCommand() *cli.Command { } path, _ = filepath.Abs(path) + var installInstructions = "double-click the installer" + switch c.String("type") { + case "pkg": + installInstructions += fmt.Sprintf(" or run the command `installer -pkg \"%s\" -target /`", path) + case "deb": + installInstructions += fmt.Sprintf(" or run the command `sudo apt install \"%s\"`", path) + case "rpm": + installInstructions += fmt.Sprintf(" or run the command `sudo dnf install \"%s\"`", path) + case "msi": + installInstructions += fmt.Sprintf(" or run the command `msiexec /i \"%s\"` as administrator", path) + } + fmt.Printf(` Success! You generated fleetd at %s -To add this device to Fleet, double-click to install fleetd. +To add this 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, installInstructions) if !disableOpenFolder { open.Start(filepath.Dir(path)) //nolint:errcheck } From d3ba7cfe6d7a29f7b7eeebb5e4b0b2db6a76ea62 Mon Sep 17 00:00:00 2001 From: dantecatalfamo Date: Mon, 6 Jan 2025 11:32:38 -0500 Subject: [PATCH 2/7] Use base path instead of full path for cli instructions --- cmd/fleetctl/package.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cmd/fleetctl/package.go b/cmd/fleetctl/package.go index 48ec626b8476..09f077c4f00e 100644 --- a/cmd/fleetctl/package.go +++ b/cmd/fleetctl/package.go @@ -377,16 +377,17 @@ func packageCommand() *cli.Command { } path, _ = filepath.Abs(path) + pathBase := filepath.Base(path) var installInstructions = "double-click the installer" switch c.String("type") { case "pkg": - installInstructions += fmt.Sprintf(" or run the command `installer -pkg \"%s\" -target /`", path) + installInstructions += fmt.Sprintf(" or run the command `installer -pkg \"%s\" -target /`", pathBase) case "deb": - installInstructions += fmt.Sprintf(" or run the command `sudo apt install \"%s\"`", path) + installInstructions += fmt.Sprintf(" or run the command `sudo apt install \"%s\"`", pathBase) case "rpm": - installInstructions += fmt.Sprintf(" or run the command `sudo dnf install \"%s\"`", path) + installInstructions += fmt.Sprintf(" or run the command `sudo dnf install \"%s\"`", pathBase) case "msi": - installInstructions += fmt.Sprintf(" or run the command `msiexec /i \"%s\"` as administrator", path) + installInstructions += fmt.Sprintf(" or run the command `msiexec /i \"%s\"` as administrator", pathBase) } fmt.Printf(` From 063c6a349a4d83ab64749ec475fb640793ec4f21 Mon Sep 17 00:00:00 2001 From: dantecatalfamo Date: Mon, 6 Jan 2025 11:35:46 -0500 Subject: [PATCH 3/7] Add changes/ --- changes/25004-fleetctl-packge-cli-instructions | 1 + 1 file changed, 1 insertion(+) create mode 100644 changes/25004-fleetctl-packge-cli-instructions diff --git a/changes/25004-fleetctl-packge-cli-instructions b/changes/25004-fleetctl-packge-cli-instructions new file mode 100644 index 000000000000..6caa7d0d3ee7 --- /dev/null +++ b/changes/25004-fleetctl-packge-cli-instructions @@ -0,0 +1 @@ +- Display command line installation instructions when generating a fleet agent package From c6d97d81526594f547a3231fcdcd827f5314db8d Mon Sep 17 00:00:00 2001 From: dantecatalfamo Date: Mon, 6 Jan 2025 12:21:01 -0500 Subject: [PATCH 4/7] Add device type for specific CLI instructions --- cmd/fleetctl/package.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cmd/fleetctl/package.go b/cmd/fleetctl/package.go index 09f077c4f00e..8c0905622c72 100644 --- a/cmd/fleetctl/package.go +++ b/cmd/fleetctl/package.go @@ -379,24 +379,29 @@ 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 `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, %s. +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, installInstructions) +`, path, deviceType, installInstructions) if !disableOpenFolder { open.Start(filepath.Dir(path)) //nolint:errcheck } From 651427fc94fb4467fdd4f7d77f37cb8c84cac8e1 Mon Sep 17 00:00:00 2001 From: dantecatalfamo Date: Mon, 6 Jan 2025 12:21:30 -0500 Subject: [PATCH 5/7] Move spaces --- cmd/fleetctl/package.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/fleetctl/package.go b/cmd/fleetctl/package.go index 8c0905622c72..b02d33e53115 100644 --- a/cmd/fleetctl/package.go +++ b/cmd/fleetctl/package.go @@ -383,22 +383,22 @@ func packageCommand() *cli.Command { switch c.String("type") { case "pkg": installInstructions += fmt.Sprintf(" or run the command `installer -pkg \"%s\" -target /`", pathBase) - deviceType = " macOS" + deviceType = "macOS" case "deb": installInstructions += fmt.Sprintf(" or run the command `sudo apt install \"%s\"`", pathBase) - deviceType = " Debian-based Linux" + deviceType = "Debian-based Linux" case "rpm": installInstructions += fmt.Sprintf(" or run the command `sudo dnf install \"%s\"`", pathBase) - deviceType = " RPM-based Linux" + deviceType = "RPM-based Linux" case "msi": installInstructions += fmt.Sprintf(" or run the command `msiexec /i \"%s\"` as administrator", pathBase) - deviceType = " Windows" + deviceType = "Windows" } fmt.Printf(` Success! You generated fleetd at %s -To add a new%s device to Fleet, %s. +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, deviceType, installInstructions) From 9fe30d2a1a2482f2f90c0629c75d912cc75f70b1 Mon Sep 17 00:00:00 2001 From: dantecatalfamo Date: Mon, 6 Jan 2025 12:29:26 -0500 Subject: [PATCH 6/7] Use past tense --- changes/25004-fleetctl-packge-cli-instructions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changes/25004-fleetctl-packge-cli-instructions b/changes/25004-fleetctl-packge-cli-instructions index 6caa7d0d3ee7..dc1fa6fa2bee 100644 --- a/changes/25004-fleetctl-packge-cli-instructions +++ b/changes/25004-fleetctl-packge-cli-instructions @@ -1 +1 @@ -- Display command line installation instructions when generating a fleet agent package +- Display command line installation instructions when a package is generated From 3a42af9a6396475cc0881575394cf131f80cd701 Mon Sep 17 00:00:00 2001 From: dantecatalfamo Date: Mon, 6 Jan 2025 12:30:30 -0500 Subject: [PATCH 7/7] macOS package install requires sudo --- cmd/fleetctl/package.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/fleetctl/package.go b/cmd/fleetctl/package.go index b02d33e53115..281cec25e9a5 100644 --- a/cmd/fleetctl/package.go +++ b/cmd/fleetctl/package.go @@ -382,7 +382,7 @@ func packageCommand() *cli.Command { var deviceType string switch c.String("type") { case "pkg": - installInstructions += fmt.Sprintf(" or run the command `installer -pkg \"%s\" -target /`", pathBase) + 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)