fleet/orbit/pkg/update/options.go

99 lines
2.5 KiB
Go
Raw Normal View History

package update
import (
"fmt"
"os"
"os/exec"
"path/filepath"
"github.com/fleetdm/fleet/v4/orbit/pkg/constant"
)
Fleet Desktop MVP (#4530) * WIP * WIP2 * Fix orbit and fleetctl tests * Amend macos-app default * Add some fixes * Use fleetctl updates roots command * Add more fixes to Updater * Fixes to app publishing and downloading * Add more changes to support fleetctl cross generation * Amend comment * Add pkg generation to ease testing * Make more fixes * Add changes entry * Add legacy targets (until our TUF system exposes the new app) * Fix fleetctl preview * Fix bool flag * Fix orbit logic for disabled-updates and dev-mode * Fix TestPreview * Remove constant and fix zip-slip attack (codeql) * Return unknown error * Fix updater's checkExec * Add support for executable signing in init_tuf.sh * Try only signing orbit * Fix init_tuf.sh targets, macos-app only for osqueryd * Specify GOARCH to support M1s * Add workflow to generate osqueryd.app.tar.gz * Use 5.2.2 on init_tuf.sh * Add unit test for tar.gz target * Use artifacts instead of releases * Remove copy paste residue * Fleet Desktop Packaging WIP * Ignore gosec warning * Trigger on PR too * Install Go in workflow * Pass url parameter to desktop app * Fix fleetctl package * Final set of changes for v1 of Fleet Desktop * Add changes * PR fixes * Fix CI build * add larger menu bar icon * Add transparency item * Delete host_device_auth entry on host deletion * Add SetTargetChannel * Update white logo and add desktop to update runner * Add fleet-desktop monitoring to orbit * Define fleet-desktop app exec name * Fix update runner creation * Add API test before enabling the My device menu item Co-authored-by: Zach Wasserman <zach@fleetdm.com>
2022-03-21 17:53:53 +00:00
// DefaultOptions are the default options to use when creating an update
// client.
var DefaultOptions = defaultOptions
var (
DarwinTargets = Targets{
"orbit": TargetInfo{
Platform: "macos",
Channel: "stable",
TargetFile: "orbit",
},
"osqueryd": TargetInfo{
Platform: "macos-app",
Channel: "stable",
TargetFile: "osqueryd.app.tar.gz",
ExtractedExecSubPath: []string{"osquery.app", "Contents", "MacOS", "osqueryd"},
},
}
LinuxTargets = Targets{
"orbit": TargetInfo{
Platform: "linux",
Channel: "stable",
TargetFile: "orbit",
},
"osqueryd": TargetInfo{
Platform: "linux",
Channel: "stable",
TargetFile: "osqueryd",
},
}
WindowsTargets = Targets{
"orbit": TargetInfo{
Platform: "windows",
Channel: "stable",
TargetFile: "orbit.exe",
},
"osqueryd": TargetInfo{
Platform: "windows",
Channel: "stable",
TargetFile: "osqueryd.exe",
},
}
Fleet Desktop MVP (#4530) * WIP * WIP2 * Fix orbit and fleetctl tests * Amend macos-app default * Add some fixes * Use fleetctl updates roots command * Add more fixes to Updater * Fixes to app publishing and downloading * Add more changes to support fleetctl cross generation * Amend comment * Add pkg generation to ease testing * Make more fixes * Add changes entry * Add legacy targets (until our TUF system exposes the new app) * Fix fleetctl preview * Fix bool flag * Fix orbit logic for disabled-updates and dev-mode * Fix TestPreview * Remove constant and fix zip-slip attack (codeql) * Return unknown error * Fix updater's checkExec * Add support for executable signing in init_tuf.sh * Try only signing orbit * Fix init_tuf.sh targets, macos-app only for osqueryd * Specify GOARCH to support M1s * Add workflow to generate osqueryd.app.tar.gz * Use 5.2.2 on init_tuf.sh * Add unit test for tar.gz target * Use artifacts instead of releases * Remove copy paste residue * Fleet Desktop Packaging WIP * Ignore gosec warning * Trigger on PR too * Install Go in workflow * Pass url parameter to desktop app * Fix fleetctl package * Final set of changes for v1 of Fleet Desktop * Add changes * PR fixes * Fix CI build * add larger menu bar icon * Add transparency item * Delete host_device_auth entry on host deletion * Add SetTargetChannel * Update white logo and add desktop to update runner * Add fleet-desktop monitoring to orbit * Define fleet-desktop app exec name * Fix update runner creation * Add API test before enabling the My device menu item Co-authored-by: Zach Wasserman <zach@fleetdm.com>
2022-03-21 17:53:53 +00:00
DesktopMacOSTarget = TargetInfo{
Platform: "macos",
Channel: "stable",
TargetFile: "desktop.app.tar.gz",
ExtractedExecSubPath: []string{"Fleet Desktop.app", "Contents", "MacOS", constant.DesktopAppExecName},
}
DesktopWindowsTarget = TargetInfo{
Platform: "windows",
Channel: "stable",
TargetFile: constant.DesktopAppExecName + ".exe",
}
DesktopLinuxTarget = TargetInfo{
Platform: "linux",
Channel: "stable",
TargetFile: "desktop.tar.gz",
ExtractedExecSubPath: []string{"fleet-desktop", constant.DesktopAppExecName},
CustomCheckExec: func(execPath string) error {
cmd := exec.Command(execPath, "--help")
cmd.Env = append(cmd.Env, fmt.Sprintf("LD_LIBRARY_PATH=%s:%s", filepath.Dir(execPath), os.ExpandEnv("$LD_LIBRARY_PATH")))
if out, err := cmd.CombinedOutput(); err != nil {
return fmt.Errorf("exec new version: %s: %w", string(out), err)
}
return nil
},
}
NudgeMacOSTarget = TargetInfo{
Platform: "macos",
Channel: "stable",
TargetFile: "nudge.app.tar.gz",
ExtractedExecSubPath: []string{"Nudge.app", "Contents", "MacOS", "Nudge"},
}
SwiftDialogMacOSTarget = TargetInfo{
Platform: "macos",
Channel: "stable",
TargetFile: "swiftDialog.app.tar.gz",
ExtractedExecSubPath: []string{"Dialog.app", "Contents", "MacOS", "Dialog"},
}
)