lockbox

password manager
Log | Files | Refs | README | LICENSE

commit ab74338ba8796f44b7b2d810691a0125da2d39f5
parent 256f0110c440b956ac19af2b57b70e8cf3a6ad5b
Author: Sean Enck <sean@ttypty.com>
Date:   Sun, 21 Aug 2022 10:01:46 -0400

libexec method is deprecated

Diffstat:
MMakefile | 5+----
Minternal/inputs/env.go | 2--
Dinternal/subcommands/libexec.go | 33---------------------------------
3 files changed, 1 insertion(+), 39 deletions(-)

diff --git a/Makefile b/Makefile @@ -2,7 +2,6 @@ VERSION := development DESTDIR := BUILD := bin/ TARGETS := $(BUILD)lb $(BUILD)lb-totp -LIBEXEC := $(DESTDIR)libexec/lockbox/ MAIN := $(DESTDIR)bin/lb TESTDIR := $(sort $(dir $(wildcard internal/**/*_test.go))) @@ -11,7 +10,7 @@ TESTDIR := $(sort $(dir $(wildcard internal/**/*_test.go))) all: $(TARGETS) $(TARGETS): cmd/**/* internal/**/*.go go.* - go build -ldflags '-X main.version=$(VERSION) -X main.libExec=$(LIBEXEC) -X main.mainExe=$(MAIN)' -trimpath -buildmode=pie -mod=readonly -modcacherw -o $@ cmd/$(shell basename $@)/main.go + go build -ldflags '-X main.version=$(VERSION) -X main.mainExe=$(MAIN)' -trimpath -buildmode=pie -mod=readonly -modcacherw -o $@ cmd/$(shell basename $@)/main.go $(TESTDIR): cd $@ && go test @@ -24,5 +23,3 @@ clean: install: install -Dm755 $(BUILD)lb $(MAIN) - install -Dm755 -d $(LIBEXEC) - install -Dm755 $(BUILD)lb-* $(LIBEXEC) diff --git a/internal/inputs/env.go b/internal/inputs/env.go @@ -20,8 +20,6 @@ const ( KeyModeEnv = prefixKey + "KEYMODE" // KeyEnv is the key value used by the lockbox store. KeyEnv = prefixKey + "KEY" - // LibExecEnv is the location of libexec files for callbacks to internal exes. - LibExecEnv = prefixKey + "LIBEXEC" // HooksDirEnv is the location of hooks to run before/after operations. HooksDirEnv = prefixKey + "HOOKDIR" // PlatformEnv is the platform lb is running on. diff --git a/internal/subcommands/libexec.go b/internal/subcommands/libexec.go @@ -1,33 +0,0 @@ -// Package subcommands handles calling library commands. -package subcommands - -import ( - "errors" - "fmt" - "os" - "os/exec" - "path/filepath" - - "github.com/enckse/lockbox/internal/misc" -) - -type ( - // LibExecOptions for calling to subcommands that are executables. - LibExecOptions struct { - Directory string - Command string - Args []string - } -) - -// LibExecCallback will handle subcommand handling outside of known functions. -func LibExecCallback(args LibExecOptions) error { - tryCommand := fmt.Sprintf(filepath.Join(args.Directory, "lb-%s"), args.Command) - if !misc.PathExists(tryCommand) { - return errors.New(args.Command) - } - c := exec.Command(tryCommand, args.Args...) - c.Stdout = os.Stdout - c.Stderr = os.Stderr - return c.Run() -}