Skip to content

Commit

Permalink
Remove unused function
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksmaus committed Apr 18, 2024
1 parent cbf2753 commit d1bc83d
Showing 1 changed file with 0 additions and 53 deletions.
53 changes: 0 additions & 53 deletions x-pack/osquerybeat/magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ package main

import (
"context"
"errors"
"fmt"
"os"
"path/filepath"
Expand Down Expand Up @@ -107,58 +106,6 @@ func execCommand(ctx context.Context, name string, args ...string) error {
return err
}

func extractFromMSI() error {
if os.Getenv("GOOS") != "windows" {
return nil
}

ctx := context.Background()

osArchs := osquerybeat.OSArchs(devtools.Platforms)

for _, osarch := range osArchs {
if osarch.OS != "windows" {
continue
}
spec, err := distro.GetSpec(osarch)
if err != nil {
if errors.Is(err, distro.ErrUnsupportedOS) {
continue
} else {
return err
}
}
dip := distro.GetDataInstallDir(osarch)
msiFile := spec.DistroFilepath(dip)

// MSI extract
err = execCommand(ctx, "msiextract", "--directory", dip, msiFile)
if err != nil {
return err
}

fmt.Println("copy certs.pem from MSI")
err = devtools.Copy(filepath.Join(dip, distro.OsquerydCertsWindowsDistroPath()), distro.OsquerydCertsPath(dip))
if err != nil {
return err
}

fmt.Println("copy osqueryd.exe from MSI")
dp := distro.OsquerydPathForOS(osarch.OS, dip)
err = devtools.Copy(filepath.Join(dip, "osquery", "osqueryd", "osqueryd.exe"), dp)
if err != nil {
fmt.Println("copy osqueryd.exe from MSI failed: ", err)
return err
}
// Chmod set to the same as other executables in the final package
if err = os.Chmod(dp, 0755); err != nil {
return err
}
}

return nil
}

// stripLinuxOsqueryd Strips osqueryd binary, that is not stripped in linux tar.gz distro
func stripLinuxOsqueryd() error {
if os.Getenv("GOOS") != "linux" {
Expand Down

0 comments on commit d1bc83d

Please sign in to comment.