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 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370
|
Description: remove self-update functionality
Author: Félix Sipma <felix@debian.org>
Forwarded: not-needed
Last-Update: 2024-02-09
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/doc/manual_rest.rst
+++ b/doc/manual_rest.rst
@@ -51,7 +51,6 @@ Usage help is available:
Additional Commands:
generate Generate manual pages and auto-completion files (bash, fish, zsh, powershell)
help Help about any command
- self-update Update the restic binary
version Print version information
Flags:
--- a/doc/bash-completion.sh
+++ b/doc/bash-completion.sh
@@ -3343,80 +3343,6 @@ _restic_rewrite()
noun_aliases=()
}
-_restic_self-update()
-{
- last_command="restic_self-update"
-
- command_aliases=()
-
- commands=()
-
- flags=()
- two_word_flags=()
- local_nonpersistent_flags=()
- flags_with_completion=()
- flags_completion=()
-
- flags+=("--help")
- flags+=("-h")
- local_nonpersistent_flags+=("--help")
- local_nonpersistent_flags+=("-h")
- flags+=("--output=")
- two_word_flags+=("--output")
- local_nonpersistent_flags+=("--output")
- local_nonpersistent_flags+=("--output=")
- flags+=("--cacert=")
- two_word_flags+=("--cacert")
- flags+=("--cache-dir=")
- two_word_flags+=("--cache-dir")
- flags+=("--cleanup-cache")
- flags+=("--compression=")
- two_word_flags+=("--compression")
- flags+=("--http-user-agent=")
- two_word_flags+=("--http-user-agent")
- flags+=("--insecure-no-password")
- flags+=("--insecure-tls")
- flags+=("--json")
- flags+=("--key-hint=")
- two_word_flags+=("--key-hint")
- flags+=("--limit-download=")
- two_word_flags+=("--limit-download")
- flags+=("--limit-upload=")
- two_word_flags+=("--limit-upload")
- flags+=("--no-cache")
- flags+=("--no-extra-verify")
- flags+=("--no-lock")
- flags+=("--option=")
- two_word_flags+=("--option")
- two_word_flags+=("-o")
- flags+=("--pack-size=")
- two_word_flags+=("--pack-size")
- flags+=("--password-command=")
- two_word_flags+=("--password-command")
- flags+=("--password-file=")
- two_word_flags+=("--password-file")
- two_word_flags+=("-p")
- flags+=("--quiet")
- flags+=("-q")
- flags+=("--repo=")
- two_word_flags+=("--repo")
- two_word_flags+=("-r")
- flags+=("--repository-file=")
- two_word_flags+=("--repository-file")
- flags+=("--retry-lock=")
- two_word_flags+=("--retry-lock")
- flags+=("--stuck-request-timeout=")
- two_word_flags+=("--stuck-request-timeout")
- flags+=("--tls-client-cert=")
- two_word_flags+=("--tls-client-cert")
- flags+=("--verbose")
- flags+=("-v")
-
- must_have_one_flag=()
- must_have_one_noun=()
- noun_aliases=()
-}
-
_restic_snapshots()
{
last_command="restic_snapshots"
@@ -3874,7 +3800,6 @@ _restic_root_command()
commands+=("repair")
commands+=("restore")
commands+=("rewrite")
- commands+=("self-update")
commands+=("snapshots")
commands+=("stats")
commands+=("tag")
--- a/cmd/restic/main.go
+++ b/cmd/restic/main.go
@@ -110,7 +110,7 @@ The full documentation can be found at h
// user for authentication).
func needsPassword(cmd string) bool {
switch cmd {
- case "cache", "generate", "help", "options", "self-update", "version", "__complete":
+ case "cache", "generate", "help", "options", "version", "__complete":
return false
default:
return true
--- a/doc/man/restic-self-update.1
+++ /dev/null
@@ -1,138 +0,0 @@
-.nh
-.TH "restic backup" "1" "Jan 2017" "generated by \fBrestic generate\fR" ""
-
-.SH NAME
-restic-self-update - Update the restic binary
-
-
-.SH SYNOPSIS
-\fBrestic self-update [flags]\fP
-
-
-.SH DESCRIPTION
-The command "self-update" downloads the latest stable release of restic from
-GitHub and replaces the currently running binary. After download, the
-authenticity of the binary is verified using the GPG signature on the release
-files.
-
-
-.SH EXIT STATUS
-Exit status is 0 if the command was successful.
-Exit status is 1 if there was any error.
-Exit status is 10 if the repository does not exist.
-Exit status is 11 if the repository is already locked.
-Exit status is 12 if the password is incorrect.
-
-
-.SH OPTIONS
-\fB-h\fP, \fB--help\fP[=false]
- help for self-update
-
-.PP
-\fB--output\fP=""
- Save the downloaded file as \fBfilename\fR (default: running binary itself)
-
-
-.SH OPTIONS INHERITED FROM PARENT COMMANDS
-\fB--cacert\fP=[]
- \fBfile\fR to load root certificates from (default: use system certificates or $RESTIC_CACERT)
-
-.PP
-\fB--cache-dir\fP=""
- set the cache \fBdirectory\fR\&. (default: use system default cache directory)
-
-.PP
-\fB--cleanup-cache\fP[=false]
- auto remove old cache directories
-
-.PP
-\fB--compression\fP=auto
- compression mode (only available for repository format version 2), one of (auto|off|max) (default: $RESTIC_COMPRESSION)
-
-.PP
-\fB--http-user-agent\fP=""
- set a http user agent for outgoing http requests
-
-.PP
-\fB--insecure-no-password\fP[=false]
- use an empty password for the repository, must be passed to every restic command (insecure)
-
-.PP
-\fB--insecure-tls\fP[=false]
- skip TLS certificate verification when connecting to the repository (insecure)
-
-.PP
-\fB--json\fP[=false]
- set output mode to JSON for commands that support it
-
-.PP
-\fB--key-hint\fP=""
- \fBkey\fR ID of key to try decrypting first (default: $RESTIC_KEY_HINT)
-
-.PP
-\fB--limit-download\fP=0
- limits downloads to a maximum \fBrate\fR in KiB/s. (default: unlimited)
-
-.PP
-\fB--limit-upload\fP=0
- limits uploads to a maximum \fBrate\fR in KiB/s. (default: unlimited)
-
-.PP
-\fB--no-cache\fP[=false]
- do not use a local cache
-
-.PP
-\fB--no-extra-verify\fP[=false]
- skip additional verification of data before upload (see documentation)
-
-.PP
-\fB--no-lock\fP[=false]
- do not lock the repository, this allows some operations on read-only repositories
-
-.PP
-\fB-o\fP, \fB--option\fP=[]
- set extended option (\fBkey=value\fR, can be specified multiple times)
-
-.PP
-\fB--pack-size\fP=0
- set target pack \fBsize\fR in MiB, created pack files may be larger (default: $RESTIC_PACK_SIZE)
-
-.PP
-\fB--password-command\fP=""
- shell \fBcommand\fR to obtain the repository password from (default: $RESTIC_PASSWORD_COMMAND)
-
-.PP
-\fB-p\fP, \fB--password-file\fP=""
- \fBfile\fR to read the repository password from (default: $RESTIC_PASSWORD_FILE)
-
-.PP
-\fB-q\fP, \fB--quiet\fP[=false]
- do not output comprehensive progress report
-
-.PP
-\fB-r\fP, \fB--repo\fP=""
- \fBrepository\fR to backup to or restore from (default: $RESTIC_REPOSITORY)
-
-.PP
-\fB--repository-file\fP=""
- \fBfile\fR to read the repository location from (default: $RESTIC_REPOSITORY_FILE)
-
-.PP
-\fB--retry-lock\fP=0s
- retry to lock the repository if it is already locked, takes a value like 5m or 2h (default: no retries)
-
-.PP
-\fB--stuck-request-timeout\fP=5m0s
- \fBduration\fR after which to retry stuck requests
-
-.PP
-\fB--tls-client-cert\fP=""
- path to a \fBfile\fR containing PEM encoded TLS client certificate and private key (default: $RESTIC_TLS_CLIENT_CERT)
-
-.PP
-\fB-v\fP, \fB--verbose\fP[=0]
- be verbose (specify multiple times or a level using --verbose=n``, max level/times is 2)
-
-
-.SH SEE ALSO
-\fBrestic(1)\fP
--- a/doc/man/restic.1
+++ b/doc/man/restic.1
@@ -123,4 +123,4 @@ The full documentation can be found at h
.SH SEE ALSO
-\fBrestic-backup(1)\fP, \fBrestic-cache(1)\fP, \fBrestic-cat(1)\fP, \fBrestic-check(1)\fP, \fBrestic-copy(1)\fP, \fBrestic-diff(1)\fP, \fBrestic-dump(1)\fP, \fBrestic-features(1)\fP, \fBrestic-find(1)\fP, \fBrestic-forget(1)\fP, \fBrestic-generate(1)\fP, \fBrestic-init(1)\fP, \fBrestic-key(1)\fP, \fBrestic-list(1)\fP, \fBrestic-ls(1)\fP, \fBrestic-migrate(1)\fP, \fBrestic-mount(1)\fP, \fBrestic-options(1)\fP, \fBrestic-prune(1)\fP, \fBrestic-recover(1)\fP, \fBrestic-repair(1)\fP, \fBrestic-restore(1)\fP, \fBrestic-rewrite(1)\fP, \fBrestic-self-update(1)\fP, \fBrestic-snapshots(1)\fP, \fBrestic-stats(1)\fP, \fBrestic-tag(1)\fP, \fBrestic-unlock(1)\fP, \fBrestic-version(1)\fP
+\fBrestic-backup(1)\fP, \fBrestic-cache(1)\fP, \fBrestic-cat(1)\fP, \fBrestic-check(1)\fP, \fBrestic-copy(1)\fP, \fBrestic-diff(1)\fP, \fBrestic-dump(1)\fP, \fBrestic-features(1)\fP, \fBrestic-find(1)\fP, \fBrestic-forget(1)\fP, \fBrestic-generate(1)\fP, \fBrestic-init(1)\fP, \fBrestic-key(1)\fP, \fBrestic-list(1)\fP, \fBrestic-ls(1)\fP, \fBrestic-migrate(1)\fP, \fBrestic-mount(1)\fP, \fBrestic-options(1)\fP, \fBrestic-prune(1)\fP, \fBrestic-recover(1)\fP, \fBrestic-repair(1)\fP, \fBrestic-restore(1)\fP, \fBrestic-rewrite(1)\fP, \fBrestic-snapshots(1)\fP, \fBrestic-stats(1)\fP, \fBrestic-tag(1)\fP, \fBrestic-unlock(1)\fP, \fBrestic-version(1)\fP
--- a/cmd/restic/cmd_self_update.go
+++ /dev/null
@@ -1,100 +0,0 @@
-//go:build selfupdate
-
-package main
-
-import (
- "context"
- "os"
- "path/filepath"
-
- "github.com/restic/restic/internal/errors"
- "github.com/restic/restic/internal/selfupdate"
- "github.com/spf13/cobra"
- "github.com/spf13/pflag"
-)
-
-func registerSelfUpdateCommand(cmd *cobra.Command) {
- cmd.AddCommand(
- newSelfUpdateCommand(),
- )
-}
-
-func newSelfUpdateCommand() *cobra.Command {
- var opts SelfUpdateOptions
-
- cmd := &cobra.Command{
- Use: "self-update [flags]",
- Short: "Update the restic binary",
- Long: `
-The command "self-update" downloads the latest stable release of restic from
-GitHub and replaces the currently running binary. After download, the
-authenticity of the binary is verified using the GPG signature on the release
-files.
-
-EXIT STATUS
-===========
-
-Exit status is 0 if the command was successful.
-Exit status is 1 if there was any error.
-Exit status is 10 if the repository does not exist.
-Exit status is 11 if the repository is already locked.
-Exit status is 12 if the password is incorrect.
-`,
- DisableAutoGenTag: true,
- RunE: func(cmd *cobra.Command, args []string) error {
- return runSelfUpdate(cmd.Context(), opts, globalOptions, args)
- },
- }
-
- opts.AddFlags(cmd.Flags())
- return cmd
-}
-
-// SelfUpdateOptions collects all options for the update-restic command.
-type SelfUpdateOptions struct {
- Output string
-}
-
-func (opts *SelfUpdateOptions) AddFlags(f *pflag.FlagSet) {
- f.StringVar(&opts.Output, "output", "", "Save the downloaded file as `filename` (default: running binary itself)")
-}
-
-func runSelfUpdate(ctx context.Context, opts SelfUpdateOptions, gopts GlobalOptions, args []string) error {
- if opts.Output == "" {
- file, err := os.Executable()
- if err != nil {
- return errors.Wrap(err, "unable to find executable")
- }
-
- opts.Output = file
- }
-
- fi, err := os.Lstat(opts.Output)
- if err != nil {
- dirname := filepath.Dir(opts.Output)
- di, err := os.Lstat(dirname)
- if err != nil {
- return err
- }
- if !di.Mode().IsDir() {
- return errors.Fatalf("output parent path %v is not a directory, use --output to specify a different file path", dirname)
- }
- } else {
- if !fi.Mode().IsRegular() {
- return errors.Fatalf("output path %v is not a normal file, use --output to specify a different file path", opts.Output)
- }
- }
-
- Verbosef("writing restic to %v\n", opts.Output)
-
- v, err := selfupdate.DownloadLatestStableRelease(ctx, opts.Output, version, Verbosef)
- if err != nil {
- return errors.Fatalf("unable to update restic: %v", err)
- }
-
- if v != version {
- Printf("successfully updated restic to version %v\n", v)
- }
-
- return nil
-}
|