diff --git a/CHANGELOG.md b/CHANGELOG.md index 09dff66..5d804de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # CHANGELOG +## v3.3.1 (2024-11-22) + +- Only upgrade Casks on macOS since they aren't supported on Linux + ## v3.3.0 (2024-08-22) - Adds support for Go `1.22` and `1.23` diff --git a/src/brew/update.go b/src/brew/update.go index 266bc8b..5cb75ac 100644 --- a/src/brew/update.go +++ b/src/brew/update.go @@ -5,6 +5,7 @@ import ( "log" "os" "os/exec" + "runtime" "strings" "github.com/Justintime50/alchemist/v3/src/general" @@ -40,20 +41,22 @@ func Update(greedy bool) { os.Exit(1) } - fmt.Println("Alchemist is upgrading brew casks...") - upgradeCaskCommand := []string{"upgrade", "--cask"} - if greedy { - upgradeCaskCommand = []string{"upgrade", "--cask", "--greedy"} - } - upgradeCasks, upgradeCasksErr := general.RunCommand(exec.Command, "brew", upgradeCaskCommand) - // Skip if no errors or if the cask cannot be updated due to having a manual installer - if upgradeCasks != nil || strings.Contains(fmt.Sprint(upgradeCasksErr), "installer manual") { - fmt.Println("Alchemist upgraded brew casks!") - log.Printf("brew upgrade --cask: %s", upgradeCasks) - } else { - fmt.Println("Alchemist could not upgrade brew casks, please see logs for details.") - log.Printf("brew upgrade --cask: %s", upgradeCasksErr) - os.Exit(1) + if runtime.GOOS == "darwin" { + fmt.Println("Alchemist is upgrading brew casks...") + upgradeCaskCommand := []string{"upgrade", "--cask"} + if greedy { + upgradeCaskCommand = []string{"upgrade", "--cask", "--greedy"} + } + upgradeCasks, upgradeCasksErr := general.RunCommand(exec.Command, "brew", upgradeCaskCommand) + // Skip if no errors or if the cask cannot be updated due to having a manual installer + if upgradeCasks != nil || strings.Contains(fmt.Sprint(upgradeCasksErr), "installer manual") { + fmt.Println("Alchemist upgraded brew casks!") + log.Printf("brew upgrade --cask: %s", upgradeCasks) + } else { + fmt.Println("Alchemist could not upgrade brew casks, please see logs for details.") + log.Printf("brew upgrade --cask: %s", upgradeCasksErr) + os.Exit(1) + } } fmt.Println("Alchemist is cleaning up brew...")