1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
|
From: Maytham Alsudany <maytha8thedev@gmail.com>
Date: Mon, 13 Nov 2023 19:18:28 +0800
Subject: Remove kitten update-self command
Forwarded: not-needed
Command does not work as the build is not standalone and is unneeded since this
is a package.
--- a/tools/cmd/update_self/main.go
+++ b/tools/cmd/update_self/main.go
@@ -4,68 +4,18 @@
import (
"fmt"
- "os"
- "path/filepath"
- "runtime"
-
- "kitty"
"kitty/tools/cli"
- "kitty/tools/tty"
- "kitty/tools/tui"
- "kitty/tools/utils"
-
- "golang.org/x/sys/unix"
)
-var _ = fmt.Print
-
type Options struct {
FetchVersion string
}
-func update_self(version string) (err error) {
- exe := ""
- exe, err = os.Executable()
- if err != nil {
- return fmt.Errorf("Failed to determine path to kitten: %w", err)
- }
- exe, err = filepath.EvalSymlinks(exe)
- if err != nil {
- return err
- }
- if kitty.IsStandaloneBuild == "" {
- return fmt.Errorf("This is not a standalone kitten executable. You must update all of kitty instead.")
- }
- rv := "v" + version
- if version == "nightly" {
- rv = version
- }
- url_base := fmt.Sprintf("https://github.com/kovidgoyal/kitty/releases/download/%s", rv)
- if version == "latest" {
- url_base = "https://github.com/kovidgoyal/kitty/releases/latest/download"
- }
- url := fmt.Sprintf("%s/kitten-%s-%s", url_base, runtime.GOOS, runtime.GOARCH)
- dest, err := os.CreateTemp(filepath.Dir(exe), "kitten.")
- if err != nil {
- return err
- }
- defer func() { os.Remove(dest.Name()) }()
+var update_self_disabled = "This option has been disabled in the Debian package since the releases are managed via the Debian archive. Please update the package via apt for latest kitten/kitty binary in the archive."
- if !tty.IsTerminal(os.Stdout.Fd()) {
- fmt.Println("Downloading:", url)
- err = utils.DownloadToFile(exe, url, nil, nil)
- if err != nil {
- return err
- }
- fmt.Println("Downloaded to:", exe)
- } else {
- err = tui.DownloadFileWithProgress(exe, url, true)
- if err != nil {
- return err
- }
- }
- fmt.Print("Updated to: ")
- return unix.Exec(exe, []string{"kitten", "--version"}, os.Environ())
+func update_self(version string) (err error) {
+ fmt.Println(update_self_disabled)
+ return nil
}
func EntryPoint(root *cli.Command) *cli.Command {
@@ -73,7 +23,7 @@
Name: "update-self",
Usage: "[options]",
ShortDescription: "Update this kitten binary",
- HelpText: "Update this kitten binary in place to the latest available version.",
+ HelpText: update_self_disabled,
Run: func(cmd *cli.Command, args []string) (ret int, err error) {
if len(args) != 0 {
return 1, fmt.Errorf("No command line arguments are allowed")
@@ -89,7 +39,7 @@
sc.Add(cli.OptionSpec{
Name: "--fetch-version",
Default: "latest",
- Help: fmt.Sprintf("The version to fetch. The special words :code:`latest` and :code:`nightly` fetch the latest stable and nightly release respectively. Other values can be, for example: :code:`%s`.", kitty.VersionString),
+ Help: update_self_disabled,
})
return sc
}
|