2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-15 17:47:21 +00:00
Commit Graph

53 Commits

Author SHA1 Message Date
Michael Eischer
2e3d4640be Don't buffer the golang log output when running tests 2022-12-10 16:08:27 +01:00
Michael Eischer
6d2d297215 pass global context through cobra 2022-10-03 00:19:46 +02:00
greatroar
f92ecf13c9 all: Move away from pkg/errors, easy cases
github.com/pkg/errors is no longer getting updates, because Go 1.13
went with the more flexible errors.{As,Is} function. Use those instead:
errors from pkg/errors already support the Unwrap interface used by 1.13
error handling. Also:

* check for io.EOF with a straight ==. That value should not be wrapped,
  and the chunker (whose error is checked in the cases changed) does not
  wrap it.
* Give custom Error methods pointer receivers, so there's no ambiguity
  when type-switching since the value type will no longer implement error.
* Make restic.ErrAlreadyLocked private, and rename it to
  alreadyLockedError to match the stdlib convention that error type
  names end in Error.
* Same with rest.ErrIsNotExist => rest.notExistError.
* Make s3.Backend.IsAccessDenied a private function.
2022-06-14 08:36:38 +02:00
Michael Eischer
2e1613d4c6 errors: Ensure that errors.IsFatal(errors.Fatal("err")) == true
This fixes a few cases where restic output "Fatal: Fatal: [...]"
2022-03-28 22:09:49 +02:00
Michael Eischer
97388b3504 Properly check that --quiet and --verbose are not combined
If --verbose is specified once, then globalOptions.Verbose == 1.
Previously --quiet --verbose would silently ignore the --verbose flag.
2020-12-30 21:24:18 +01:00
greatroar
feedf0ebce Don't read password for generate, help or self-update
Fixes #2951.
2020-10-05 19:54:07 +02:00
Pauline Middelink
7048cc3e58 Add copy functionality
Add a copy command to copy snapshots between repositories. It allows the user
to specify a destination repository, password, password-file, password-command
or key-hint to supply the necessary details to open the destination repository.

You need to supply a list of snapshots to copy, snapshots which already exist
in the destination repository will be skipped.

Note, when using the network this becomes rather slow, as it needs to read the
blocks, decrypt them using the source key, then encrypt them again using the
destination key before finally writing them out to the destination repository.
2020-08-26 22:17:52 +02:00
Michael Eischer
3ce9893e0b Don't print a stacktrace if some files could not be read 2020-07-28 23:52:48 +02:00
David Sommer
5729d967f5 backup: Return exit status code 3 when failing to read source data
The backup command used to return a zero exit code as long as a snapshot
could be created successfully, even if some of the source files could not
be read (in which case the snapshot would contain the rest of the files).

This made it hard for automation/scripts to detect failures/incomplete
backups by looking at the exit code. Restic now returns the following exit
codes for the backup command:

 - 0 when the command was successful
 - 1 when there was a fatal error (no snapshot created)
 - 3 when some source data could not be read (incomplete snapshot created)
2020-07-20 22:19:01 +02:00
Juergen Hoetzel
df7f72cdde Add support for reading password from external command
This allows reading the password from an password manager (like "pass").

Signed-off-by: Juergen Hoetzel <juergen@archlinux.org>
2018-11-26 20:18:31 +01:00
Alexander Neumann
0e78ac92d8 Use new archiver code for backup 2018-04-28 22:08:11 +02:00
Alexander Neumann
9fac2ca832 Add flags to set verbosity 2018-04-25 14:42:45 +02:00
Leo R. Lundgren
923be90906 Make version output one line. 2018-03-21 21:49:03 +01:00
Eri Bastos
b9d643358a Skip checking for password file existence if command is 'version' - Issue #1632 2018-03-08 17:55:03 -04:00
Shayne Holmes
9eb39cef05 Capitalize short help commands
Unify existing Cobra help command, and git-help's style.
2017-09-11 09:32:44 -07:00
Michael Pratt
e4c469c149 debug: properly handle interrupted profiles
By default (i.e., without profile.NoShutdownHook), profile.Start listens
for SIGINT and will stop the profile and call os.Exit(0).

restic already listens for SIGINT and runs its own cleanup handlers
before calling os.Exit(0).

As is, these handlers are racing when an interrupt occurs, and in my
experience, restic tends to win the race, resulting in an unusable
profile.

