diff --git a/delegate.go b/delegate.go new file mode 100644 index 0000000..c4f5f24 --- /dev/null +++ b/delegate.go @@ -0,0 +1,29 @@ +package main + +import ( + "fmt" + "os" + + "github.com/ipfs/kubo/repo/fsrepo/migrations" +) + +// 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 Kubo v0.37+ is detected. +func exitIfBuiltinUpdateAvailable() { + repoVer, err := migrations.RepoVersion("") + if err != nil { + return + } + if repoVer <= maxLegacyRepoVersion { + return + } + + 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) +} 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" }