Skip to content

Commit 7e4ce52

Browse files
authored
Merge branch 'main' into danny/kernel-742-create-yutori-n1-computer-use-cli-templates-typescript
2 parents 1277f3e + 824bdaa commit 7e4ce52

1 file changed

Lines changed: 45 additions & 0 deletions

File tree

pkg/update/check.go

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,39 @@ func FetchLatest(ctx context.Context) (tag string, url string, err error) {
125125
return "", "", errors.New("no stable releases found")
126126
}
127127

128+
// isOnOldBrewTap checks if the user has kernel installed from onkernel/tap
129+
// instead of the current kernel/tap by checking the install receipt.
130+
func isOnOldBrewTap() bool {
131+
// Find the Homebrew Cellar path
132+
cellarPaths := []string{
133+
"/opt/homebrew/Cellar/kernel", // Apple Silicon
134+
"/usr/local/Cellar/kernel", // Intel Mac
135+
"/home/linuxbrew/.linuxbrew/Cellar/kernel", // Linux
136+
}
137+
138+
for _, cellar := range cellarPaths {
139+
entries, err := os.ReadDir(cellar)
140+
if err != nil {
141+
continue
142+
}
143+
for _, entry := range entries {
144+
if !entry.IsDir() {
145+
continue
146+
}
147+
receiptPath := filepath.Join(cellar, entry.Name(), "INSTALL_RECEIPT.json")
148+
data, err := os.ReadFile(receiptPath)
149+
if err != nil {
150+
continue
151+
}
152+
// Check if installed from onkernel/tap
153+
if strings.Contains(string(data), `"tap":"onkernel/tap"`) {
154+
return true
155+
}
156+
}
157+
}
158+
return false
159+
}
160+
128161
// printUpgradeMessage prints a concise upgrade banner.
129162
func printUpgradeMessage(current, latest, url string) {
130163
cur := strings.TrimPrefix(current, "v")
@@ -134,6 +167,18 @@ func printUpgradeMessage(current, latest, url string) {
134167
if url != "" {
135168
pterm.Info.Printf("Release notes: %s\n", url)
136169
}
170+
171+
method, _ := DetectInstallMethod()
172+
if method == InstallMethodBrew && isOnOldBrewTap() {
173+
pterm.Println()
174+
pterm.Warning.Println("You have kernel installed from the old tap (onkernel/tap).")
175+
pterm.Warning.Println("To upgrade, switch to the new tap:")
176+
pterm.Println()
177+
pterm.Println(" brew uninstall kernel")
178+
pterm.Println(" brew install kernel/tap/kernel")
179+
return
180+
}
181+
137182
if cmd := SuggestUpgradeCommand(); cmd != "" {
138183
pterm.Info.Printf("To upgrade, run: %s\n", cmd)
139184
} else {

0 commit comments

Comments
 (0)