diff --git a/auditbeat/scripts/mage/package.go b/auditbeat/scripts/mage/package.go index 09591705121..94b2a7cde6d 100644 --- a/auditbeat/scripts/mage/package.go +++ b/auditbeat/scripts/mage/package.go @@ -90,7 +90,7 @@ func CustomizePackaging(pkgFlavor PackagingFlavor) { case devtools.TarGz, devtools.Zip: args.Spec.ReplaceFile("{{.BeatName}}.yml", shortConfig) args.Spec.ReplaceFile("{{.BeatName}}.reference.yml", referenceConfig) - case devtools.Deb, devtools.RPM, devtools.DMG: + case devtools.Deb, devtools.RPM: args.Spec.ReplaceFile("/etc/{{.BeatName}}/{{.BeatName}}.yml", shortConfig) args.Spec.ReplaceFile("/etc/{{.BeatName}}/{{.BeatName}}.reference.yml", referenceConfig) sampleRulesTarget = "/etc/{{.BeatName}}/" + defaultSampleRulesTarget diff --git a/dev-tools/mage/dmgbuilder.go b/dev-tools/mage/dmgbuilder.go deleted file mode 100644 index 47a1125a5a6..00000000000 --- a/dev-tools/mage/dmgbuilder.go +++ /dev/null @@ -1,295 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -package mage - -import ( - "os" - "os/exec" - "path/filepath" - "strings" - - "github.com/magefile/mage/mg" - "github.com/magefile/mage/sh" - "github.com/pkg/errors" -) - -type dmgBuilder struct { - PackageSpec - - SigningInfo *AppleSigningInfo - Identifier string - PreferencePaneDir string - PreferencePanePkgFile string - InternalBeatPkg string - BeatPkg string - - beatsDir string - dmgDir string - - // Build tools. - pkgbuild func(args ...string) error - productbuild func(args ...string) error - spctl func(args ...string) error - codesign func(args ...string) error - hdiutil func(args ...string) error -} - -func newDMGBuilder(spec PackageSpec) (*dmgBuilder, error) { - for _, cmd := range []string{"pkgbuild", "productbuild", "spctl", "codesign", "hdiutil"} { - if _, err := exec.LookPath(cmd); err != nil { - return nil, errors.Wrapf(err, "required tool '%v' for DMG packaging not found on PATH", cmd) - } - } - - beatsDir, err := ElasticBeatsDir() - if err != nil { - return nil, err - } - - preferencePaneDir := filepath.Join(beatsDir, "dev-tools/packaging/preference-pane") - preferencePanePkgFile := filepath.Join(preferencePaneDir, "build/BeatsPrefPane.pkg") - beatIdentifier, ok := spec.evalContext["identifier"].(string) - if !ok { - return nil, errors.Errorf("identifier not specified for DMG packaging") - } - - spec.OutputFile, err = spec.Expand(defaultBinaryName) - if err != nil { - return nil, err - } - - info, err := GetAppleSigningInfo() - if err != nil { - return nil, err - } - - return &dmgBuilder{ - PackageSpec: spec, - SigningInfo: info, - Identifier: beatIdentifier, - PreferencePaneDir: preferencePaneDir, - PreferencePanePkgFile: preferencePanePkgFile, - - beatsDir: beatsDir, - dmgDir: filepath.Join(spec.packageDir, "dmg"), - - pkgbuild: sh.RunCmd("pkgbuild"), - productbuild: sh.RunCmd("productbuild"), - spctl: sh.RunCmd("spctl", "-a", "-t"), - codesign: sh.RunCmd("codesign"), - hdiutil: sh.RunCmd("hdiutil"), - }, nil -} - -// Create .pkg for preference pane. -func (b *dmgBuilder) buildPreferencePane() error { - return errors.Wrap(Mage(b.PreferencePaneDir), "failed to build Beats preference pane") -} - -func (b *dmgBuilder) buildBeatPkg() error { - beatPkgRoot := filepath.Join(b.packageDir, "beat-pkg-root") - if err := os.RemoveAll(beatPkgRoot); err != nil { - return errors.Wrap(err, "failed to clean beat-pkg-root") - } - - // Copy files into the packaging root and set their mode. - for _, f := range b.Files { - if f.Symlink { - // not supported, handling symlink in post/pre install scripts - continue - } - - target := filepath.Join(beatPkgRoot, f.Target) - if err := Copy(f.Source, target); err != nil { - if f.SkipOnMissing && errors.Is(err, os.ErrNotExist) { - continue - } - return err - } - - info, err := os.Stat(target) - if err != nil { - return err - } - - if info.Mode().IsRegular() && info.Mode().Perm() != f.Mode { - if err = os.Chmod(target, f.Mode); err != nil { - return err - } - } - } - - b.InternalBeatPkg = filepath.Join(b.packageDir, "pkgs", "internal-"+b.OutputFile+".pkg") - - args := []string{ - "--root", beatPkgRoot, - "--scripts", filepath.Join(b.packageDir, "scripts"), - "--identifier", b.Identifier, - "--version", b.MustExpand("{{.Version}}{{if .Snapshot}}-SNAPSHOT{{end}}"), - } - if b.SigningInfo.Sign { - args = append(args, "--sign", b.SigningInfo.Installer.ID, "--timestamp") - } - args = append(args, createDir(b.InternalBeatPkg)) - if err := b.pkgbuild(args...); err != nil { - return err - } - - return nil -} - -func (b *dmgBuilder) buildProductPkg() error { - var ( - distributionPlist = filepath.Join(b.packageDir, "distributions.plist") - resourcesDir = filepath.Join(b.packageDir, "resources") - ) - - b.MustExpandFile( - filepath.Join(b.beatsDir, "dev-tools/packaging/templates/darwin/distribution.plist.tmpl"), - distributionPlist) - b.MustExpandFile( - filepath.Join(b.beatsDir, "dev-tools/packaging/templates/darwin/README.html.tmpl"), - filepath.Join(resourcesDir, "README.html")) - for t, pf := range b.Files { - if strings.HasSuffix(t, "LICENSE.txt") { - Copy(pf.Source, filepath.Join(resourcesDir, "LICENSE.txt")) - break - } - } - b.MustExpandFile( - filepath.Join(b.beatsDir, "dev-tools/packaging/templates/darwin/README.html.tmpl"), - filepath.Join(resourcesDir, "README.html")) - - if err := os.RemoveAll(b.dmgDir); err != nil { - return err - } - b.BeatPkg = filepath.Join(b.dmgDir, b.OutputFile+".pkg") - - // Create .pkg containing the previous two .pkg files. - args := []string{ - "--distribution", distributionPlist, - "--resources", resourcesDir, - "--package-path", filepath.Dir(b.InternalBeatPkg), - "--package-path", filepath.Dir(b.PreferencePanePkgFile), - "--component-compression", "auto", - } - if b.SigningInfo.Sign { - args = append(args, "--sign", b.SigningInfo.Installer.ID, "--timestamp") - } - args = append(args, createDir(b.BeatPkg)) - if err := b.productbuild(args...); err != nil { - return err - } - - if b.SigningInfo.Sign { - if err := b.spctl("install", b.BeatPkg); err != nil { - return err - } - } - - return nil -} - -func (b *dmgBuilder) buildUninstallApp() error { - const ( - uninstallerIcons = "Uninstall.app/Contents/Resources/uninstaller.icns" - uninstallScript = "Uninstall.app/Contents/MacOS/uninstall.sh" - infoPlist = "Uninstall.app/Contents/Info.plist" - ) - - inputDir := filepath.Join(b.beatsDir, "dev-tools/packaging/templates/darwin/dmg") - - Copy( - filepath.Join(inputDir, uninstallerIcons), - filepath.Join(b.dmgDir, uninstallerIcons), - ) - b.MustExpandFile( - filepath.Join(inputDir, infoPlist+".tmpl"), - filepath.Join(b.dmgDir, infoPlist), - ) - b.MustExpandFile( - filepath.Join(inputDir, uninstallScript+".tmpl"), - filepath.Join(b.dmgDir, uninstallScript), - ) - if err := os.Chmod(filepath.Join(b.dmgDir, uninstallScript), 0755); err != nil { - return err - } - - if b.SigningInfo.Sign { - uninstallApp := filepath.Join(b.dmgDir, "Uninstall.app") - if err := b.codesign("-s", b.SigningInfo.App.ID, "--timestamp", uninstallApp); err != nil { - return err - } - - if err := b.spctl("exec", uninstallApp); err != nil { - return err - } - } - - return nil -} - -// Create a .dmg file containing both the Uninstall.app and .pkg file. -func (b *dmgBuilder) buildDMG() error { - dmgFile := filepath.Join(distributionsDir, DMG.AddFileExtension(b.OutputFile)) - - args := []string{ - "create", - "-volname", b.MustExpand("{{.BeatName | title}} {{.Version}}{{if .Snapshot}}-SNAPSHOT{{end}}"), - "-srcfolder", b.dmgDir, - "-size", "500m", // allowing extra space - "-ov", - createDir(dmgFile), - } - if err := b.hdiutil(args...); err != nil { - return err - } - - // Sign the .dmg. - if b.SigningInfo.Sign { - if err := b.codesign("-s", b.SigningInfo.App.ID, "--timestamp", dmgFile); err != nil { - return err - } - - if err := b.spctl("install", dmgFile); err != nil { - return err - } - } - - return errors.Wrap(CreateSHA512File(dmgFile), "failed to create .sha512 file") -} - -func (b *dmgBuilder) Build() error { - // Mark this function as a dep so that is is only invoked once. - mg.Deps(b.buildPreferencePane) - - var err error - if err = b.buildBeatPkg(); err != nil { - return errors.Wrap(err, "failed to build internal beat pkg") - } - if err = b.buildProductPkg(); err != nil { - return errors.Wrap(err, "failed to build beat product pkg (pref pane + beat)") - } - if err = b.buildUninstallApp(); err != nil { - return errors.Wrap(err, "failed to build Uninstall.app") - } - if err = b.buildDMG(); err != nil { - return errors.Wrap(err, "failed to build beat dmg") - } - return nil -} diff --git a/dev-tools/mage/kibana.go b/dev-tools/mage/kibana.go index 4f58b9ffbb5..dbb0a0ddbfd 100644 --- a/dev-tools/mage/kibana.go +++ b/dev-tools/mage/kibana.go @@ -79,8 +79,6 @@ func PackageKibanaDashboardsFromBuildDir() { pkgArgs.Spec.ReplaceFile("kibana", kibanaDashboards) case Deb, RPM: pkgArgs.Spec.ReplaceFile("/usr/share/{{.BeatName}}/kibana", kibanaDashboards) - case DMG: - pkgArgs.Spec.ReplaceFile("/Library/Application Support/{{.BeatVendor}}/{{.BeatName}}/kibana", kibanaDashboards) default: panic(errors.Errorf("unhandled package type: %v", pkgType)) } diff --git a/dev-tools/mage/pkg.go b/dev-tools/mage/pkg.go index f4381291cfe..77f964a39b9 100644 --- a/dev-tools/mage/pkg.go +++ b/dev-tools/mage/pkg.go @@ -56,11 +56,6 @@ func Package() error { continue } - if pkgType == DMG && runtime.GOOS != "darwin" { - log.Printf("Skipping DMG package type because build host isn't darwin") - continue - } - if target.Name == "linux/arm64" && pkgType == Docker && runtime.GOARCH != "arm64" { log.Printf("Skipping Docker package type because build host isn't arm") continue diff --git a/dev-tools/mage/pkgtypes.go b/dev-tools/mage/pkgtypes.go index 1fc5fe79e50..fb87255221d 100644 --- a/dev-tools/mage/pkgtypes.go +++ b/dev-tools/mage/pkgtypes.go @@ -60,7 +60,6 @@ const ( Deb Zip TarGz - DMG Docker ) @@ -125,10 +124,6 @@ var OSArchNames = map[string]map[PackageType]map[string]string{ "386": "x86", "amd64": "x86_64", }, - DMG: map[string]string{ - "386": "x86", - "amd64": "x86_64", - }, }, "linux": map[PackageType]map[string]string{ RPM: map[string]string{ @@ -217,8 +212,6 @@ func (typ PackageType) String() string { return "zip" case TarGz: return "tar.gz" - case DMG: - return "dmg" case Docker: return "docker" default: @@ -242,8 +235,6 @@ func (typ *PackageType) UnmarshalText(text []byte) error { *typ = TarGz case "zip": *typ = Zip - case "dmg": - *typ = DMG case "docker": *typ = Docker default: @@ -289,8 +280,6 @@ func (typ PackageType) Build(spec PackageSpec) error { return PackageZip(spec) case TarGz: return PackageTarGz(spec) - case DMG: - return PackageDMG(spec) case Docker: return PackageDocker(spec) default: @@ -973,21 +962,6 @@ func addSymlinkToTar(tmpdir string, ar *tar.Writer, baseDir string, pkgFile Pack }) } -// PackageDMG packages the Beat into a .dmg file containing an installer pkg -// and uninstaller app. -func PackageDMG(spec PackageSpec) error { - if runtime.GOOS != "darwin" { - return errors.New("packaging a dmg requires darwin") - } - - b, err := newDMGBuilder(spec) - if err != nil { - return err - } - - return b.Build() -} - // PackageDocker packages the Beat into a docker image. func PackageDocker(spec PackageSpec) error { if err := HaveDocker(); err != nil { diff --git a/dev-tools/packaging/packages.yml b/dev-tools/packaging/packages.yml index 9221f1ac0c0..e062db1e1bb 100644 --- a/dev-tools/packaging/packages.yml +++ b/dev-tools/packaging/packages.yml @@ -782,13 +782,6 @@ specs: <<: *apache_license_for_binaries name: '{{.BeatName}}-oss' - - os: darwin - types: [dmg] - spec: - <<: *macos_beat_pkg_spec - <<: *apache_license_for_macos_pkg - name: '{{.BeatName}}-oss' - - os: linux types: [tgz] spec: @@ -835,12 +828,6 @@ specs: <<: *binary_spec <<: *elastic_license_for_binaries - - os: darwin - types: [dmg] - spec: - <<: *macos_beat_pkg_spec - <<: *elastic_license_for_macos_pkg - - os: linux types: [tgz] spec: @@ -945,16 +932,6 @@ specs: '{{.BeatName}}{{.BinaryExt}}': source: ./{{.XPackDir}}/{{.BeatName}}/build/golang-crossbuild/{{.BeatName}}-{{.GOOS}}-{{.Platform.Arch}}{{.BinaryExt}} - - os: darwin - types: [dmg] - spec: - <<: *macos_beat_pkg_spec - <<: *elastic_license_for_macos_pkg - files: - /Library/Application Support/{{.BeatVendor}}/{{.BeatName}}/bin/{{.BeatName}}{{.BinaryExt}}: - mode: 0755 - source: ../x-pack/{{.BeatName}}/build/golang-crossbuild/{{.BeatName}}-{{.GOOS}}-{{.Platform.Arch}}{{.BinaryExt}} - - os: linux types: [tgz] spec: @@ -1053,17 +1030,6 @@ specs: symlink: true mode: 0755 - - os: darwin - types: [dmg] - spec: - <<: *macos_agent_pkg_spec - <<: *elastic_license_for_macos_pkg - files: - /Library/Application Support/{{.BeatVendor}}/{{.BeatName}}/bin/{{.BeatName}}{{.BinaryExt}}: - mode: 0755 - source: /etc/{{.BeatName}}/data/{{.BeatName}}-{{ commit_short }}/{{.BeatName}}{{.BinaryExt}} - symlink: true - - os: linux types: [tgz] spec: diff --git a/dev-tools/packaging/preference-pane/.gitignore b/dev-tools/packaging/preference-pane/.gitignore deleted file mode 100644 index 567609b1234..00000000000 --- a/dev-tools/packaging/preference-pane/.gitignore +++ /dev/null @@ -1 +0,0 @@ -build/ diff --git a/dev-tools/packaging/preference-pane/beats-preference-pane.xcodeproj/project.pbxproj b/dev-tools/packaging/preference-pane/beats-preference-pane.xcodeproj/project.pbxproj deleted file mode 100644 index 0f46547b728..00000000000 --- a/dev-tools/packaging/preference-pane/beats-preference-pane.xcodeproj/project.pbxproj +++ /dev/null @@ -1,523 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 48; - objects = { - -/* Begin PBXBuildFile section */ - 3A0F656C205D5AE9009DBAE7 /* setboot.m in Sources */ = {isa = PBXBuildFile; fileRef = 3A0F656B205D5AE9009DBAE7 /* setboot.m */; }; - 3A34B24E203B1F480079E62C /* Beats.h in Headers */ = {isa = PBXBuildFile; fileRef = 3A34B24C203B1F480079E62C /* Beats.h */; }; - 3A34B251203B239F0079E62C /* Beats.icns in Resources */ = {isa = PBXBuildFile; fileRef = 3A34B250203B239F0079E62C /* Beats.icns */; }; - 3A6BA0642062CEAA00A05921 /* config.h in Headers */ = {isa = PBXBuildFile; fileRef = 3A6BA0632062CEAA00A05921 /* config.h */; }; - 3A6F9AB6202C939D0046F40E /* BeatsPrefPane.h in Headers */ = {isa = PBXBuildFile; fileRef = 3A6F9AB5202C939D0046F40E /* BeatsPrefPane.h */; }; - 3A6F9AB8202C939D0046F40E /* BeatsPrefPane.m in Sources */ = {isa = PBXBuildFile; fileRef = 3A6F9AB7202C939D0046F40E /* BeatsPrefPane.m */; }; - 3A6F9ABD202C939D0046F40E /* BeatsPrefPane.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3A6F9ABB202C939D0046F40E /* BeatsPrefPane.xib */; }; - 3A8FA06D20626DEF0091102D /* common.m in Sources */ = {isa = PBXBuildFile; fileRef = 3AC0A94420626C7B00741C93 /* common.m */; }; - 3A915924205EB4F4007DE746 /* EditorWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = 3A915921205EB4F4007DE746 /* EditorWindow.h */; }; - 3A915925205EB4F4007DE746 /* EditorWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 3A915922205EB4F4007DE746 /* EditorWindow.m */; }; - 3A915926205EB4F4007DE746 /* Base.lproj/EditorWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3A915923205EB4F4007DE746 /* Base.lproj/EditorWindow.xib */; }; - 3AA415CE2051B206008915AA /* BeatsService.h in Headers */ = {isa = PBXBuildFile; fileRef = 3AA415CC2051B206008915AA /* BeatsService.h */; }; - 3AA415CF2051B206008915AA /* BeatsService.m in Sources */ = {isa = PBXBuildFile; fileRef = 3AA415CD2051B206008915AA /* BeatsService.m */; }; - 3AA415DD20582B34008915AA /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 3AA415DC20582B34008915AA /* main.m */; }; - 3AA415E4205833A3008915AA /* helper in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3AA415DA20582B34008915AA /* helper */; }; - 3AC0A94620626C7C00741C93 /* common.m in Sources */ = {isa = PBXBuildFile; fileRef = 3AC0A94420626C7B00741C93 /* common.m */; }; - 3AD0D414203CE40800338653 /* BeatViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 3AD0D411203CE40800338653 /* BeatViewController.h */; }; - 3AD0D415203CE40800338653 /* BeatViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3AD0D412203CE40800338653 /* BeatViewController.m */; }; - 3AD0D419203CECDA00338653 /* TabViewDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 3AD0D417203CECDA00338653 /* TabViewDelegate.h */; }; - 3AD0D41A203CECDA00338653 /* TabViewDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 3AD0D418203CECDA00338653 /* TabViewDelegate.m */; }; - 3AD0D420203D791100338653 /* Base.lproj/BeatView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3AD0D41F203D791100338653 /* Base.lproj/BeatView.xib */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - 3A0F6569205BE29D009DBAE7 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 3A6F9AA9202C939D0046F40E /* Project object */; - proxyType = 1; - remoteGlobalIDString = 3AA415D920582B34008915AA; - remoteInfo = helper; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 3AA415D820582B34008915AA /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 12; - dstPath = ""; - dstSubfolderSpec = 6; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 3AA415E32058339A008915AA /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 6; - files = ( - 3AA415E4205833A3008915AA /* helper in CopyFiles */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 3A0F656B205D5AE9009DBAE7 /* setboot.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = setboot.m; sourceTree = ""; }; - 3A34B24C203B1F480079E62C /* Beats.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Beats.h; sourceTree = ""; }; - 3A34B250203B239F0079E62C /* Beats.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = Beats.icns; sourceTree = ""; }; - 3A6BA0632062CEAA00A05921 /* config.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = config.h; sourceTree = ""; }; - 3A6F9AB2202C939D0046F40E /* Beats.prefPane */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Beats.prefPane; sourceTree = BUILT_PRODUCTS_DIR; }; - 3A6F9AB5202C939D0046F40E /* BeatsPrefPane.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BeatsPrefPane.h; sourceTree = ""; }; - 3A6F9AB7202C939D0046F40E /* BeatsPrefPane.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BeatsPrefPane.m; sourceTree = ""; }; - 3A6F9ABC202C939D0046F40E /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/BeatsPrefPane.xib; sourceTree = ""; }; - 3A6F9ABE202C939D0046F40E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 3A915921205EB4F4007DE746 /* EditorWindow.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = EditorWindow.h; sourceTree = ""; }; - 3A915922205EB4F4007DE746 /* EditorWindow.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = EditorWindow.m; sourceTree = ""; }; - 3A915923205EB4F4007DE746 /* Base.lproj/EditorWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = Base.lproj/EditorWindow.xib; sourceTree = ""; }; - 3AA415CC2051B206008915AA /* BeatsService.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BeatsService.h; sourceTree = ""; }; - 3AA415CD2051B206008915AA /* BeatsService.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BeatsService.m; sourceTree = ""; }; - 3AA415D520572B5A008915AA /* Authorization.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Authorization.h; sourceTree = ""; }; - 3AA415DA20582B34008915AA /* helper */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = helper; sourceTree = BUILT_PRODUCTS_DIR; }; - 3AA415DC20582B34008915AA /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; - 3AC0A94420626C7B00741C93 /* common.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = common.m; sourceTree = ""; }; - 3AC0A94520626C7C00741C93 /* common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = common.h; sourceTree = ""; }; - 3AD0D411203CE40800338653 /* BeatViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BeatViewController.h; sourceTree = ""; }; - 3AD0D412203CE40800338653 /* BeatViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BeatViewController.m; sourceTree = ""; }; - 3AD0D417203CECDA00338653 /* TabViewDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TabViewDelegate.h; sourceTree = ""; }; - 3AD0D418203CECDA00338653 /* TabViewDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TabViewDelegate.m; sourceTree = ""; }; - 3AD0D41F203D791100338653 /* Base.lproj/BeatView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = Base.lproj/BeatView.xib; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 3A6F9AAE202C939D0046F40E /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 3AA415D720582B34008915AA /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 3A6F9AA8202C939D0046F40E = { - isa = PBXGroup; - children = ( - 3A6F9AB4202C939D0046F40E /* beats-preference-pane */, - 3AA415DB20582B34008915AA /* helper */, - 3A6F9AB3202C939D0046F40E /* Products */, - ); - sourceTree = ""; - }; - 3A6F9AB3202C939D0046F40E /* Products */ = { - isa = PBXGroup; - children = ( - 3A6F9AB2202C939D0046F40E /* Beats.prefPane */, - 3AA415DA20582B34008915AA /* helper */, - ); - name = Products; - sourceTree = ""; - }; - 3A6F9AB4202C939D0046F40E /* beats-preference-pane */ = { - isa = PBXGroup; - children = ( - 3AC0A94320626C6B00741C93 /* common */, - 3AA415C9205159E1008915AA /* beats */, - 3AD0D41F203D791100338653 /* Base.lproj/BeatView.xib */, - 3A34B250203B239F0079E62C /* Beats.icns */, - 3A6F9AB5202C939D0046F40E /* BeatsPrefPane.h */, - 3A6F9AB7202C939D0046F40E /* BeatsPrefPane.m */, - 3A6F9ABB202C939D0046F40E /* BeatsPrefPane.xib */, - 3A6F9ABE202C939D0046F40E /* Info.plist */, - 3AD0D411203CE40800338653 /* BeatViewController.h */, - 3AD0D412203CE40800338653 /* BeatViewController.m */, - 3AD0D417203CECDA00338653 /* TabViewDelegate.h */, - 3AD0D418203CECDA00338653 /* TabViewDelegate.m */, - 3AA415D520572B5A008915AA /* Authorization.h */, - 3A915921205EB4F4007DE746 /* EditorWindow.h */, - 3A915922205EB4F4007DE746 /* EditorWindow.m */, - 3A915923205EB4F4007DE746 /* Base.lproj/EditorWindow.xib */, - 3A6BA0632062CEAA00A05921 /* config.h */, - ); - path = "beats-preference-pane"; - sourceTree = ""; - }; - 3AA415C9205159E1008915AA /* beats */ = { - isa = PBXGroup; - children = ( - 3A34B24C203B1F480079E62C /* Beats.h */, - 3AA415CC2051B206008915AA /* BeatsService.h */, - 3AA415CD2051B206008915AA /* BeatsService.m */, - ); - path = beats; - sourceTree = ""; - }; - 3AA415DB20582B34008915AA /* helper */ = { - isa = PBXGroup; - children = ( - 3AA415DC20582B34008915AA /* main.m */, - 3A0F656B205D5AE9009DBAE7 /* setboot.m */, - ); - path = helper; - sourceTree = ""; - }; - 3AC0A94320626C6B00741C93 /* common */ = { - isa = PBXGroup; - children = ( - 3AC0A94520626C7C00741C93 /* common.h */, - 3AC0A94420626C7B00741C93 /* common.m */, - ); - path = common; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - 3A6F9AAF202C939D0046F40E /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 3AD0D414203CE40800338653 /* BeatViewController.h in Headers */, - 3A34B24E203B1F480079E62C /* Beats.h in Headers */, - 3AA415CE2051B206008915AA /* BeatsService.h in Headers */, - 3A6BA0642062CEAA00A05921 /* config.h in Headers */, - 3A915924205EB4F4007DE746 /* EditorWindow.h in Headers */, - 3A6F9AB6202C939D0046F40E /* BeatsPrefPane.h in Headers */, - 3AD0D419203CECDA00338653 /* TabViewDelegate.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - 3A6F9AB1202C939D0046F40E /* Beats */ = { - isa = PBXNativeTarget; - buildConfigurationList = 3A6F9AC1202C939D0046F40E /* Build configuration list for PBXNativeTarget "Beats" */; - buildPhases = ( - 3A6F9AAD202C939D0046F40E /* Sources */, - 3A6F9AAE202C939D0046F40E /* Frameworks */, - 3A6F9AAF202C939D0046F40E /* Headers */, - 3A6F9AB0202C939D0046F40E /* Resources */, - 3AA415E32058339A008915AA /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - 3A0F656A205BE29D009DBAE7 /* PBXTargetDependency */, - ); - name = Beats; - productName = "beats-preference-pane"; - productReference = 3A6F9AB2202C939D0046F40E /* Beats.prefPane */; - productType = "com.apple.product-type.bundle"; - }; - 3AA415D920582B34008915AA /* helper */ = { - isa = PBXNativeTarget; - buildConfigurationList = 3AA415DE20582B34008915AA /* Build configuration list for PBXNativeTarget "helper" */; - buildPhases = ( - 3AA415D620582B34008915AA /* Sources */, - 3AA415D720582B34008915AA /* Frameworks */, - 3AA415D820582B34008915AA /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = helper; - productName = "launchctl-helper"; - productReference = 3AA415DA20582B34008915AA /* helper */; - productType = "com.apple.product-type.tool"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 3A6F9AA9202C939D0046F40E /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0920; - ORGANIZATIONNAME = Elastic; - TargetAttributes = { - 3A6F9AB1202C939D0046F40E = { - CreatedOnToolsVersion = 9.2; - ProvisioningStyle = Automatic; - }; - 3AA415D920582B34008915AA = { - CreatedOnToolsVersion = 9.2; - ProvisioningStyle = Automatic; - }; - }; - }; - buildConfigurationList = 3A6F9AAC202C939D0046F40E /* Build configuration list for PBXProject "beats-preference-pane" */; - compatibilityVersion = "Xcode 8.0"; - developmentRegion = en; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = 3A6F9AA8202C939D0046F40E; - productRefGroup = 3A6F9AB3202C939D0046F40E /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 3AA415D920582B34008915AA /* helper */, - 3A6F9AB1202C939D0046F40E /* Beats */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 3A6F9AB0202C939D0046F40E /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 3A915926205EB4F4007DE746 /* Base.lproj/EditorWindow.xib in Resources */, - 3A34B251203B239F0079E62C /* Beats.icns in Resources */, - 3AD0D420203D791100338653 /* Base.lproj/BeatView.xib in Resources */, - 3A6F9ABD202C939D0046F40E /* BeatsPrefPane.xib in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 3A6F9AAD202C939D0046F40E /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 3A8FA06D20626DEF0091102D /* common.m in Sources */, - 3A915925205EB4F4007DE746 /* EditorWindow.m in Sources */, - 3AD0D41A203CECDA00338653 /* TabViewDelegate.m in Sources */, - 3A6F9AB8202C939D0046F40E /* BeatsPrefPane.m in Sources */, - 3AA415CF2051B206008915AA /* BeatsService.m in Sources */, - 3AD0D415203CE40800338653 /* BeatViewController.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 3AA415D620582B34008915AA /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 3A0F656C205D5AE9009DBAE7 /* setboot.m in Sources */, - 3AA415DD20582B34008915AA /* main.m in Sources */, - 3AC0A94620626C7C00741C93 /* common.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - 3A0F656A205BE29D009DBAE7 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 3AA415D920582B34008915AA /* helper */; - targetProxy = 3A0F6569205BE29D009DBAE7 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin PBXVariantGroup section */ - 3A6F9ABB202C939D0046F40E /* BeatsPrefPane.xib */ = { - isa = PBXVariantGroup; - children = ( - 3A6F9ABC202C939D0046F40E /* Base */, - ); - name = BeatsPrefPane.xib; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - 3A6F9ABF202C939D0046F40E /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "Mac Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.12; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = macosx; - }; - name = Debug; - }; - 3A6F9AC0202C939D0046F40E /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "Mac Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.12; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = macosx; - }; - name = Release; - }; - 3A6F9AC2202C939D0046F40E /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_STYLE = Automatic; - COMBINE_HIDPI_IMAGES = YES; - DEVELOPMENT_TEAM = UZ3M9EEN74; - INFOPLIST_FILE = "beats-preference-pane/Info.plist"; - INSTALL_PATH = "$(HOME)/Library/PreferencePanes"; - PRODUCT_BUNDLE_IDENTIFIER = "co.elastic.beats-preference-pane"; - PRODUCT_NAME = "$(TARGET_NAME)"; - WRAPPER_EXTENSION = prefPane; - }; - name = Debug; - }; - 3A6F9AC3202C939D0046F40E /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_STYLE = Automatic; - COMBINE_HIDPI_IMAGES = YES; - DEVELOPMENT_TEAM = UZ3M9EEN74; - INFOPLIST_FILE = "beats-preference-pane/Info.plist"; - INSTALL_PATH = "$(HOME)/Library/PreferencePanes"; - PRODUCT_BUNDLE_IDENTIFIER = "co.elastic.beats-preference-pane"; - PRODUCT_NAME = "$(TARGET_NAME)"; - WRAPPER_EXTENSION = prefPane; - }; - name = Release; - }; - 3AA415DF20582B34008915AA /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_IDENTITY = "Mac Developer"; - CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = UZ3M9EEN74; - INSTALL_PATH = ""; - PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = ""; - }; - name = Debug; - }; - 3AA415E020582B34008915AA /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_IDENTITY = "Mac Developer"; - CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = UZ3M9EEN74; - INSTALL_PATH = ""; - PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = ""; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 3A6F9AAC202C939D0046F40E /* Build configuration list for PBXProject "beats-preference-pane" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 3A6F9ABF202C939D0046F40E /* Debug */, - 3A6F9AC0202C939D0046F40E /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 3A6F9AC1202C939D0046F40E /* Build configuration list for PBXNativeTarget "Beats" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 3A6F9AC2202C939D0046F40E /* Debug */, - 3A6F9AC3202C939D0046F40E /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 3AA415DE20582B34008915AA /* Build configuration list for PBXNativeTarget "helper" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 3AA415DF20582B34008915AA /* Debug */, - 3AA415E020582B34008915AA /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 3A6F9AA9202C939D0046F40E /* Project object */; -} diff --git a/dev-tools/packaging/preference-pane/beats-preference-pane.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/dev-tools/packaging/preference-pane/beats-preference-pane.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index b7675b8ff50..00000000000 --- a/dev-tools/packaging/preference-pane/beats-preference-pane.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/dev-tools/packaging/preference-pane/beats-preference-pane.xcodeproj/xcshareddata/IDETemplateMacros.plist b/dev-tools/packaging/preference-pane/beats-preference-pane.xcodeproj/xcshareddata/IDETemplateMacros.plist deleted file mode 100644 index ae4bfae6263..00000000000 --- a/dev-tools/packaging/preference-pane/beats-preference-pane.xcodeproj/xcshareddata/IDETemplateMacros.plist +++ /dev/null @@ -1,24 +0,0 @@ - - - - - FILEHEADER - - - diff --git a/dev-tools/packaging/preference-pane/beats-preference-pane.xcodeproj/xcuserdata/adrian.xcuserdatad/xcschemes/xcschememanagement.plist b/dev-tools/packaging/preference-pane/beats-preference-pane.xcodeproj/xcuserdata/adrian.xcuserdatad/xcschemes/xcschememanagement.plist deleted file mode 100644 index 58581c18ad7..00000000000 --- a/dev-tools/packaging/preference-pane/beats-preference-pane.xcodeproj/xcuserdata/adrian.xcuserdatad/xcschemes/xcschememanagement.plist +++ /dev/null @@ -1,32 +0,0 @@ - - - - - SchemeUserState - - beats-preference-pane.xcscheme - - orderHint - 0 - - helper.xcscheme - - orderHint - 1 - - launchctl-helper.xcscheme - - orderHint - 1 - - - SuppressBuildableAutocreation - - 3A6F9AB1202C939D0046F40E - - primary - - - - - diff --git a/dev-tools/packaging/preference-pane/beats-preference-pane/Authorization.h b/dev-tools/packaging/preference-pane/beats-preference-pane/Authorization.h deleted file mode 100644 index fd25568f4e0..00000000000 --- a/dev-tools/packaging/preference-pane/beats-preference-pane/Authorization.h +++ /dev/null @@ -1,23 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -@protocol AuthorizationProvider -- (BOOL) isUnlocked; -- (BOOL) forceUnlock; -- (int) runAsRoot:(NSString*) program args:(NSArray*)args; -- (int) runHelperAsRootWithArgs:(NSArray*)args; -@end diff --git a/dev-tools/packaging/preference-pane/beats-preference-pane/Base.lproj/BeatView.xib b/dev-tools/packaging/preference-pane/beats-preference-pane/Base.lproj/BeatView.xib deleted file mode 100644 index b097b91ba51..00000000000 --- a/dev-tools/packaging/preference-pane/beats-preference-pane/Base.lproj/BeatView.xib +++ /dev/null @@ -1,129 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dev-tools/packaging/preference-pane/beats-preference-pane/Base.lproj/BeatsPrefPane.xib b/dev-tools/packaging/preference-pane/beats-preference-pane/Base.lproj/BeatsPrefPane.xib deleted file mode 100644 index ede949b14a0..00000000000 --- a/dev-tools/packaging/preference-pane/beats-preference-pane/Base.lproj/BeatsPrefPane.xib +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dev-tools/packaging/preference-pane/beats-preference-pane/Base.lproj/EditorWindow.xib b/dev-tools/packaging/preference-pane/beats-preference-pane/Base.lproj/EditorWindow.xib deleted file mode 100644 index e95b5c215ae..00000000000 --- a/dev-tools/packaging/preference-pane/beats-preference-pane/Base.lproj/EditorWindow.xib +++ /dev/null @@ -1,147 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dev-tools/packaging/preference-pane/beats-preference-pane/Base.lproj/pane.xib b/dev-tools/packaging/preference-pane/beats-preference-pane/Base.lproj/pane.xib deleted file mode 100644 index 4f80f209bb9..00000000000 --- a/dev-tools/packaging/preference-pane/beats-preference-pane/Base.lproj/pane.xib +++ /dev/null @@ -1,122 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dev-tools/packaging/preference-pane/beats-preference-pane/BeatManager.m b/dev-tools/packaging/preference-pane/beats-preference-pane/BeatManager.m deleted file mode 100644 index 650c745ddd6..00000000000 --- a/dev-tools/packaging/preference-pane/beats-preference-pane/BeatManager.m +++ /dev/null @@ -1,22 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -#import "BeatManager.h" - -@implementation BeatManager - -@end diff --git a/dev-tools/packaging/preference-pane/beats-preference-pane/BeatViewController.h b/dev-tools/packaging/preference-pane/beats-preference-pane/BeatViewController.h deleted file mode 100644 index bc15c830049..00000000000 --- a/dev-tools/packaging/preference-pane/beats-preference-pane/BeatViewController.h +++ /dev/null @@ -1,48 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -#import - -#import "beats/Beats.h" -#import "Authorization.h" - -// BeatViewController handles the individual UI view for a beat -@interface BeatViewController : NSViewController -{ - IBOutlet NSTextField *statusLabel; - IBOutlet NSTextField *bootLabel; - IBOutlet NSTextField *configField; - IBOutlet NSTextField *logsField; - IBOutlet NSButton *startStopButton; - IBOutlet NSButton *bootButton; - IBOutlet NSButton *editButton; - IBOutlet NSButton *logsButton; - - // The Beat being displayed by this view - id beat; - id beatsInterface; - id auth; -} - -- (id)initWithBeat:(id)_ auth:(id)_ bundle:(NSBundle*)_ beatsInterface:(id)_; -- (IBAction)startStopTapped:(id)sender; -- (IBAction)startAtBootTapped:(id)sender; -- (IBAction)editConfigTapped:(id)sender; -- (IBAction)viewLogsTapped:(id)sender; -- (void)update; - -@end diff --git a/dev-tools/packaging/preference-pane/beats-preference-pane/BeatViewController.m b/dev-tools/packaging/preference-pane/beats-preference-pane/BeatViewController.m deleted file mode 100644 index 2edfd6bbba8..00000000000 --- a/dev-tools/packaging/preference-pane/beats-preference-pane/BeatViewController.m +++ /dev/null @@ -1,151 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -#import "BeatViewController.h" -#import "EditorWindow.h" -#import "common/common.h" - -@implementation BeatViewController - -- (id) initWithBeat:(id)beat - auth:(id)auth - bundle:(NSBundle*)bundle - beatsInterface:(id)beatsInterface; -{ - if (self = [self initWithNibName:@"BeatView" bundle:bundle]) { - self->beat = beat; - self->auth = auth; - self->beatsInterface = beatsInterface; - } - return self; -} - -- (void)viewDidLoad { - [super viewDidLoad]; - [self updateUI]; -} - -- (void)updateUI { - id beat = self->beat; - - if ([beat isRunning]) { - [statusLabel setStringValue:[NSString stringWithFormat:@"%@ is running with PID %d", [beat displayName], [beat pid]]]; - [startStopButton setTitle:@"Stop"]; - } else { - [statusLabel setStringValue:[NSString stringWithFormat:@"%@ is stopped", [beat displayName]]]; - [startStopButton setTitle:@"Start"]; - } - - if ([beat isBoot]) { - [bootLabel setStringValue:@"Automatic start at boot is enabled"]; - [bootButton setTitle:@"Disable"]; - } else { - [bootLabel setStringValue:@"Automatic start at boot is disabled"]; - [bootButton setTitle:@"Enable"]; - } - [configField setStringValue:strOrNil([beat configFile])]; - [logsField setStringValue:strOrNil([beat logsPath])]; - - BOOL unlocked = [auth isUnlocked]; - [startStopButton setEnabled:unlocked]; - [bootButton setEnabled:unlocked]; - [editButton setEnabled:unlocked]; - [logsButton setEnabled:unlocked]; -} - -- (void) update { - beat = [beatsInterface getBeat:[beat name]]; - [self updateUI]; -} - -- (IBAction)startStopTapped:(id)sender { - if (![auth isUnlocked]) { - return; - } - uint64_t took = getTimeMicroseconds(); - id beat = self->beat; - - if ([beat isRunning]) { - [beat stopWithAuth:auth]; - } else { - [beat startWithAuth:auth]; - } - took = getTimeMicroseconds() - took; - NSLog(@"start/stop took %lld us", took); - [self update]; -} - -- (IBAction)startAtBootTapped:(id)sender { - if (![auth isUnlocked]) { - return; - } - [beat toggleRunAtBootWithAuth:auth]; - [self update]; -} - -- (IBAction)editConfigTapped:(id)sender { - if (![auth isUnlocked]) { - return; - } - id beat = self->beat; - NSString *conf = [beat configFile]; - - // Create a temporal file with current user permissions - NSString *tmpFile = [NSString stringWithFormat:@"%@/beatconf-%@.yml",NSTemporaryDirectory(), [[NSUUID UUID] UUIDString]]; - [@"" writeToFile:tmpFile atomically:NO encoding:NSUTF8StringEncoding error:nil]; - - // Cat the config file contents into the temporal file - [auth runAsRoot:@"/bin/sh" args:@[@"-c", [NSString stringWithFormat:@"cat '%@' > '%@'", conf, tmpFile]]]; - - // Display editor on temp file - EditorWindow *editor = [[EditorWindow alloc] initWithBeat:[beat displayName] config:tmpFile]; - NSWindow *window = [editor window]; - [window setFrameOrigin:[[[self view] window] frame].origin]; - NSModalResponse resp = [NSApp runModalForWindow: window]; - - if (resp == NSModalResponseOK) { - // Cat temporal file contents into config file. - while ([auth runAsRoot:@"/bin/sh" args:@[@"-c", [NSString stringWithFormat:@"cat '%@' > '%@'", tmpFile, conf]]] != errAuthorizationSuccess) { - // Authorization expired because the user took a while to edit the config - // Ask to reauthorize - NSAlert *alert = [[NSAlert alloc] init]; - [alert addButtonWithTitle:@"Retry"]; - [alert addButtonWithTitle:@"Cancel"]; - [alert setMessageText:@"Retry authentication?"]; - [alert setInformativeText:@"Authentication expired. Configuration changes will be lost unless valid credentials are provided."]; - [alert setAlertStyle:NSAlertStyleWarning]; - if ([alert runModal] != NSAlertFirstButtonReturn) { - break; - } - [auth forceUnlock]; - } - } - - [[NSFileManager defaultManager] removeItemAtPath:tmpFile error:nil]; -} - -- (IBAction)viewLogsTapped:(id)sender -{ - NSAlert *alert = [[NSAlert alloc] init]; - [alert addButtonWithTitle:@"OK"]; - [alert setMessageText:@"Can't display logs"]; - [alert setInformativeText:@"Due to strict permissions in Beats logs, they are only accessible using the command line as root."]; - [alert setAlertStyle:NSAlertStyleWarning]; - [alert runModal]; -} - -@end diff --git a/dev-tools/packaging/preference-pane/beats-preference-pane/Beats.icns b/dev-tools/packaging/preference-pane/beats-preference-pane/Beats.icns deleted file mode 100644 index 87108ae8ff7..00000000000 Binary files a/dev-tools/packaging/preference-pane/beats-preference-pane/Beats.icns and /dev/null differ diff --git a/dev-tools/packaging/preference-pane/beats-preference-pane/BeatsPrefPane.h b/dev-tools/packaging/preference-pane/beats-preference-pane/BeatsPrefPane.h deleted file mode 100644 index bf592a20546..00000000000 --- a/dev-tools/packaging/preference-pane/beats-preference-pane/BeatsPrefPane.h +++ /dev/null @@ -1,46 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -#import -#import - -#import "TabViewDelegate.h" -#import "Authorization.h" - -/* BeatsPrefPane is the main class for handling the preference pane. - Implements so that it can provide authorization - obtained via the SFAuthorizationView to other components. - */ -@interface BeatsPrefPane : NSPreferencePane { - IBOutlet NSTabView *beatsTab; - IBOutlet TabViewDelegate *tabDelegate; - IBOutlet SFAuthorizationView *authView; - IBOutlet NSTextField *messageLabel; - NSTimer *updateTimer; - NSBundle *bundle; - NSArray *knownBeats; - NSString *helperPath; - id beatsInterface; -} - -- (id)initWithBundle:(NSBundle *)bundle; -- (void)mainViewDidLoad; -- (void)didSelect; -- (void)willSelect; -- (void)didUnselect; -- (BOOL)isUnlocked; -@end diff --git a/dev-tools/packaging/preference-pane/beats-preference-pane/BeatsPrefPane.m b/dev-tools/packaging/preference-pane/beats-preference-pane/BeatsPrefPane.m deleted file mode 100644 index 29fafed1244..00000000000 --- a/dev-tools/packaging/preference-pane/beats-preference-pane/BeatsPrefPane.m +++ /dev/null @@ -1,164 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -#import "config.h" -#import "BeatsPrefPane.h" -#import "beats/BeatsService.h" - -@implementation BeatsPrefPane - -// Constructor -- (id)initWithBundle:(NSBundle *)bundle -{ - if ( ( self = [super initWithBundle:bundle] ) != nil ) { - self->beatsInterface = [[BeatsService alloc] initWithPrefix:BEATS_PREFIX]; - self->updateTimer = nil; - self->knownBeats = [beatsInterface listBeats]; - self->bundle = bundle; - self->helperPath = [bundle pathForAuxiliaryExecutable:HELPER_BINARY]; - NSLog(@"Using helper: `%@`", helperPath); - } - return self; -} - -// Called when UI file is loaded -- (void)mainViewDidLoad -{ - // Setup SFAuthorizationView - AuthorizationItem items = {kAuthorizationRightExecute, 0, NULL, 0}; - AuthorizationRights rights = {1, &items}; - [authView setAuthorizationRights:&rights]; - authView.delegate = self; - [authView updateStatus:nil]; - // Allocate tabview delegate - tabDelegate = [[TabViewDelegate alloc] initWithTabView:beatsTab bundle:bundle beats:beatsInterface]; -} - -// Called before the preference pane is shown -- (void)willSelect -{ - [self updateUI]; -} - -// Called when the preference pane is shown -- (void)didSelect -{ - updateTimer = [NSTimer scheduledTimerWithTimeInterval:UPDATE_INTERVAL_SECS target:self selector:@selector(onTimer) userInfo:nil repeats:YES]; -} - -// Called when the preference pane is closed -- (void)didUnselect -{ - [updateTimer invalidate]; - updateTimer = nil; -} - -// Custom code to update the UI elements -- (void)updateUI { - [tabDelegate populateTabs:knownBeats withAuth:self]; - [messageLabel setHidden:knownBeats.count > 0]; -} - -static BOOL beatArrayEquals(NSArray *a, NSArray *b) -{ - size_t n = a.count; - if (b.count != n) return NO; - for (size_t i = 0; i < n; i++) { - if (![(NSString*)a[i] isEqualToString:b[i]]) - return NO; - } - return YES; -} - -- (void)onTimer -{ - [authView updateStatus:nil]; - NSArray *beats = [beatsInterface listBeats]; - if (!beatArrayEquals(beats, knownBeats)) { - knownBeats = beats; - [self updateUI]; - } else { - [tabDelegate update]; - } -} - -// -// SFAuthorization delegates -// - -- (void)authorizationViewDidAuthorize:(SFAuthorizationView *)view { - // Update the tab delegate so that it can enable UI elements - [tabDelegate update]; -} - -- (void)authorizationViewDidDeauthorize:(SFAuthorizationView *)view { - // Update the tab delegate so that it can disable UI elements - [tabDelegate update]; -} - -// -// AuthorizationProvider protocol -// - -- (BOOL)isUnlocked { - return [authView authorizationState] == SFAuthorizationViewUnlockedState; -} - -- (int)runAsRoot:(NSString*)program args:(NSArray*)args { - size_t numArgs = args.count; - char **cArgs = alloca(sizeof(char*) * (1 + numArgs)); - for (int i=0; i - -/* EditorWindow manages the window to edit configuration files - */ -@interface EditorWindow : NSWindowController { - NSString *filePath, - *beatName; - IBOutlet NSView *verticalStackView; - IBOutlet NSScrollView *textEditor; - NSString *sourceText; -} - -- (id) initWithBeat:(NSString*) name config:(NSString*) path; -- (IBAction)saveAndCloseTapped:(id)sender; -- (IBAction)closeTapped:(id)sender; -- (BOOL)windowShouldClose:(id)sender; -@end diff --git a/dev-tools/packaging/preference-pane/beats-preference-pane/EditorWindow.m b/dev-tools/packaging/preference-pane/beats-preference-pane/EditorWindow.m deleted file mode 100644 index 915092d70a2..00000000000 --- a/dev-tools/packaging/preference-pane/beats-preference-pane/EditorWindow.m +++ /dev/null @@ -1,89 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -#import "EditorWindow.h" - -@implementation EditorWindow - -- (id) initWithBeat:(NSString*)name config:(NSString*)path { - if (self = [super initWithWindowNibName:@"EditorWindow"]) { - self->beatName = name; - self->filePath = path; - } - return self; -} - -- (void)windowDidLoad { - [super windowDidLoad]; - verticalStackView.translatesAutoresizingMaskIntoConstraints = YES; - [[self window] setTitle:[NSString stringWithFormat:@"%@ configuration", beatName]]; - - NSError *err = nil; - sourceText = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:&err]; - if (sourceText == nil) { - sourceText = [err localizedDescription]; - } - NSTextStorage *storage = [(NSTextView*)[textEditor documentView] textStorage]; - [[storage mutableString] setString:sourceText]; - // Yaml needs a monospace font - [storage setFont:[NSFont userFixedPitchFontOfSize:-1]]; -} - -- (BOOL)onClose -{ - NSTextStorage *storage = [(NSTextView*)[textEditor documentView] textStorage]; - if (![[storage string] isEqualToString:sourceText]) { - NSAlert *alert = [[NSAlert alloc] init]; - [alert addButtonWithTitle:@"Discard"]; - [alert addButtonWithTitle:@"Continue editing"]; - [alert setMessageText:@"Discard changes?"]; - [alert setInformativeText:@"Changes will be lost if the dialog is closed without saving."]; - [alert setAlertStyle:NSAlertStyleWarning]; - if ([alert runModal] != NSAlertFirstButtonReturn) { - return NO; - } - } - [NSApp stopModalWithCode:NSModalResponseStop]; - return YES; -} - -- (IBAction)saveAndCloseTapped:(id)sender -{ - NSError *err = nil; - NSTextStorage *storage = [(NSTextView*)[textEditor documentView] textStorage]; - if (![[storage string] writeToFile:filePath atomically:YES encoding:NSUTF8StringEncoding error:&err]) { - NSAlert *alert = [NSAlert alertWithError:err]; - [alert runModal]; - return; - } - [NSApp stopModalWithCode:NSModalResponseOK]; - [self close]; -} - -- (IBAction)closeTapped:(id)sender -{ - if ([self onClose]) { - [NSApp stopModalWithCode:NSModalResponseStop]; - [self close]; - } -} - -- (BOOL)windowShouldClose:(id)sender { - return [self onClose]; -} - -@end diff --git a/dev-tools/packaging/preference-pane/beats-preference-pane/Info.plist b/dev-tools/packaging/preference-pane/beats-preference-pane/Info.plist deleted file mode 100644 index f145834a69b..00000000000 --- a/dev-tools/packaging/preference-pane/beats-preference-pane/Info.plist +++ /dev/null @@ -1,32 +0,0 @@ - - - - - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - BNDL - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - NSHumanReadableCopyright - Copyright © 2018 Elastic. All rights reserved. - NSMainNibFile - BeatsPrefPane - NSPrefPaneIconFile - Beats.icns - NSPrefPaneIconLabel - Beats - NSPrincipalClass - BeatsPrefPane - - diff --git a/dev-tools/packaging/preference-pane/beats-preference-pane/TabViewDelegate.h b/dev-tools/packaging/preference-pane/beats-preference-pane/TabViewDelegate.h deleted file mode 100644 index 6cc20a3c2ca..00000000000 --- a/dev-tools/packaging/preference-pane/beats-preference-pane/TabViewDelegate.h +++ /dev/null @@ -1,43 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -#import -#import - -#import "beats/Beats.h" -#import "Authorization.h" - -@class BeatViewController; - -/* TabViewDelegate takes care of the NSTabView that displays all the installed beats - */ -@interface TabViewDelegate : NSObject { - NSTabView *tabView; - NSBundle *bundle; - BeatViewController *selectedTab; - id beatsInterface; -} -- (id) initWithTabView:(NSTabView*)_ bundle:(NSBundle*)_ beats:(id)_; -- (void) update; -- (void) populateTabs:(NSArray*)_ withAuth:(id)_; - -// NSTabViewDelegate -- (void) tabViewDidChangeNumberOfTabViewItems:(NSTabView*)_; -- (BOOL) tabView:(NSTabView*)_ shouldSelectTabViewItem:(NSTabViewItem*)_; -- (void) tabView:(NSTabView*)_ willSelectTabViewItem:(NSTabViewItem*)_; -- (void) tabView:(NSTabView*)_ didSelectTabViewItem:(NSTabViewItem*)_; -@end diff --git a/dev-tools/packaging/preference-pane/beats-preference-pane/TabViewDelegate.m b/dev-tools/packaging/preference-pane/beats-preference-pane/TabViewDelegate.m deleted file mode 100644 index fb517f03fcd..00000000000 --- a/dev-tools/packaging/preference-pane/beats-preference-pane/TabViewDelegate.m +++ /dev/null @@ -1,99 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -#import "TabViewDelegate.h" -#import "BeatViewController.h" -#import "common/common.h" - -@implementation TabViewDelegate -- (id) initWithTabView:(NSTabView *)tabView - bundle:(NSBundle*)bundle - beats:(id)beats -{ - if (self = [super init]) { - self->selectedTab = nil; - self->tabView = tabView; - self->bundle = bundle; - self->beatsInterface = beats; - tabView.delegate = self; - } - return self; -} - -- (void) update -{ - [selectedTab update]; -} - -- (void) populateTabs:(NSArray*)beats withAuth:(id)auth -{ - // cache self->selectedTab, as it is going to change in this method - // (add|remove|select)TabViewItem methods call the NSTabViewDelegate callbacks - BeatViewController *selectedTab = self->selectedTab; - uint i; - NSArray *items; - NSString *selectedName = nil; - for (i=0, items = tabView.tabViewItems; items != nil && i < items.count; i++) { - NSTabViewItem *item = [items objectAtIndex:i]; - if (selectedTab != nil && item.viewController == selectedTab) { - selectedName = item.identifier; - } - [tabView removeTabViewItem:item]; - } - for (uint i=0; i < beats.count; i++) { - NSString *beatName = [beats objectAtIndex:i]; - id beat = [beatsInterface getBeat:beatName]; - if (beat == nil) { - // TODO: Investigate and repair. Why some beats seem to break. Seemingly after some time disabled - // they are unloaded from launchctl. - NSLog(@"Ignoring broken beat %@", beatName); - continue; - } - NSTabViewItem *item = [[NSTabViewItem alloc] initWithIdentifier:beatName]; - [item setLabel:[beat displayName]]; - BeatViewController *vc = [[BeatViewController alloc] - initWithBeat:[beatsInterface getBeat:beatName] auth:auth bundle:bundle beatsInterface:beatsInterface]; - [item setViewController:vc]; - [tabView addTabViewItem:item]; - if ([beatName isEqualToString:selectedName]) { - selectedTab = vc; - [tabView selectTabViewItem:item]; - } - } -} - -- (void) tabViewDidChangeNumberOfTabViewItems:(NSTabView*) tabView -{ - // ignore -} - -- (BOOL) tabView:(NSTabView*)tabView shouldSelectTabViewItem:(NSTabViewItem*)item -{ - return YES; -} - -- (void) tabView:(NSTabView*)tabView willSelectTabViewItem:(NSTabViewItem*)item -{ - [(BeatViewController*)[item viewController] update]; -} - -- (void) tabView:(NSTabView*)tabView didSelectTabViewItem:(NSTabViewItem*)item -{ - selectedTab = (BeatViewController*)[item viewController]; -} - -@end diff --git a/dev-tools/packaging/preference-pane/beats-preference-pane/beats/Beats.h b/dev-tools/packaging/preference-pane/beats-preference-pane/beats/Beats.h deleted file mode 100644 index f98cec1943a..00000000000 --- a/dev-tools/packaging/preference-pane/beats-preference-pane/beats/Beats.h +++ /dev/null @@ -1,39 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -#import -#import "../Authorization.h" - -@protocol Beat -- (bool) isRunning; -- (bool) isBoot; -- (int) pid; -- (NSString*) name; -- (NSString*) displayName; -- (NSString*) plistPath; -- (NSString*) configFile; -- (NSString*) logsPath; -- (BOOL) startWithAuth:(id)auth; -- (BOOL) stopWithAuth:(id)auth; -- (BOOL) toggleRunAtBootWithAuth:(id)auth; -- (BOOL) uninstall; -@end - -@protocol Beats -- (NSArray*) listBeats; -- (id )getBeat:(NSString*)name; -@end diff --git a/dev-tools/packaging/preference-pane/beats-preference-pane/beats/BeatsService.h b/dev-tools/packaging/preference-pane/beats-preference-pane/beats/BeatsService.h deleted file mode 100644 index 5acd142ec7b..00000000000 --- a/dev-tools/packaging/preference-pane/beats-preference-pane/beats/BeatsService.h +++ /dev/null @@ -1,29 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -#import -#import "Beats.h" - -// BeatsService is the macOS implementation for the Beats protocol -@interface BeatsService : NSObject { - NSString *prefix; -} - -- (id)initWithPrefix:(NSString*)prefix; -- (NSArray*) listBeats; -- (id )getBeat:(NSString*)name; -@end diff --git a/dev-tools/packaging/preference-pane/beats-preference-pane/beats/BeatsService.m b/dev-tools/packaging/preference-pane/beats-preference-pane/beats/BeatsService.m deleted file mode 100644 index 2191f106f76..00000000000 --- a/dev-tools/packaging/preference-pane/beats-preference-pane/beats/BeatsService.m +++ /dev/null @@ -1,294 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -#import "BeatsService.h" -#import "../common/common.h" -#import "config.h" - -static NSString *plistExtension = @"plist"; -static NSString *empty = @""; - -@interface ConcreteBeat : NSObject { - @public NSString *config; - @public NSString *logs; - @public NSString *name; - @public NSString *displayName; - @public bool running; - @public bool startAtBoot; - @public pid_t pid; - @public NSString *plistPath; - NSString *prefix; -} -- (id) initWithPrefix:(NSString*)prefix andName:(NSString*)name; -@end - -@implementation ConcreteBeat - -- (id) initWithPrefix:(NSString*)prefix andName:(NSString *)name { - if (self = [self init]) { - self->name = name; - self->displayName = [name capitalizedString]; - self->prefix = prefix; - self->config = nil; - self->logs = nil; - self->running = false; - self->startAtBoot = false; - self->pid = 0; - self->plistPath = nil; - } - return self; -} - -- (NSString *)configFile { - return self->config; -} - -- (bool)isRunning { - return self->running; -} - -- (NSString *)name { - return self->name; -} - -- (int)pid { - return self->pid; -} - -- (BOOL)uninstall { - // TODO - return NO; -} - -- (NSString *)logsPath { - return self->logs; -} - -- (bool)isBoot { - return self->startAtBoot; -} - -- (NSString*) serviceName { - return [NSString stringWithFormat:@"%@.%@", prefix, name]; -} - -- (NSString*) serviceNameWithDomain { - return [NSString stringWithFormat:@"system/%@", [self serviceName]]; -} - -// Executes a batch of commands using the helper app. -BOOL runHelperTaskList(id auth, NSArray *argList) { - BOOL __block failed = YES; - [argList enumerateObjectsUsingBlock:^(id obj, NSUInteger _, BOOL *stop) { - NSArray *args = (NSArray*)obj; - int res = [auth runHelperAsRootWithArgs:args]; - if (res != 0) { - NSLog(@"Error: running helper with args `%@` failed with code %d", - [args componentsJoinedByString:@" "], res); - *stop = failed = YES; - } - }]; - return !failed; -} - -- (BOOL)startWithAuth:(id)auth { - return runHelperTaskList(auth,@[ - @[ @"run", LAUNCHCTL_PATH, @"enable", [self serviceNameWithDomain] ], - @[ @"run", LAUNCHCTL_PATH, @"start", [self serviceName] ] - ]); -} - -- (BOOL)stopWithAuth:(id)auth { - return runHelperTaskList(auth,@[ - @[ @"run", LAUNCHCTL_PATH, @"disable", [self serviceNameWithDomain] ], - @[ @"run", LAUNCHCTL_PATH, @"stop", [self serviceName] ] - ]); -} - -- (BOOL)toggleRunAtBootWithAuth:(id)auth { - return runHelperTaskList(auth,@[ - @[ @"setboot", [self plistPath], self->startAtBoot? @"no" : @"yes"] - ]); -} - -- (NSString *)plistPath { - return self->plistPath; -} - -- (NSString *)displayName { - return self->displayName; -} - - -@end - -@implementation BeatsService - -- (id)initWithPrefix:(NSString*)prefix { - if (self = [self init]) { - self->prefix = prefix; - } - return self; -} - -- (NSArray *)listBeats { - uint64_t elapsed = getTimeMicroseconds(); - NSArray *result = [self doListBeats]; - if (result != nil) { - elapsed = getTimeMicroseconds() - elapsed; - NSLog(@"ListBeats took %llu us", elapsed); - } - return result; -} - -- (NSArray *)doListBeats { - NSError *error = nil; - NSArray* contents = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:LAUNCHDAEMONS_PATH - error:&error]; - if (error != nil) { - NSLog(@"Error: Unable to list installed beats: %@", [error localizedDescription]); - return nil; - } - NSMutableArray *beats = [[NSMutableArray alloc] init]; - NSUInteger prefixLength = [prefix length]; - NSUInteger extensionLength = [plistExtension length]; - - [contents enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { - NSString *filename = (NSString *)obj; - NSUInteger nameLength =[filename length]; - - // Make sure the file is .something.plist - if ([filename hasPrefix:self->prefix] - && nameLength > prefixLength + extensionLength + 2 - && [filename characterAtIndex:prefixLength] == '.' - && [[[filename pathExtension] lowercaseString] isEqualToString:plistExtension]) { - NSString *beatName = [filename substringWithRange:NSMakeRange(prefixLength+1, nameLength - prefixLength - extensionLength - 2)]; - [beats addObject:beatName]; - } - }]; - return beats; -} - -NSString *parseLine(NSString *line, NSString **data) { - NSRange range = [line rangeOfString:@" = "]; - if (range.location != NSNotFound) { - unsigned int i = 0; - for(char c; i < range.location && ((c = [line characterAtIndex:i])==' ' || c == '\t'); i++) - ; - *data = [line substringFromIndex:range.location + range.length]; - return [line substringWithRange:NSMakeRange(i, range.location - i)]; - } - return nil; -} - -NSDictionary* parseLaunchctlPrint(NSString *label, NSSet *keys) { - NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithCapacity:[keys count]]; - executeAndGetOutput(LAUNCHCTL_PATH, @[@"print", label], ^(NSString *line) { - NSString *value; - NSString *key = parseLine(line, &value); - if (key != nil && [keys containsObject:key]) { - dict[key] = value; - } - return YES; - }); - return dict; -} - -- (id)getBeat:(NSString *)name { - uint64_t elapsed = getTimeMicroseconds(); - id result = [self doGetBeat:name]; - if (result != nil) { - elapsed = getTimeMicroseconds() - elapsed; - NSLog(@"GetBeat took %llu us", elapsed); - } - return result; -} - -- (id)doGetBeat:(NSString *)name { - // Get launch daemon runtime info (only if running) - NSString *label = [NSString stringWithFormat:@"system/%@.%@", self->prefix, name]; - NSSet *wantedKeys = [NSSet setWithObjects:@"pid", @"state", @"path", nil]; - NSDictionary * dict = parseLaunchctlPrint(label, wantedKeys); - - if (!dict[@"path"]) { - NSLog(@"Error: launch daemon %@ not installed", name); - return nil; - } - ConcreteBeat *beat = [[ConcreteBeat alloc] initWithPrefix:prefix andName:name]; - beat->plistPath = dict[@"path"]; - if (dict[@"pid"]) { - beat->pid = [ (NSString*)dict[@"pid"] intValue]; - } - // pid may be present after stopped - if (beat->pid > 0 && [@"running" isEqualToString:dict[@"state"]]) { - beat->running = true; - } - - // Get configuration paths - NSError *err; - NSInputStream *plistFile = [[NSInputStream alloc] initWithFileAtPath:dict[@"path"]]; - if (plistFile == nil) { - NSLog(@"Error: unable to open plist at path '%@'", dict[@"path"]); - return nil; - } - [plistFile open]; - if ( (err = [plistFile streamError]) != nil) { - NSLog(@"Error: unable to read plist at path '%@': %@", dict[@"path"], [err localizedDescription]); - return nil; - } - - NSDictionary *plist = [NSPropertyListSerialization propertyListWithStream:plistFile - options:NSPropertyListImmutable - format:nil - error:&err]; - if (plist == nil) { - NSLog(@"Error: unable to parse plist at path '%@'", dict[@"path"]); - return nil; - } - if (err != nil) { - NSLog(@"Error: failed parsing plist at path '%@': %@", dict[@"path"], [err localizedDescription]); - return nil; - } - [plistFile close]; - - NSNumber *runAtLoad = plist[@"RunAtLoad"]; - beat->startAtBoot = runAtLoad != nil && [runAtLoad boolValue] == YES; - NSArray *args = plist[@"ProgramArguments"]; - NSMutableDictionary *argsDict = [NSMutableDictionary new]; - NSString *key = nil; - for (unsigned long i = 0, count = [args count]; i < count; i++) { - NSString *arg = [args objectAtIndex:i]; - if (key != nil) { - argsDict[key] = arg; - key = nil; - } else if ([arg characterAtIndex:0] == '-') { - key = arg; - } - } - - beat->config = argsDict[@"-c"]; - if (beat->config == nil) { - beat->config = [NSString stringWithFormat:@"/etc/%@/%@.yml", name, name]; - } - beat->logs = argsDict[@"--path.logs"]; - if (beat->logs == nil) { - beat->logs = [NSString stringWithFormat:@"/var/log/%@", name]; - } - return beat; -} - -@end diff --git a/dev-tools/packaging/preference-pane/beats-preference-pane/common/common.h b/dev-tools/packaging/preference-pane/beats-preference-pane/common/common.h deleted file mode 100644 index f14cb842cc5..00000000000 --- a/dev-tools/packaging/preference-pane/beats-preference-pane/common/common.h +++ /dev/null @@ -1,29 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -#import - -// executes the given `path` executable, passing `args` array. -// Callback is called for every line in the program's output. -// Returns the program exit status. -int executeAndGetOutput(NSString *path, NSArray *args, BOOL (^callback)(NSString*)); - -// Returns the current time in microseconds -uint64_t getTimeMicroseconds(void); - -// Returns the given string, or @"nil" if its nil. -NSString *strOrNil(NSString *str); diff --git a/dev-tools/packaging/preference-pane/beats-preference-pane/common/common.m b/dev-tools/packaging/preference-pane/beats-preference-pane/common/common.m deleted file mode 100644 index f6ecbb12f0e..00000000000 --- a/dev-tools/packaging/preference-pane/beats-preference-pane/common/common.m +++ /dev/null @@ -1,75 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -#import "common.h" -#import -#import - -static void readLines(NSFileHandle *handle, BOOL (^callback)(NSString*)) { - const int readLength = 4096; - NSMutableData *buffer = [NSMutableData dataWithCapacity:readLength]; - - unsigned int length = 0; - for (NSData *readData; (readData = [handle readDataOfLength:readLength])!= nil && [readData length] > 0;) { - [buffer appendData:readData]; - unsigned int start = 0, // where the first line starts - base = length; // where it begins scan for newlines - length += [readData length]; - char *bytes = [buffer mutableBytes]; - for (unsigned int i=base; i < length; i++) { - if (bytes[i] == '\n') { - NSString *line = [[NSString alloc] initWithBytesNoCopy:&bytes[start] - length:(i - start) encoding:NSUTF8StringEncoding - freeWhenDone:NO]; - callback(line); - start = i + 1; - } - } - // discard full lines - if (start != 0) { - [buffer replaceBytesInRange:NSMakeRange(0, start) withBytes:NULL length:0]; - length -= start; - } - } -} - -int executeAndGetOutput(NSString *path, NSArray* args, BOOL (^callback)(NSString*)) { - NSPipe *pipe = [NSPipe pipe]; - NSFileHandle *fHandle = pipe.fileHandleForReading; - NSTask *task = [[NSTask alloc] init]; - task.launchPath = path; - task.arguments = args; - task.standardOutput = pipe; - - [task launch]; - - readLines(fHandle, callback); - - [fHandle closeFile]; - [task waitUntilExit]; - return [task terminationStatus]; -} - -uint64_t getTimeMicroseconds(void) { - struct timeval tv; - gettimeofday(&tv, NULL); - return tv.tv_sec*1000000 + tv.tv_usec; -} - -NSString *strOrNil(NSString *str) { - return str != nil? str : @"(nil)"; -} diff --git a/dev-tools/packaging/preference-pane/beats-preference-pane/config.h b/dev-tools/packaging/preference-pane/beats-preference-pane/config.h deleted file mode 100644 index 4119154075f..00000000000 --- a/dev-tools/packaging/preference-pane/beats-preference-pane/config.h +++ /dev/null @@ -1,31 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -// Service prefix used by Beats launch daemons. Used for detection -#define BEATS_PREFIX @"co.elastic.beats" - -// How often daemons info is updated -#define UPDATE_INTERVAL_SECS 2.0 - -// Helper binary name -#define HELPER_BINARY @"helper" - -// Path where to look for launch services -#define LAUNCHDAEMONS_PATH @"/Library/LaunchDaemons" - -// Path to launchctl executable -#define LAUNCHCTL_PATH @"/bin/launchctl" diff --git a/dev-tools/packaging/preference-pane/beats-preference-pane/en.lproj/beats_preference_pane.strings b/dev-tools/packaging/preference-pane/beats-preference-pane/en.lproj/beats_preference_pane.strings deleted file mode 100644 index e66b8e36388..00000000000 --- a/dev-tools/packaging/preference-pane/beats-preference-pane/en.lproj/beats_preference_pane.strings +++ /dev/null @@ -1,3 +0,0 @@ - -/* Class = "NSWindow"; title = "≪ do not localize ≫"; ObjectID = "F0z-JX-Cv5"; */ -"F0z-JX-Cv5.title" = "≪ do not localize ≫"; diff --git a/dev-tools/packaging/preference-pane/helper/main.m b/dev-tools/packaging/preference-pane/helper/main.m deleted file mode 100644 index 95b9513371b..00000000000 --- a/dev-tools/packaging/preference-pane/helper/main.m +++ /dev/null @@ -1,72 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -#import -#import -#import -#include - -BOOL setRunAtBoot(NSString*,BOOL); - -/* This helper tool is used to launch actions with elevated privileges. - # helper run - # helper setboot [true|false] - */ -int main(int argc, const char * argv[]) { - if (argc < 2) { - fprintf(stderr, "Usage: %s [arguments...]\n", argv[0]); - return 1; - } - /* This is required for launchctl to connect to the right launchd - when executed via AuthorizationExecuteWithPrivileges */ - if (setuid(0) != 0) { - perror("setuid"); - return 2; - } - if (!strcmp(argv[1], "run")) { - if (argc < 3) { - fprintf(stderr, "Usage: %s run [arguments...]\n", argv[0]); - return 1; - } - fprintf(stderr, "Running `%s`", argv[2]); - for (int i=3; i \n", argv[0]); - return 1; - } - BOOL value; - if (!strcmp(argv[3], "yes")) { - value = YES; - } else if (!strcmp(argv[3], "no")) { - value = NO; - } else { - fprintf(stderr, "Unknown boot value: `%s`. Use `yes` or `no`\n", argv[3]); - return 1; - } - return setRunAtBoot([NSString stringWithUTF8String:argv[2]], value)? 0 : 4; - } else { - fprintf(stderr, "Unknown action: %s\n", argv[1]); - return 1; - } -} diff --git a/dev-tools/packaging/preference-pane/helper/setboot.m b/dev-tools/packaging/preference-pane/helper/setboot.m deleted file mode 100644 index 7147c24ac7d..00000000000 --- a/dev-tools/packaging/preference-pane/helper/setboot.m +++ /dev/null @@ -1,91 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -#import - -static void fail(NSString *msg) { - fprintf(stderr, "%s\n", [msg cStringUsingEncoding:NSUTF8StringEncoding]); -} - -// setRunAtBoot loads a property list for a launch daemon, -// changes the value of the RunAtLoad property, and writes it -// down to disk again. -BOOL setRunAtBoot(NSString* plistPath, BOOL runAtBoot) { - // Mutable property list so it can be changed in-place - NSPropertyListMutabilityOptions opts = NSPropertyListMutableContainersAndLeaves; - NSPropertyListFormat format = 0; - NSError *err = nil; - NSInputStream *input = [[NSInputStream alloc] initWithFileAtPath:plistPath]; - if (input == nil) { - fail(@"Unable to open input file"); - return NO; - } - [input open]; - err = [input streamError]; - if (err != nil) { - fail([NSString stringWithFormat:@"Unable to open input stream. Code=%u `%@`", (unsigned int)[err code], [err localizedDescription]]); - return NO; - } - - NSMutableDictionary *dict = [NSPropertyListSerialization - propertyListWithStream:input - options:opts - format:&format - error:&err]; - if (err != nil) { - fail([NSString stringWithFormat:@"Error reading property list. Code=%u `%@`", (unsigned int)[err code], [err localizedDescription]]); - return NO; - } - [input close]; - NSNumber *curValue = dict[@"RunAtLoad"]; - if (curValue != nil && [curValue boolValue] == runAtBoot) { - fail(@"RunAtLoad setting already has required value"); - return YES; - } - NSNumber *newValue = [NSNumber numberWithBool:runAtBoot]; - [dict setValue:newValue forKey:@"RunAtLoad"]; - - NSOutputStream *output = [NSOutputStream outputStreamToMemory]; - [output open]; - err = [output streamError]; - if (err != nil) { - fail([NSString stringWithFormat:@"Error creating stream. Code=%u `%@`", (unsigned int)[err code], [err localizedDescription]]); - return NO; - } - - [NSPropertyListSerialization writePropertyList:dict - toStream:output - format:format - options:0 - error:&err]; - if (err == nil) { - err = [output streamError]; - } - if (err != nil) { - fail([NSString stringWithFormat:@"Error writing property-list. Code=%u `%@`", (unsigned int)[err code], [err localizedDescription]]); - return NO; - } - [output close]; - - NSData *data = [output propertyForKey:NSStreamDataWrittenToMemoryStreamKey]; - BOOL success = [data writeToFile:plistPath atomically:YES]; - if (!success) { - fail(@"Error overwriting plist file"); - return NO; - } - return YES; -} diff --git a/dev-tools/packaging/preference-pane/magefile.go b/dev-tools/packaging/preference-pane/magefile.go deleted file mode 100644 index 4369fc92da6..00000000000 --- a/dev-tools/packaging/preference-pane/magefile.go +++ /dev/null @@ -1,159 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -//go:build mage -// +build mage - -package main - -import ( - "fmt" - "os" - "path/filepath" - - "github.com/magefile/mage/mg" - "github.com/magefile/mage/sh" - "github.com/pkg/errors" - - devtools "github.com/elastic/beats/v7/dev-tools/mage" -) - -var builder = preferencePaneBuilder{ - Project: "beats-preference-pane.xcodeproj", - Configuration: devtools.EnvOr("XCODE_CONFIGURATION", "Release"), - PackageName: "BeatsPrefPane.pkg", - InstallDir: "/Library/PreferencePanes", - Identifier: "co.elastic.beats.preference-pane", - Version: "1.0.0", -} - -// Default specifies the default build target for devtools. -var Default = All - -// All build, sign, and package the Beats Preference Pane. -func All() { mg.SerialDeps(Build, Package) } - -// Build builds the preference pane source using xcodebuild. -func Build() error { return builder.Build() } - -// Package packages the pref pane into BeatsPrefPane.pkg. -func Package() error { return builder.Package() } - -// Clean cleans the build artifacts. -func Clean() error { return sh.Rm("build") } - -// --- preferencePaneBuilder - -type preferencePaneBuilder struct { - Project string - Configuration string - PackageName string - InstallDir string - Identifier string - Version string -} - -func (b preferencePaneBuilder) SigningInfo() *devtools.AppleSigningInfo { - info, err := devtools.GetAppleSigningInfo() - if err != nil { - panic(err) - } - - return info -} - -func (b preferencePaneBuilder) Build() error { - if devtools.IsUpToDate("build/Release/Beats.prefPane/Contents/MacOS/Beats", - "helper", "beats-preference-pane", "beats-preference-pane.xcodeproj") { - fmt.Println(">> Building MacOS Preference Pane (UP-TO-DATE)") - return nil - } - - fmt.Println(">> Building MacOS Preference Pane") - err := sh.Run("xcodebuild", "build", - "-project", b.Project, - "-alltargets", - "-configuration", b.Configuration, - // This disables xcodebuild from attempting to codesign. - // We do that in its own build step. - "CODE_SIGN_IDENTITY=", - "CODE_SIGNING_REQUIRED=NO") - if err != nil { - return err - } - - return b.Sign() -} - -func (b preferencePaneBuilder) Sign() error { - if !b.SigningInfo().Sign { - fmt.Println("Skipping signing of MacOS Preference Pane " + - "(APPLE_SIGNING_ENABLED not set to true)") - return nil - } - - codesign := sh.RunCmd("codesign", "-s", b.SigningInfo().App.ID, "--timestamp") - targets := []string{ - filepath.Join("build", b.Configuration, "Beats.prefPane/Contents/MacOS/helper"), - filepath.Join("build", b.Configuration, "Beats.prefPane"), - } - - fmt.Println(">> Signing MacOS Preference Pane") - for _, target := range targets { - if err := codesign(target); err != nil { - return errors.Wrapf(err, "failed to codesign %v", target) - } - } - return nil -} - -func (b preferencePaneBuilder) Package() error { - output := filepath.Join("build", b.PackageName) - input := filepath.Join("build", b.Configuration, "Beats.prefPane") - - if devtools.IsUpToDate(output, input) { - fmt.Println(">> Packaging MacOS Preference Pane (UP-TO-DATE)") - return nil - } - - fmt.Println(">> Packaging MacOS Preference Pane") - const pkgroot = "build/pkgroot" - installDir := filepath.Join(pkgroot, b.InstallDir, filepath.Base(input)) - if err := os.MkdirAll(installDir, 0755); err != nil { - return err - } - - if err := devtools.Copy(input, installDir); err != nil { - return err - } - - pkgbuild := sh.RunCmd("pkgbuild") - args := []string{ - "--root", pkgroot, - "--identifier", b.Identifier, - "--version", b.Version, - } - if b.SigningInfo().Sign { - args = append(args, "--sign", b.SigningInfo().Installer.ID, "--timestamp") - } else { - fmt.Println("Skipping signing of MacOS " + b.PackageName + - " (APPLE_SIGNING_ENABLED not set to true)") - } - args = append(args, output) - - return pkgbuild(args...) -} diff --git a/dev-tools/packaging/templates/darwin/README.html.tmpl b/dev-tools/packaging/templates/darwin/README.html.tmpl deleted file mode 100644 index 5ba3970f55c..00000000000 --- a/dev-tools/packaging/templates/darwin/README.html.tmpl +++ /dev/null @@ -1,36 +0,0 @@ - - - {{.BeatName | title}} {{.Version}}{{if .Snapshot}}-SNAPSHOT{{end}} README - - -

{{.BeatName | title}} {{.Version}}{{if .Snapshot}}-SNAPSHOT{{end}}

- -

{{.Description}}

- -

Getting Started

- -

To get started with {{.BeatName | title}}, you need to set up Elasticsearch on -your localhost first. After that, start {{.BeatName | title}} with:

- -
 ./{{.BeatName}} -c {{.BeatName}}.yml -e
-
- -

This will start {{.BeatName | title }} and send the data to your Elasticsearch -instance. To load the dashboards for {{.BeatName | title}} into Kibana, run:

- -
./{{.BeatName}} setup -e
-
- -

For further steps visit the -Quick start guide.

- -

Documentation

- -

Visit Elastic.co Docs -for the full {{.BeatName | title}} documentation.

- -

Release notes

- -

https://www.elastic.co/guide/en/beats/libbeat/{{ beat_doc_branch }}/release-notes-{{.Version}}.html

- - diff --git a/dev-tools/packaging/templates/darwin/component.plist.tmpl b/dev-tools/packaging/templates/darwin/component.plist.tmpl deleted file mode 100644 index 5dd5da85fdb..00000000000 --- a/dev-tools/packaging/templates/darwin/component.plist.tmpl +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/dev-tools/packaging/templates/darwin/distribution.plist.tmpl b/dev-tools/packaging/templates/darwin/distribution.plist.tmpl deleted file mode 100644 index 2224a2fee7d..00000000000 --- a/dev-tools/packaging/templates/darwin/distribution.plist.tmpl +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - internal-{{.Name}}-{{.Version}}{{if .Snapshot}}-SNAPSHOT{{end}}{{if .OS}}-{{.OS}}{{end}}{{if .Arch}}-{{.Arch}}{{end}}.pkg - - - {{.BeatName | title}} {{.Version}}{{if .Snapshot}}-SNAPSHOT{{end}} - BeatsPrefPane.pkg - diff --git a/dev-tools/packaging/templates/darwin/dmg/Uninstall.app/Contents/Info.plist.tmpl b/dev-tools/packaging/templates/darwin/dmg/Uninstall.app/Contents/Info.plist.tmpl deleted file mode 100644 index 3378695b502..00000000000 --- a/dev-tools/packaging/templates/darwin/dmg/Uninstall.app/Contents/Info.plist.tmpl +++ /dev/null @@ -1,26 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleExecutable - uninstall.sh - CFBundleIdentifier - {{.identifier}}.uninstaller - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - Uninstaller - CFBundlePackageType - APPL - CFBundleShortVersionString - {{.Version}}{{if .Snapshot}}-SNAPSHOT{{end}} - CFBundleVersion - {{.Version}}{{if .Snapshot}}-SNAPSHOT{{end}} - LSMinimumSystemVersion - {{.min_supported_osx_version}} - CFBundleIconFile - uninstaller.icns - - diff --git a/dev-tools/packaging/templates/darwin/dmg/Uninstall.app/Contents/MacOS/uninstall.sh.tmpl b/dev-tools/packaging/templates/darwin/dmg/Uninstall.app/Contents/MacOS/uninstall.sh.tmpl deleted file mode 100644 index 1b95a66eace..00000000000 --- a/dev-tools/packaging/templates/darwin/dmg/Uninstall.app/Contents/MacOS/uninstall.sh.tmpl +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/bash - -GUI_APP=Finder -IDENTIFIER="{{.identifier}}" - -dialog() { - ICON="$1" - shift - osascript -e "tell app \"$GUI_APP\" to activate" \ - -e "tell app \"$GUI_APP\" to display dialog \"$@\" \ - buttons \"Close\" default button 1 \ - with icon $ICON" -} - -die() { - echo "error: $@" >&2 - dialog stop "$@" - exit 1 -} - -if [ "$(id -u)" -ne 0 ]; then - cmd=$(printf "%q" "$0") - osascript -- - "$cmd" < /dev/null || die "{{.BeatName}} not installed" - -for key in volume location -do - EXP="^$key: " - VAL=$(pkgutil --pkg-info "$IDENTIFIER" | grep "$EXP" | sed "s/$EXP//") - eval $key=\$VAL -done - -BASE="$volume$location" - -test -d "$BASE" || die "Resolved base directory '$BASE' doesn't exist" - -pushd "$BASE" -pkgutil --only-files --files "$IDENTIFIER" | tr '\n' '\0' | xargs -0 -n 1 rm -pkgutil --only-dirs --files "$IDENTIFIER" | sort -r | tr '\n' '\0' | xargs -0 -n 1 rmdir -popd - -pkgutil --forget "$IDENTIFIER" || die "Failed to remove the package from the database" - -# Cleanup runtime files like 'data/' and 'logs/' -BEAT_DIR="{{.install_path}}/{{.Vendor}}/{{.BeatName}}" -if [ -d "$BEAT_DIR" -a -n "{{.BeatName}}" -a -n "{{.Vendor}}" ]; then - rm -rf "$BEAT_DIR" -fi - -dialog note '{{.BeatName | title}} successfully uninstalled' diff --git a/dev-tools/packaging/templates/darwin/dmg/Uninstall.app/Contents/Resources/uninstaller.icns b/dev-tools/packaging/templates/darwin/dmg/Uninstall.app/Contents/Resources/uninstaller.icns deleted file mode 100644 index 5d941bf603c..00000000000 Binary files a/dev-tools/packaging/templates/darwin/dmg/Uninstall.app/Contents/Resources/uninstaller.icns and /dev/null differ diff --git a/dev-tools/packaging/templates/darwin/icons/auditbeat.icns b/dev-tools/packaging/templates/darwin/icons/auditbeat.icns deleted file mode 100644 index 02ffab5c868..00000000000 Binary files a/dev-tools/packaging/templates/darwin/icons/auditbeat.icns and /dev/null differ diff --git a/dev-tools/packaging/templates/darwin/icons/filebeat.icns b/dev-tools/packaging/templates/darwin/icons/filebeat.icns deleted file mode 100644 index ef9b181fa2a..00000000000 Binary files a/dev-tools/packaging/templates/darwin/icons/filebeat.icns and /dev/null differ diff --git a/dev-tools/packaging/templates/darwin/icons/heartbeat.icns b/dev-tools/packaging/templates/darwin/icons/heartbeat.icns deleted file mode 100644 index 24bfa9b7e73..00000000000 Binary files a/dev-tools/packaging/templates/darwin/icons/heartbeat.icns and /dev/null differ diff --git a/dev-tools/packaging/templates/darwin/icons/metricbeat.icns b/dev-tools/packaging/templates/darwin/icons/metricbeat.icns deleted file mode 100644 index 1960cc83155..00000000000 Binary files a/dev-tools/packaging/templates/darwin/icons/metricbeat.icns and /dev/null differ diff --git a/dev-tools/packaging/templates/darwin/icons/packetbeat.icns b/dev-tools/packaging/templates/darwin/icons/packetbeat.icns deleted file mode 100644 index 6dcf2b538c1..00000000000 Binary files a/dev-tools/packaging/templates/darwin/icons/packetbeat.icns and /dev/null differ diff --git a/dev-tools/packaging/templates/darwin/icons/winlogbeat.icns b/dev-tools/packaging/templates/darwin/icons/winlogbeat.icns deleted file mode 100644 index 0a586235b28..00000000000 Binary files a/dev-tools/packaging/templates/darwin/icons/winlogbeat.icns and /dev/null differ diff --git a/dev-tools/packaging/templates/darwin/launchd-daemon.plist.tmpl b/dev-tools/packaging/templates/darwin/launchd-daemon.plist.tmpl deleted file mode 100644 index c4581e678ed..00000000000 --- a/dev-tools/packaging/templates/darwin/launchd-daemon.plist.tmpl +++ /dev/null @@ -1,30 +0,0 @@ - - - - - Label - {{.identifier}} - ProgramArguments - - {{.install_path}}/{{.BeatVendor}}/{{.BeatName}}/bin/{{.BeatName}} - -environment - macOS_service - -c - /etc/{{.BeatName}}/{{.BeatName}}.yml - --path.home - {{.install_path}}/{{.BeatVendor}}/{{.BeatName}} - --path.config - /etc/{{.BeatName}} - --path.data - /var/lib/{{.BeatName}} - --path.logs - /var/log/{{.BeatName}} - - RunAtLoad - - Umask - - 0027 - - - diff --git a/dev-tools/packaging/templates/darwin/requirements.plist.tmpl b/dev-tools/packaging/templates/darwin/requirements.plist.tmpl deleted file mode 100644 index ca884996f32..00000000000 --- a/dev-tools/packaging/templates/darwin/requirements.plist.tmpl +++ /dev/null @@ -1,14 +0,0 @@ - - - - - os - - {{.min_supported_osx_version}} - - arch - - {{.Arch}} - - - diff --git a/dev-tools/packaging/templates/darwin/scripts/postinstall.elastic-agent.tmpl b/dev-tools/packaging/templates/darwin/scripts/postinstall.elastic-agent.tmpl deleted file mode 100644 index 2a9549b1d3e..00000000000 --- a/dev-tools/packaging/templates/darwin/scripts/postinstall.elastic-agent.tmpl +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env bash - -BEAT_NAME="{{.BeatName}}" -VERSION="{{.Version}}{{if .Snapshot}}-SNAPSHOT{{end}}" -SCRIPT="postinstall" -INSTALL_DIR="{{.install_path}}/{{.BeatVendor}}/{{.BeatName}}" -IDENTIFIER="{{.identifier}}" -VERSIONED_EXECUTABLE="/etc/{{.BeatName}}/data/{{.BeatName}}-{{ commit_short }}/{{.BeatName}}{{.BinaryExt}}" -EXE_ROOT="/Library/Application Support/{{.BeatVendor}}/{{.BeatName}}/bin" -EXE_NAME="{{.BeatName}}{{.BinaryExt}}" - -log() { - LEVEL="$1"; shift - syslog -s -l "$LEVEL" "$BEAT_NAME $SCRIPT: $@" -} - -die() { - log ERROR "Failed: $@" -} - -log WARN "identifier: $IDENTIFIER" -log WARN "version: $VERSION" -log WARN "install_dir: $INSTALL_DIR" - -mkdir -p "$EXE_ROOT" || die "Unable to create $BEAT_NAME bin directory" -ln -s "$VERSIONED_EXECUTABLE" "$EXE_ROOT/$EXE_NAME" || die "Unable to create $BEAT_NAME symlink" - -DAEMON_PLIST="/Library/LaunchDaemons/$IDENTIFIER.plist" -launchctl unload -w "$DAEMON_PLIST" -rm -f "$DAEMON_PLIST" -ln -s "$INSTALL_DIR/$IDENTIFIER.plist" "$DAEMON_PLIST" || die "Unable to create $DAEMON_PLIST symlink" -launchctl load -w "$DAEMON_PLIST" || die "Unable to install launchctl daemon $DAEMON_PLIST" diff --git a/dev-tools/packaging/templates/darwin/scripts/postinstall.tmpl b/dev-tools/packaging/templates/darwin/scripts/postinstall.tmpl deleted file mode 100644 index ca52f2d5670..00000000000 --- a/dev-tools/packaging/templates/darwin/scripts/postinstall.tmpl +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash - -BEAT_NAME="{{.BeatName}}" -VERSION="{{.Version}}{{if .Snapshot}}-SNAPSHOT{{end}}" -SCRIPT="postinstall" -INSTALL_DIR="{{.install_path}}/{{.BeatVendor}}/{{.BeatName}}" -IDENTIFIER="{{.identifier}}" - -log() { - LEVEL="$1"; shift - syslog -s -l "$LEVEL" "$BEAT_NAME $SCRIPT: $@" -} - -die() { - log ERROR "Failed: $@" -} - -log WARN "identifier: $IDENTIFIER" -log WARN "version: $VERSION" -log WARN "install_dir: $INSTALL_DIR" - -DAEMON_PLIST="/Library/LaunchDaemons/$IDENTIFIER.plist" -launchctl unload -w "$DAEMON_PLIST" -rm -f "$DAEMON_PLIST" -ln -s "$INSTALL_DIR/$IDENTIFIER.plist" "$DAEMON_PLIST" || die "Unable to create $DAEMON_PLIST symlink" -launchctl load -w "$DAEMON_PLIST" || die "Unable to install launchctl daemon $DAEMON_PLIST" diff --git a/dev-tools/packaging/templates/darwin/scripts/preinstall.tmpl b/dev-tools/packaging/templates/darwin/scripts/preinstall.tmpl deleted file mode 100644 index 20d602bdd37..00000000000 --- a/dev-tools/packaging/templates/darwin/scripts/preinstall.tmpl +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash - diff --git a/filebeat/scripts/mage/package.go b/filebeat/scripts/mage/package.go index 8a0819caf5a..da0036d31da 100644 --- a/filebeat/scripts/mage/package.go +++ b/filebeat/scripts/mage/package.go @@ -58,9 +58,6 @@ func CustomizePackaging() { case devtools.Deb, devtools.RPM: args.Spec.Files["/usr/share/{{.BeatName}}/"+moduleTarget] = module args.Spec.Files["/etc/{{.BeatName}}/"+modulesDTarget] = modulesD - case devtools.DMG: - args.Spec.Files["/Library/Application Support/{{.BeatVendor}}/{{.BeatName}}/"+moduleTarget] = module - args.Spec.Files["/etc/{{.BeatName}}/"+modulesDTarget] = modulesD default: panic(errors.Errorf("unhandled package type: %v", pkgType)) } diff --git a/heartbeat/scripts/mage/package.go b/heartbeat/scripts/mage/package.go index 0897c897d13..d295fc657fa 100644 --- a/heartbeat/scripts/mage/package.go +++ b/heartbeat/scripts/mage/package.go @@ -52,7 +52,7 @@ func CustomizePackaging() { args.Spec.Files[monitorsDTarget] = monitorsD case devtools.TarGz, devtools.Zip: args.Spec.Files[monitorsDTarget] = monitorsD - case devtools.Deb, devtools.RPM, devtools.DMG: + case devtools.Deb, devtools.RPM: args.Spec.Files[unixMonitorsDir] = monitorsD } } diff --git a/metricbeat/scripts/mage/package.go b/metricbeat/scripts/mage/package.go index 15498e8028f..6ba347bf6f8 100644 --- a/metricbeat/scripts/mage/package.go +++ b/metricbeat/scripts/mage/package.go @@ -93,7 +93,7 @@ func CustomizePackaging() { switch pkgType { case devtools.TarGz, devtools.Zip, devtools.Docker: args.Spec.Files[modulesDTarget] = modulesD - case devtools.Deb, devtools.RPM, devtools.DMG: + case devtools.Deb, devtools.RPM: args.Spec.Files["/etc/{{.BeatName}}/"+modulesDTarget] = modulesD default: panic(errors.Errorf("unhandled package type: %v", pkgType)) @@ -219,8 +219,6 @@ func customizeLightModulesPackaging() error { args.Spec.Files[moduleTarget] = module case devtools.Deb, devtools.RPM: args.Spec.Files["/usr/share/{{.BeatName}}/"+moduleTarget] = module - case devtools.DMG: - args.Spec.Files["/Library/Application Support/{{.BeatVendor}}/{{.BeatName}}/"+moduleTarget] = module default: return fmt.Errorf("unhandled package type: %v", pkgType) } diff --git a/packetbeat/scripts/mage/package.go b/packetbeat/scripts/mage/package.go index 031ca09c894..6b5f0f06ef9 100644 --- a/packetbeat/scripts/mage/package.go +++ b/packetbeat/scripts/mage/package.go @@ -85,7 +85,7 @@ func CustomizePackaging() { args.Spec.ReplaceFile("{{.BeatName}}.yml", configYml) args.Spec.ReplaceFile("{{.BeatName}}.reference.yml", referenceConfigYml) args.Spec.ReplaceFile("NOTICE.txt", npcapNoticeTxt) - case devtools.Deb, devtools.RPM, devtools.DMG: + case devtools.Deb, devtools.RPM: args.Spec.ReplaceFile("/etc/{{.BeatName}}/{{.BeatName}}.yml", configYml) args.Spec.ReplaceFile("/etc/{{.BeatName}}/{{.BeatName}}.reference.yml", referenceConfigYml) case devtools.Docker: diff --git a/winlogbeat/scripts/mage/package.go b/winlogbeat/scripts/mage/package.go index 89fb12c5173..80768e9110c 100644 --- a/winlogbeat/scripts/mage/package.go +++ b/winlogbeat/scripts/mage/package.go @@ -83,7 +83,7 @@ func customizePackaging() { switch pkgType { case devtools.TarGz, devtools.Zip, devtools.Docker: args.Spec.Files["module"] = moduleDir - case devtools.Deb, devtools.RPM, devtools.DMG: + case devtools.Deb, devtools.RPM: args.Spec.Files["/etc/{{.BeatName}}/module"] = moduleDir default: panic(errors.Errorf("unhandled package type: %v", pkgType))