* 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
42 lines
1.9 KiB
Bash
42 lines
1.9 KiB
Bash
# This is the default profile. Fill it with your desired configuration.
|
|
# Additionally, you can create and use more profiles by copying this file.
|
|
|
|
# This file (and other .env files) has two purposes:
|
|
# - being sourced by systemd timers to setup the backup before running restic_backup.sh
|
|
# - being sourced in a user's shell to work directly with restic commands e.g.
|
|
# $ source /etc/restic/default.env
|
|
# $ restic snapshots
|
|
# Thus you don't have to provide all the arguments like
|
|
# $ restic --repo ... --password-file ...
|
|
|
|
source $INSTALL_PREFIX/etc/restic/_global.env
|
|
|
|
# Below envvar will override those in _global.env
|
|
|
|
export RESTIC_REPOSITORY="b2:<b2-repo-name>" # *EDIT* fill with your repo name
|
|
|
|
# What to backup. Colon-separated paths e.g. to different mountpoints "/home:/mnt/usb_disk".
|
|
# To backup only your home directory, set "/home/your-user"
|
|
export RESTIC_BACKUP_PATHS="" # *EDIT* fill conveniently with one or multiple paths
|
|
|
|
|
|
# Example below of how to dynamically add a path that is mounted e.g. external USB disk.
|
|
# restic does not fail if a specified path is not mounted, but it's nicer to only add if they are available.
|
|
#test -d /mnt/media && RESTIC_BACKUP_PATHS+=" /mnt/media"
|
|
|
|
# A tag to identify backup snapshots.
|
|
export RESTIC_BACKUP_TAG=systemd.timer
|
|
|
|
# Retention policy - How many backups to keep.
|
|
# See https://restic.readthedocs.io/en/stable/060_forget.html?highlight=month#removing-snapshots-according-to-a-policy
|
|
export RESTIC_RETENTION_DAYS=14
|
|
export RESTIC_RETENTION_WEEKS=16
|
|
export RESTIC_RETENTION_MONTHS=18
|
|
export RESTIC_RETENTION_YEARS=3
|
|
|
|
# Optional extra space-separated arguments to restic-backup.
|
|
# Example: Add two additional exclude files to the global one in RESTIC_PASSWORD_FILE.
|
|
#RESTIC_BACKUP_EXTRA_ARGS="--exclude-file /path/to/extra/exclude/file/a --exclude-file /path/to/extra/exclude/file/b"
|
|
# Example: exclude all directories that have a .git/ directory inside it.
|
|
#RESTIC_BACKUP_EXTRA_ARGS="--exclude-if-present .git"
|