Add support for Linux ARM64 (#19931)

#1845

Co-authored-by: Lucas Manuel Rodriguez <lucas@fleetdm.com>
Co-authored-by: Roberto Dip <rroperzh@gmail.com>
This commit is contained in:
Dante Catalfamo
2024-07-17 16:07:59 -04:00
committed by GitHub
co-authored by Lucas Manuel Rodriguez Roberto Dip
parent d20ccd65d7
commit ecf2346ace
27 changed files with 424 additions and 38 deletions
+20
View File
@@ -38,6 +38,12 @@ func packageCommand() *cli.Command {
Usage: "Type of package to build",
Required: true,
},
&cli.StringFlag{
Name: "arch",
Usage: "Target CPU Architecture for the installer package (Only supported with '--type' deb or rpm)",
Destination: &opt.Architecture,
Value: "amd64",
},
&cli.StringFlag{
Name: "enroll-secret",
Usage: "Enroll secret for authenticating to Fleet server",
@@ -331,6 +337,20 @@ func packageCommand() *cli.Command {
return errors.New("--use-system-configuration is only available for pkg installers")
}
linuxPackage := false
switch c.String("type") {
case "deb", "rpm":
linuxPackage = true
}
if opt.Architecture != packaging.ArchAmd64 && !linuxPackage {
return fmt.Errorf("can't use '--arch' with '--type %s'", c.String("type"))
}
if opt.Architecture != packaging.ArchAmd64 && opt.Architecture != packaging.ArchArm64 {
return errors.New("arch must be one of ('amd64', 'arm64')")
}
var buildFunc func(packaging.Options) (string, error)
switch c.String("type") {
case "pkg":