systemctl start restic-backup@default.timer was failing with the following message:
```console
❯ sudo systemctl start restic-backup@default.timer
Failed to start restic-backup@default.timer: Unit nm-unmetered-connection.service failed to load properly, please adjust/correct and reload service manager: Device or resource busy
See system logs and 'systemctl status restic-backup@default.timer' for details.
```
and by doing `systemctl daemon-reload` before that command solved the issue.
But according to `man systemd` in order to avoid this, it seems that `enable` command must be issued before `start`, as it reloads the system manager configuration (in a way equivalent to daemon-reload). So, once properly sorted, it seems that both commands can be fused into a single `enable --now` command :)
"make install" -> "make install-systemd"
so that I could now add a
""make install-cron"
target.
Soon there will be
"make install-macos"
"make install-windows"
Thus it does not make sense to have a general `make install` anymore.
* 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
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>