Commit Graph

271 Commits

Author SHA1 Message Date
Michael Eischer e1e7fc8fb2 fs: unexport Local and expose via NewLocal 2026-06-13 19:50:49 +02:00
Michael Eischer 825d67ba4b backup,restore: move CalculateProgressInterval call to their ui package 2026-06-13 16:53:57 +02:00
Michael Eischer e8ed2434cd ui: move NewProgressPrinter to ui/progress.NewTerminalPrinter 2026-06-13 16:53:54 +02:00
Michael Eischer 5be6d9c73f fail of RESTIC_READ_CONCURRENCY or RESTIC_COMPRESSION are invalid 2026-02-01 15:57:07 +01:00
Michael Eischer 157f174dd9 Merge pull request #5370 from hashier/feat/exclude-macOS-cloud-files
feat(backup): add possibility to exclude macOS cloud-only files
2025-11-16 11:57:37 +01:00
Michael Eischer a816b827cf extract GlobalOptions into internal/global package
Rough steps:
```
mv cmd/restic/global* cmd/restic/secondary_repo* internal/global/
sed -i "s/package main/package global/" internal/global/*.go
Rename "GlobalOptions" to "Options" in internal/global/
Replace everywhere " GlobalOptions" -> " global.Options"
Replace everywhere "\*GlobalOptions" -> " *global.Options"
Make SecondaryRepoOptions public
Make create public
Make version public
```
2025-10-12 17:56:28 +02:00
Michael Eischer 2c677d8db4 global: make private fields public 2025-10-12 17:56:28 +02:00
Srigovind Nayak 481fcb9ca7 backup: return exit code 3 if not all targets are available (#5347)
to make the exit code behaviour consistent with files inaccessible during the backup phase, making this change to exit with code 3 if not all target files/folders are accessible for backup

---------

Co-authored-by: Michael Eischer <michael.eischer@fau.de>
2025-10-05 15:38:52 +02:00
Christopher Loessl f3d95893b2 feat(backup): add possibility to exclude macOS cloud-only files 2025-10-04 19:22:51 +02:00
Michael Eischer 56ac8360c7 data: split node and snapshot code from restic package 2025-10-03 19:10:39 +02:00
Michael Eischer 3335f62a8f Fix linter warnings 2025-10-03 18:55:46 +02:00
Michael Eischer 52eb66929f repository: deduplicate index progress bar initializaton 2025-10-03 18:55:46 +02:00
Michael Eischer 1a76f988ea backup: embed progress.Printer in backup specific printer 2025-10-03 18:55:46 +02:00
Michael Eischer e753941ad3 move NewProgressPrinter to ui package 2025-10-03 18:55:46 +02:00
Michael Eischer 96af35555a termstatus: add stdin and inject into backup command 2025-10-03 18:55:46 +02:00
Michael Eischer 3410808dcf deduplicate termstatus setup 2025-10-03 18:55:46 +02:00
Michael Eischer 1ae2d08d1b termstatus: centralize OutputIsTerminal checks 2025-10-03 18:55:46 +02:00
Michael Eischer 6bd85d2412 reduce usages of globalOptions variable 2025-10-03 18:22:42 +02:00
Michael Eischer 97933d1404 remove trailing newlines from errors.Fatalf calls 2025-09-24 22:11:34 +02:00
Michael Eischer 2fe271980f backup: only pass error log function to helpers 2025-09-21 16:02:59 +02:00
Michael Eischer 6b5c8ce14e change run* functions to accept ui.Terminal instead of *termstatus.Terminal 2025-09-15 22:37:25 +02:00
Michael Eischer c14cf48776 further reduce Warnf usages 2025-09-15 22:35:16 +02:00
Michael Eischer 109a211fbe convert repository locking to use termstatus 2025-09-15 22:34:59 +02:00
Michael Eischer 902cd1e9d6 backup: replace Verbosef usage 2025-09-15 22:19:19 +02:00
Michael Eischer 32b7168a9e centralize index progress bar for termstatus 2025-09-15 20:25:17 +02:00
Michael Eischer 9f39e8a1d3 fs/reader: return proper error on invalid filename 2025-04-11 22:07:31 +02:00
Michael Eischer 3a995172b7 fs: rewrite Reader to build fs tree up front
This adds proper support for filenames that include directories. For
example, `/foo/bar` would result in an error when trying to open `/foo`.

The directory tree is now build upfront. This ensures let's the
directory tree construction be handled only once. All accessors then
only have to look up the constructed directory entries.
2025-04-11 21:37:40 +02:00
Michael Eischer 412d6d9ec5 Create root command via function 2025-02-07 21:29:33 +01:00
Michael Eischer aacd6a47e3 refactor to use constructor functions to create cobra commands
This allows getting rid of the global options variables
2025-02-07 18:56:45 +01:00
Michael Eischer dc9b6378f3 move cli flags into AddFlags on option structs 2025-02-06 22:10:41 +01:00
Michael Eischer b7ff8ea9cd repository: expose cache via method 2025-01-13 22:40:18 +01:00
Michael Wildman da71e77b28 backup: allow excluding online-only cloud files 2025-01-13 21:11:23 +01:00
Michael Eischer 9f206601af backup: test that vss backups work if underlying data was removed 2024-10-18 21:43:46 +02:00
Michael Eischer 70fbad6623 archiver: minimize imports 2024-08-31 18:04:37 +02:00
Michael Eischer 6fd5d5f2d5 archiver: move helper functions to combine rejects 2024-08-31 18:04:22 +02:00
Michael Eischer f1585af0f2 move include/exclude options to filter package 2024-08-31 18:04:07 +02:00
Michael Eischer 5d58945718 cleanup include / exclude option setup 2024-08-31 18:03:53 +02:00
Michael Eischer 41c031a19e backup: move RejectFuncs to archiver package 2024-08-31 18:03:35 +02:00
Michael Eischer f9dbcd2531 backup: convert reject funcs to use FS interface
Depending on parameters the paths in a snapshot do not directly
correspond to real paths on the filesystem. Therefore, reject funcs must
use the FS interface to work correctly.
2024-08-31 18:03:02 +02:00
Michael Eischer 5988d825b7 group commands and make features/options visible 2024-08-23 23:48:45 +02:00
Michael Terry 56f28c9bd5 main: return an exit code (12) for "bad password" errors 2024-08-15 16:55:45 -04:00
Michael Eischer 94fdca08c4 return exit code 10 if repository does not exist 2024-07-10 21:46:26 +02:00
Michael Eischer d76a78aa99 return exit code 11 if the repository could not be locked 2024-07-10 21:37:32 +02:00
Michael Eischer 6869bdaaa8 backup: implement --skip-if-unchanged 2024-05-30 15:14:31 +02:00
Michael Eischer 18990dbed8 backup: refer to backed up data as backup source not target
A backup reads from the source and writes it to the backup target
(repository). The name "target" is kept within the source code as it's
used there excessively.
2024-05-25 23:13:37 +02:00
Michael Eischer 1d2277b4c3 Add --insecure-no-password option
This also includes two derived options `--from-insecure-no-password`
used for commands that require specifying a source repository. And
`--new-insecure-no-password` for the `key add` and `key passwd`
commands.

Specifying `--insecure-no-password` disabled the password prompt and
immediately uses an empty password. Passing a password via CLI option or
environment variable at the same time is an error.
2024-05-24 22:38:20 +02:00
DRON-666 88c509e3e9 vss: Change ErrorHandler signature
We don't need `error` here: the only existing implementation
of `ErrorHandler` always call `Backup.Error` and all
implementations of `Backup.Error` always return nil.
2024-04-28 22:44:16 +03:00
DRON-666 78dbc5ec58 vss: Add initial support for extended options 2024-04-28 22:44:15 +03:00
Altan Orhon 871ea1eaf3 Add support for specifying --host via environment variable
This commit adds support for specifying the `--host` option via the `RESTIC_HOST` environment variable. This is done by extending option processing in `cmd_backup.go` and for `restic.SnapshotFilter` in `find.go`.
2024-04-24 21:49:42 +02:00
Michael Eischer 118a69a84b lock: replace lockRepo(Exclusive) with openWith(Read/Write/Exclusive)Lock
The new functions much better convey the intent behind the lock
request. This allows cleanly integrating noLock (for read) and dryRun
(write/exclusive) handling.

There are only minor changes to existing behavior with two exceptions:
- `tag` no longer accepts the `--no-lock` flag. As it replaces files in
  the repository, this always requires an exclusive lock.
- `debug examine` now returns an error if both `--extract-pack` and
  `--no-lock` are given.
2024-03-28 22:46:33 +01:00