Commit Graph

22 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
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
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
7141426699 Spell 2022-01-17 13:26: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
428f4be872 Fix installation of template files
The target that copies the *.template files (#15) had a '/' prefixed which
should not be there. The copy should be locally here. The real install
happens in the install-conf that respects $PREFIX

Fixes #40
2021-12-03 17:09:14 +01:00
Erik Westrup
6689b1508f make uninstall target respect $PREFIX 2021-10-30 13:49:07 +02:00
Erik Westrup
d9459cb048 Fix b2_* install path 2021-10-30 09:16:12 +02:00
Erik Westrup
b8716ad377 Indent fix 2021-10-30 09:15:49 +02:00
Erik Westrup
b261235ba5 Simpler patsubst for installed files 2021-10-30 09:15:36 +02:00
Erik Westrup
88f2dc9eca Makefile: s/DEST_SCRIPT\b/DEST_SCRIPTS/ 2021-10-30 09:15:09 +02:00
Erik Westrup
16e3cb2df5 Makefile: remove out-commented line 2021-10-30 09:00:47 +02:00
Erik Westrup
bcd4a02e82 Makefile: add uninstall target
Fixes #30
2021-10-29 17:09:49 +02:00
Todd E Johnson
85f73346e0 Set permissions for systemd units to 644 2019-07-15 20:54:22 -05:00
Todd E Johnson
e3f01b7911 Move /.backup_exlude to /etc/restic/backup_exclude 2019-07-13 00:09:58 -05:00
Bill Kaguru Wanjohi
280ab682c6 clean up some other file permissions 2019-04-26 14:27:03 +00:00
Bill Kaguru Wanjohi
5f35a74bd1 use template files to improve security, reproducibility 2019-04-26 14:26:05 +00:00
Quentin Bourgeois
aeb6f87278 <Makefile/systemd_services: Change default perm of installed files>
Its better to remove the default executable bit put by install when no
-m is provided and leave the systemd service files only readable.
2018-09-29 10:04:05 +00:00
Erik Westrup
ec4b86a97d Added Makefile for installation of files 2018-08-31 21:06:01 +02:00