Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

package-builder: add --bin_root_dir flag #1721

Merged
merged 1 commit into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions cmd/package-builder/package-builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ func runMake(args []string) error {
env.String("PACKAGE_VERSION", ""),
"the resultant package version. If left blank, auto detection will be attempted",
)
flBinRootDir = flagset.String(
"bin_root_dir",
"/usr/local",
"the root directory path for the launcher on macOS and Linux",
)
flOsqueryVersion = flagset.String(
"osquery_version",
env.String("OSQUERY_VERSION", "stable"),
Expand Down Expand Up @@ -242,6 +247,7 @@ func runMake(args []string) error {
OmitSecret: *flOmitSecret,
CertPins: *flCertPins,
RootPEM: *flRootPEM,
BinRootDir: *flBinRootDir,
CacheDir: cacheDir,
TufServerURL: *flTufURL,
MirrorURL: *flMirrorURL,
Expand Down
3 changes: 2 additions & 1 deletion pkg/packaging/packaging.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ type PackageOptions struct {
OmitSecret bool
CertPins string
RootPEM string
BinRootDir string
CacheDir string
TufServerURL string
MirrorURL string
Expand Down Expand Up @@ -721,7 +722,7 @@ fi`
func (p *PackageOptions) setupDirectories() error {
switch p.target.Platform {
case Linux, Darwin:
p.binDir = filepath.Join("/usr/local", p.Identifier, "bin")
p.binDir = filepath.Join(p.BinRootDir, p.Identifier, "bin")
p.confDir = filepath.Join("/etc", p.Identifier)
p.rootDir = filepath.Join("/var", p.Identifier, sanitizeHostname(p.Hostname))
case Windows:
Expand Down
Loading