diff --git a/main.go b/main.go index bbf8193..26efadb 100644 --- a/main.go +++ b/main.go @@ -69,12 +69,32 @@ func printHelp() { // checkDependencies verifies if required dependencies are installed func checkDependencies() error { - dependencies := []string{"mercurial", "python3", "rsync", "git"} - for _, dep := range dependencies { - if _, err := exec.LookPath(dep); err != nil { - return fmt.Errorf("dependency %s is not installed. Please run: sudo apt install %s", dep, dep) + dependencies := map[string]string{ + "mercurial": "hg", + "python3": "python3", + "rsync": "rsync", + "git": "git", + } + + // Log the PATH for debugging + fmt.Printf("Current PATH: %s\n", os.Getenv("PATH")) + + for dep, cmd := range dependencies { + // Use LookPath to check availability + if _, err := exec.LookPath(cmd); err != nil { + return fmt.Errorf("dependency %s is not installed or not found in PATH. Please run: sudo apt install %s", dep, dep) + } + + // For python3, run a specific version check to confirm + if dep == "python3" { + out, err := exec.Command(cmd, "--version").Output() + if err != nil { + return fmt.Errorf("dependency %s is installed but not functional. Ensure 'python3 --version' works correctly: %v", dep, err) + } + fmt.Printf("Detected %s: %s", dep, string(out)) } } + return nil }