Commit Graph

142 Commits

Author SHA1 Message Date
Erik Westrup
9760cd05ec Truly support custom PREFIX= install
* Before, doing `$ PREFIX=/usr/local make install` would install files to`/usr/local/usr/local..` which is wrong
* With this PR, files will be installed to the expected location e.g. `/usr/local/etc/restic`
* `Makefile` almost completely rewritten
   * As e.g. `default.env` would source `_global.env`, `default.env` must be edited to find the right location of `_global.env` depending on what `$PREFIX` was set to.
   * see documented build stages in the `Makefile` itself.
   *  Made sure that the rules are correct so that only modifed files are installed, not all at once unnecessarily like before.
* A sub-goal was that the [PKGBUILD](https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=restic-systemd-automatic-backup#n20) for Arch should not need to do any custom install configuration, to keep everything easier to maintain. `$ make install` should work out of the box for Arch.
* Additionally added the `-b` flag to `install(1)` that makes a backup of existing `etc/restic/*` files before installing a newer version.

Fixes #49
2022-02-03 20:52:00 +01:00
Gerard Bosch
3852e305b6 Add resticw (restic wrapper) utility (#60)
The script provides a convenient way to load environment config, deal
with profiles and act as a pass-through to restic. The overall thing is
to improve the UX when running restic, integrating the features this
project provides.

## Note

The script itself is a very simple thing.
The command line parser is auto-generated using docopt.sh driven from
the script's DOC. It can be refreshed upon DOC changes with:
`docopt.sh path/to/resticw`.

## How to use it

### Examples

```console
sudo resticw stats latest

sudo resticw -p profileA snapshots
```

### Help

```console
❯ resticw --help
A little wrapper over restic just to handle profiles and environment loading.

  It loads the backup profile/environment in a subshell to avoid any credential leak (Note: Run it with sudo so it can load the environment).

  Usage:
    resticw [options] <restic_arguments>

    The restic_arguments is just the regular unwrapped restic arguments, e.g. stats latest

  Options:
    -p --profile=<name>        Specify the profile to load or use default [default: default].

  Examples:
    sudo resticw --profile profileA snapshots
    sudo resticw stats latest  # this will use the profile: default
```



Co-authored-by: Erik Westrup <erik.westrup@gmail.com>
2022-02-03 20:40:45 +01:00
Erik Westrup
73bce43f7d s/TODO/*EDIT*/ to not confuse with development TODOs 2022-02-03 14:41:21 +01:00
Erik Westrup
7499dbefcd Modified: .github/workflows/linter.yml 2022-02-02 08:10:19 +01:00
Erik Westrup
10c46e8d54 Manually trigger linter 2022-02-02 07:57:02 +01:00
Erik Westrup
ce73193128 Trigger linter on all usr/local/sbin edits 2022-02-02 07:53:30 +01:00
Erik Westrup
90358c4f7a README: project scope 2022-02-01 19:51:35 +01:00
Erik Westrup
7f3647fb0c Rel should have been major as of breaking change v4.0.0 2022-02-01 19:41:02 +01:00
Erik Westrup
dd073dfc73 Fix arguments by using arrays to buildup 2022-02-01 19:24:38 +01:00
Erik Westrup
b23d552f0b Allow set but empty envvars v3.0.1 2022-02-01 18:31:27 +01:00
Erik Westrup
4142dbf20e Modified: CHANGELOG.md v3.0.0 2022-02-01 18:18:21 +01:00
Erik Westrup
629fd4c182 Align tag badge next to aur ver badge 2022-02-01 18:05:02 +01:00
Erik Westrup
7808dd6ecc Revert "Test that lint fails"
This reverts commit 082089a203.
2022-02-01 18:04:37 +01:00
Erik Westrup
082089a203 Test that lint fails 2022-02-01 18:03:11 +01:00
Erik Westrup
5e51341c51 Trigger linter on self-modify 2022-02-01 17:53:30 +01:00
Erik Westrup
130372e641 Restrict linting to bash 2022-02-01 17:52:39 +01:00
Erik Westrup
b3c64ca2ee Add lint badge 2022-02-01 17:37:23 +01:00
Erik Westrup
33a16ddb75 Modified: usr/local/sbin/restic_backup.sh 2022-02-01 17:20:30 +01:00
Erik Westrup
f1304f7db9 Modified: README.md 2022-02-01 17:20:00 +01:00
Erik Westrup
fad429fd34 Add shellcheck linter workflow
Fixes #57
2022-02-01 17:19:08 +01:00
Erik Westrup
9b7db6d999 Run shellcheck on all shellscripts 2022-02-01 17:15:47 +01:00
Erik Westrup
79d13a1e64 Prefix envvars with RESTIC_ for consistencty
Fix #63
2022-02-01 16:59:12 +01:00
Erik Westrup
4e8b8adff6 Rename backup_exclude to backup_exclude.txt
Fixes #64
2022-02-01 16:52:20 +01:00
Erik Westrup
687111fddf Assert that all envvars are set in scripts
Remind user to source profile before executing.

Fixes #62
2022-02-01 16:45:19 +01:00
Erik Westrup
f4b90c2499 Add RESTIC_VERBOSITY_LEVEL
Fixes #50
2022-02-01 16:19:05 +01:00
Erik Westrup
341f3e79ec Allow extra args to restic-backup with RESTIC_BACKUP_EXTRA_ARGS
Fixes #56
2022-02-01 16:15:18 +01:00
Erik Westrup
a4cd65db5a Align terminology of credentials with B2
Fixes #59
2022-02-01 16:04:40 +01:00
Erik Westrup
84bf1cfcd3 Modified: LICENSE 2022-02-01 14:59:09 +01:00
Erik Westrup
c51e5ffb03 Add release instructions 2022-02-01 13:31:56 +01:00
Erik Westrup
cf978b00fe Modified: CHANGELOG.md v2.0.0 2022-02-01 13:08:49 +01:00
Erik Westrup
db27be517f Modified: CHANGELOG.md 2022-02-01 13:08:28 +01:00
Erik Westrup
3c9fa21b2e Modified: CHANGELOG.md 2022-02-01 13:07:55 +01:00
Gerard Bosch
d8f25cdf88 Multiple profile configuration (#45)
Adds possibility to have multiple profiles with different backup paths, retention etc.

Co-authored-by: Matt Feifarek <matt.feifarek@gmail.com>
Co-authored-by: Erik Westrup <erik.westrup@gmail.com>
2022-02-01 10:09:36 +01:00
Erik Westrup
16dbe699ab Revert "Empty line"
This reverts commit a011bb6dd2.
2022-01-30 20:09:26 +01:00
Erik Westrup
a011bb6dd2 Empty line 2022-01-30 20:09:07 +01:00
Erik Westrup
15a02d4bd3 Add note about Make as recommended reqirements for installing 2022-01-19 12:02:20 +01:00
Erik Westrup
3a51ffb795 Modified: README.md 2022-01-18 12:01:58 +01:00
Erik Westrup
1b57069d30 README: anecdotal pricing 2022-01-18 12:00:29 +01:00
Erik Westrup
5eeab95c84 Create backup of existing config files on install 2022-01-17 15:53:17 +01:00
Erik Westrup
3e22d8f99d Remove local generated files from templates
As discussed in #46, it's not necessary to keep the local files
generated from the templates as the users should edit the installed
confs, not in the git.
2022-01-17 15:51:39 +01:00
Erik Westrup
9cb85a8571 Add notes to README about development 2022-01-17 15:51:33 +01:00
Erik Westrup
7141426699 Spell 2022-01-17 13:26:08 +01:00
Erik Westrup
9e292218cf Spell fix 2022-01-17 13:16:49 +01:00
Erik Westrup
546845c687 Merge pull request #48 from erikw/fix/46
Fix make install failing when run multiple times
2022-01-17 09:52:08 +01:00
Erik Westrup
828ff79e7a Fix make install failing when run multiple times
Due to the security feature preventing checking in B2 credentials to
git, the install target would get the same file twice due to pattern
subsitution.

This issue is not visible with BSD install as it ignores the issue, but
GNU install wil fail.

Fixes #46
2022-01-16 20:59:50 +01:00
Erik Westrup
8932e60e4a Spell fixes 2022-01-16 20:56:00 +01:00
Erik Westrup
36a90b963e Fix URL 2022-01-01 13:59:45 +01:00
Erik Westrup
5a3c8afb43 Link to #44
Fixes #44
2022-01-01 13:58:33 +01:00
Erik Westrup
aff6211407 Modified: README.md 2021-12-18 11:11:11 +01:00
Erik Westrup
3e9233c0fc Merge pull request #43 from erikw/fix/42
Add comment explaining dynamic backup path
2021-12-04 18:40:35 +01:00