diff --git a/orbit/pkg/dialog/dialog.go b/orbit/pkg/dialog/dialog.go index c7daf8c7cd85..b0155c269bf3 100644 --- a/orbit/pkg/dialog/dialog.go +++ b/orbit/pkg/dialog/dialog.go @@ -62,7 +62,4 @@ type ProgressOptions struct { // Text sets the text of the dialog. Text string - - // Value sets the percentage of the progress bar (0-100). - Value int } diff --git a/orbit/pkg/execuser/execuser.go b/orbit/pkg/execuser/execuser.go index ac5fa4dacdf5..3687163218a0 100644 --- a/orbit/pkg/execuser/execuser.go +++ b/orbit/pkg/execuser/execuser.go @@ -3,7 +3,6 @@ package execuser import ( - "context" "io" "time" ) @@ -32,6 +31,7 @@ func WithArg(name, value string) Option { } } +// WithTimeout sets the timeout for the application. Currently only supported on Linux. func WithTimeout(duration time.Duration) Option { return func(a *eopts) { a.timeout = duration @@ -70,11 +70,3 @@ func RunWithStdin(path string, opts ...Option) (io.WriteCloser, error) { } return runWithStdin(path, o) } - -func RunWithContext(ctx context.Context, path string, opts ...Option) error { - var o eopts - for _, fn := range opts { - fn(&o) - } - return runWithContext(ctx, path, o) -} diff --git a/orbit/pkg/execuser/execuser_darwin.go b/orbit/pkg/execuser/execuser_darwin.go index 78264d509be1..78286ee5db14 100644 --- a/orbit/pkg/execuser/execuser_darwin.go +++ b/orbit/pkg/execuser/execuser_darwin.go @@ -1,7 +1,6 @@ package execuser import ( - "context" "errors" "fmt" "io" @@ -59,7 +58,3 @@ func runWithOutput(path string, opts eopts) (output []byte, exitCode int, err er func runWithStdin(path string, opts eopts) (io.WriteCloser, error) { return nil, errors.New("not implemented") } - -func runWithContext(ctx context.Context, path string, opts eopts) error { - return errors.New("not implemented") -} diff --git a/orbit/pkg/execuser/execuser_linux.go b/orbit/pkg/execuser/execuser_linux.go index d786e6820268..fbb3136926e5 100644 --- a/orbit/pkg/execuser/execuser_linux.go +++ b/orbit/pkg/execuser/execuser_linux.go @@ -3,7 +3,6 @@ package execuser import ( "bufio" "bytes" - "context" "errors" "fmt" "io" @@ -50,41 +49,6 @@ func run(path string, opts eopts) (lastLogs string, err error) { return "", nil } -// run uses sudo to run the given path as login user. -func runWithContext(ctx context.Context, path string, opts eopts) error { - args, err := getUserAndDisplayArgs(path, opts) - if err != nil { - return fmt.Errorf("get args: %w", err) - } - - args = append(args, path) - - if len(opts.args) > 0 { - for _, arg := range opts.args { - args = append(args, arg[0], arg[1]) - } - } - - cmd := exec.CommandContext(ctx, "sudo", args...) - cmd.Stderr = os.Stderr - cmd.Stdout = os.Stdout - log.Printf("cmd=%s", cmd.String()) - - if err := cmd.Start(); err != nil { - return fmt.Errorf("open path %q: %w", path, err) - } - - // Wait for the process to finish. - if err := cmd.Wait(); err != nil { - if exitErr, ok := err.(*exec.ExitError); ok { - return fmt.Errorf("%q exited with code %d: %w", path, exitErr.ExitCode(), err) - } - return fmt.Errorf("%q error: %w", path, err) - } - - return nil -} - // run uses sudo to run the given path as login user and waits for the process to finish. func runWithOutput(path string, opts eopts) (output []byte, exitCode int, err error) { args, err := getUserAndDisplayArgs(path, opts) diff --git a/orbit/pkg/execuser/execuser_windows.go b/orbit/pkg/execuser/execuser_windows.go index 4c72eab89c6d..7dd329409ed1 100644 --- a/orbit/pkg/execuser/execuser_windows.go +++ b/orbit/pkg/execuser/execuser_windows.go @@ -6,7 +6,6 @@ package execuser // To view what was modified/added, you can use the execuser_windows_diff.sh script. import ( - "context" "errors" "fmt" "io" @@ -127,10 +126,6 @@ func runWithStdin(path string, opts eopts) (io.WriteCloser, error) { return nil, errors.New("not implemented") } -func runWithContext(ctx context.Context, path string, opts eopts) error { - return errors.New("not implemented") -} - // getCurrentUserSessionId will attempt to resolve // the session ID of the user currently active on // the system. diff --git a/tools/luks/luks/main.go b/tools/luks/luks/main.go index f20c28f4e289..f8e841c854fc 100644 --- a/tools/luks/luks/main.go +++ b/tools/luks/luks/main.go @@ -24,7 +24,7 @@ func main() { prompt := zenity.New() // Prompt existing passphrase from the user. - currentPassphrase, err := prompt.ShowEntry(context.Background(), dialog.EntryOptions{ + currentPassphrase, err := prompt.ShowEntry(dialog.EntryOptions{ Title: "Enter Existing LUKS Passphrase", Text: "Enter your existing LUKS passphrase:", HideText: true, @@ -49,7 +49,7 @@ func main() { if err := device.AddKey(context.Background(), devicePath, userKey, escrowKey); err != nil { if errors.Is(err, encryption.ErrEncryptionKeyRejected) { - currentPassphrase, err = prompt.ShowEntry(context.Background(), dialog.EntryOptions{ + currentPassphrase, err = prompt.ShowEntry(dialog.EntryOptions{ Title: "Enter Existing LUKS Passphrase", Text: "Bad password. Enter your existing LUKS passphrase:", HideText: true,