From da1da3b42bc46497aa43048e4982c964d2e3d0e9 Mon Sep 17 00:00:00 2001 From: Marcin Rataj Date: Fri, 10 Apr 2026 23:54:47 +0200 Subject: [PATCH 1/2] feat: exit early when built-in `ipfs update` is available When the IPFS repo version is >16, the installed Kubo ships with a built-in `ipfs update` command. Rather than running legacy logic, exit with a message pointing users to `ipfs update --help`. Part of ipfs/kubo#10937. - add delegate.go with repo version check - call exitIfBuiltinUpdateAvailable() in main before CLI setup - bump version to v1.10.0 --- delegate.go | 30 ++++++++++++++++++++++++++++++ main.go | 2 ++ version.json | 2 +- 3 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 delegate.go diff --git a/delegate.go b/delegate.go new file mode 100644 index 0000000..f78601f --- /dev/null +++ b/delegate.go @@ -0,0 +1,30 @@ +package main + +import ( + "fmt" + "os" + + "github.com/ipfs/kubo/repo/fsrepo/migrations" +) + +// delegateMinRepoVersion is the repo version above which ipfs-update +// refuses to run and points users to the built-in `ipfs update` command. +const delegateMinRepoVersion = 16 + +// exitIfBuiltinUpdateAvailable checks the IPFS repo version and exits +// with guidance to use `ipfs update` when the repo version indicates +// a Kubo release that ships the built-in update command. +func exitIfBuiltinUpdateAvailable() { + repoVer, err := migrations.RepoVersion("") + if err != nil { + return + } + if repoVer <= delegateMinRepoVersion { + return + } + + fmt.Fprintf(os.Stderr, "IPFS repo version %d detected (> %d).\n", repoVer, delegateMinRepoVersion) + fmt.Fprintf(os.Stderr, "Your Kubo version has a built-in update command.\n") + fmt.Fprintf(os.Stderr, "Run `ipfs update --help` instead of ipfs-update.\n") + os.Exit(1) +} diff --git a/main.go b/main.go index 359f294..912c7e4 100644 --- a/main.go +++ b/main.go @@ -48,6 +48,8 @@ Otherwise you can close this window.`, exeName, windowsHelpURL) } } + exitIfBuiltinUpdateAvailable() + app := cli.NewApp() app.Usage = "Update ipfs." app.Version = CurrentVersionNumber diff --git a/version.json b/version.json index f4c86bc..0280025 100644 --- a/version.json +++ b/version.json @@ -1,3 +1,3 @@ { - "version": "v1.9.0" + "version": "v1.10.0" } From ff84bc8cfca127bd56ddc1c697fb1a19c736492d Mon Sep 17 00:00:00 2001 From: Marcin Rataj Date: Fri, 10 Apr 2026 23:59:47 +0200 Subject: [PATCH 2/2] fix: reference Kubo v0.37 in sunset message Repo version 17+ means Kubo v0.37 or later, which embedded migration tooling. Clarify this in the exit message. --- delegate.go | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/delegate.go b/delegate.go index f78601f..c4f5f24 100644 --- a/delegate.go +++ b/delegate.go @@ -7,24 +7,23 @@ import ( "github.com/ipfs/kubo/repo/fsrepo/migrations" ) -// delegateMinRepoVersion is the repo version above which ipfs-update -// refuses to run and points users to the built-in `ipfs update` command. -const delegateMinRepoVersion = 16 +// maxLegacyRepoVersion is the last repo version that requires ipfs-update. +// Kubo v0.37+ migrated to repo version 17 and embedded migration tooling, +// making ipfs-update unnecessary. +const maxLegacyRepoVersion = 16 // exitIfBuiltinUpdateAvailable checks the IPFS repo version and exits -// with guidance to use `ipfs update` when the repo version indicates -// a Kubo release that ships the built-in update command. +// with guidance to use `ipfs update` when Kubo v0.37+ is detected. func exitIfBuiltinUpdateAvailable() { repoVer, err := migrations.RepoVersion("") if err != nil { return } - if repoVer <= delegateMinRepoVersion { + if repoVer <= maxLegacyRepoVersion { return } - fmt.Fprintf(os.Stderr, "IPFS repo version %d detected (> %d).\n", repoVer, delegateMinRepoVersion) - fmt.Fprintf(os.Stderr, "Your Kubo version has a built-in update command.\n") - fmt.Fprintf(os.Stderr, "Run `ipfs update --help` instead of ipfs-update.\n") + fmt.Fprintf(os.Stderr, "IPFS repo version %d (> %d) detected, indicating Kubo v0.37 or later.\n", repoVer, maxLegacyRepoVersion) + fmt.Fprintf(os.Stderr, "ipfs-update is no longer needed. Use `ipfs update --help` instead.\n") os.Exit(1) }