Eliminate the race and properly stop profiles on interrupt by disabling
package profile's signal handler and instead stop the profile in a
restic cleanup handler.
2017-08-28 22:03:26 -07:00
Alexander Neumann
6bc43a4198 manpage: Remove auto gen tag from man page 2017-08-06 21:31:01 +02:00
Pauline Middelink
d5615a67c8 Refactor password resolving.
Instead of determining the password lazily during ReadPassword(), do so now in
cobra.PersistentPreRunE() so we can store the result in the globalOptions and
reuse/override when applicable without having to worry about the environment
or flag options interfering.
2017-07-24 23:05:37 +02:00
Alexander Neumann
23c903074c Move restic package to internal/restic 2017-07-24 17:43:32 +02:00
Alexander Neumann
6caeff2408 Run goimports 2017-07-23 14:21:03 +02:00
Alexander Neumann
83d1a46526 Moves files 2017-07-23 14:19:13 +02:00
Alexander Neumann
b63399d606 Move things around for gb
This moves all restic source files to src/, and all vendored
dependencies to vendor/src.
2016-02-20 17:31:20 +01:00
Alexander Neumann
1dd4c52a8b Add comments, configure flag library 2016-01-17 18:48:05 +01:00
Alexander Neumann
76817da922 Run cleanup handlers in main function 2015-07-19 17:57:18 +02:00
Alexander Neumann
159b9e80c4 cmd/restic: implement lock refresh 2015-07-12 22:10:01 +02:00
Alexander Neumann
4388474cdc Restructure cmd/restic, no functional changes 2015-06-21 17:40:22 +02:00
Alexander Neumann
2fa259816b rename opts to mainOpts 2015-06-21 17:40:22 +02:00
Alexander Neumann
fd80499954 Refactor terminal recognition, add --quiet parameter 2015-06-07 18:30:11 +02:00
Alexander Neumann
f5537e7a0e Refactor configuration of cache dir and repository 2015-06-07 18:15:03 +02:00
Alexander Neumann
95536e8a21 Rename 'Repo' -> 'Repository' 2015-05-09 23:59:58 +02:00
Alexander Neumann
232c472836 Move package 'repo' to package 'repository' 2015-05-09 23:52:03 +02:00
Alexander Neumann
ae21938f3e Rename 'Repository' -> Repo 2015-05-09 17:41:28 +02:00
Alexander Neumann
87ebf12945 Rename 'Server' to 'Repository' 2015-05-09 13:25:52 +02:00
Alexander Neumann
8be9e95d20 Rename package 'server' to 'repo' 2015-05-09 13:24:15 +02:00
Alexander Neumann
bdbb3ab329 Remove pools.go 2015-05-05 00:14:07 +02:00
Alexander Neumann
35af933f24 server: Rename CreateMasterKey() to Init() 2015-05-04 20:40:17 +02:00
Alexander Neumann
d4bf5bb279 server: Add config 2015-05-03 18:56:20 +02:00
Alexander Neumann
bebb08ee7e server/key: Rename CreateKey -> CreateMasterKey 2015-05-03 18:56:20 +02:00
Alexander Neumann
d19b23d4f1 Move Server and Key to new sub-package 2015-04-26 14:46:15 +02:00
Alexander Neumann
fd472cb59d Use short ID for init 2015-04-25 11:07:51 +02:00
Florian Weingarten
170d147427 Consistent writing 2015-04-24 19:43:27 -04:00
Florian Weingarten
441f4deb66 remember your password 2015-04-24 19:08:05 -04:00
Alexander Neumann
5e69788eac Refactor backends 2015-03-28 14:36:50 +01:00
Alexander Neumann
e1fc17aeb1 Implement per-repository cache 2015-03-14 12:16:28 +01:00
Alexander Neumann
c8be54564f Add local cache 2015-03-02 10:04:01 +01:00
Alexander Neumann
c884704bce Refactor pool stats 2015-02-08 13:46:51 +01:00
Alexander Neumann
25a214809b Refactor debug into debug module 2015-01-17 16:32:13 +01:00
Alexander Neumann
2e28b88e3a Write prompt to stderr instead of stdout 2015-01-02 22:36:53 +01:00
Alexander Neumann
1944ab13d4 Add dangling blob detection and removal to 'fsck' 2014-12-22 14:46:54 +01:00
Alexander Neumann
ef41a77aff Remove explicit key handling 2014-12-21 18:10:19 +01:00