Skip to content

Commit c8615fd

Browse files
committed
fix: remove redundant sudo prompt from CLI, let install.sh handle it
1 parent 5353ecb commit c8615fd

2 files changed

Lines changed: 3 additions & 20 deletions

File tree

internal/brew/brew.go

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ func InstallWithProgress(cliPkgs, caskPkgs []string, dryRun bool) error {
177177
return nil
178178
}
179179

180-
if err := PreInstallChecks(total, len(caskPkgs) > 0); err != nil {
180+
if err := PreInstallChecks(total); err != nil {
181181
return err
182182
}
183183

@@ -318,11 +318,9 @@ func installFormulaWithError(pkg string) string {
318318

319319
func installSmartCaskWithError(pkg string) string {
320320
cmd := exec.Command("brew", "install", "--cask", pkg)
321-
cmd.Stdin = os.Stdin
322321
output, err := cmd.CombinedOutput()
323322
if err != nil {
324323
cmd2 := exec.Command("brew", "install", pkg)
325-
cmd2.Stdin = os.Stdin
326324
output2, err2 := cmd2.CombinedOutput()
327325
if err2 != nil {
328326
errMsg := parseBrewError(string(output))
@@ -473,18 +471,7 @@ func DoctorDiagnose() ([]string, error) {
473471
return suggestions, nil
474472
}
475473

476-
func RefreshSudo() {
477-
if exec.Command("sudo", "-n", "true").Run() == nil {
478-
return
479-
}
480-
cmd := exec.Command("sudo", "-v")
481-
cmd.Stdin = os.Stdin
482-
cmd.Stdout = os.Stdout
483-
cmd.Stderr = os.Stderr
484-
cmd.Run()
485-
}
486-
487-
func PreInstallChecks(packageCount int, hasCasks bool) error {
474+
func PreInstallChecks(packageCount int) error {
488475
ui.Info("Checking network connectivity...")
489476
if err := CheckNetwork(); err != nil {
490477
return fmt.Errorf("network check failed: %v\nPlease check your internet connection and try again", err)
@@ -505,9 +492,5 @@ func PreInstallChecks(packageCount int, hasCasks bool) error {
505492
}
506493
}
507494

508-
if hasCasks {
509-
RefreshSudo()
510-
}
511-
512495
return nil
513496
}

internal/installer/installer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func Run(cfg *config.Config) error {
2727

2828
func runInstall(cfg *config.Config) error {
2929
fmt.Println()
30-
ui.Header("OpenBoot Installer v0.9.6")
30+
ui.Header("OpenBoot Installer v0.9.7")
3131
fmt.Println()
3232

3333
if cfg.DryRun {

0 commit comments

Comments
 (0)