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>
This commit is contained in:
Gerard Bosch
2022-02-01 10:09:36 +01:00
committed by GitHub
parent 16dbe699ab
commit d8f25cdf88
16 changed files with 221 additions and 105 deletions

View File

@@ -7,14 +7,14 @@ SRCS_SCRIPTS = $(filter-out %cron_mail, $(wildcard usr/local/sbin/*))
SRCS_CONF = $(sort $(patsubst %.template, %, $(wildcard etc/restic/*)))
SRCS_SYSTEMD = $(wildcard etc/systemd/system/*)
# Just set PREFIX in environment, like
# $ PREFIX=/tmp/test make
# To change the installation root path, set the PREFIX variable in your shell's environment, like:
# $ PREFIX=/usr/local make install
# $ PREFIX=/tmp/test make install
DEST_SCRIPTS = $(PREFIX)/usr/local/sbin
DEST_CONF = $(PREFIX)/etc/restic
DEST_SYSTEMD = $(PREFIX)/etc/systemd/system
INSTALLED_FILES = $(addprefix $(PREFIX)/, $(SRCS_SCRIPTS) $(SRCS_CONF) $(SRCS_SYSTEMD)) \
$(DEST_CONF)/b2_env.sh $(DEST_CONF)/b2_pw.txt
INSTALLED_FILES = $(addprefix $(PREFIX)/, $(SRCS_SCRIPTS) $(SRCS_CONF) $(SRCS_SYSTEMD))
### Targets ###
# target: all - Default target.
@@ -35,16 +35,16 @@ install-scripts:
# Copy templates to new files with restricted permissions.
# Why? Because the non-template files are git-ignored to prevent that someone who clones or forks this repo checks in their sensitive data like the B2 password!
etc/restic/b2_env.sh etc/restic/b2_pw.txt:
etc/restic/_global.env etc/restic/default.env etc/restic/pw.txt:
install -m 0600 $@.template $@
# target: install-conf - Install restic configuration files.
# will create these files locally only if they don't already exist
# | means that dependencies are order-only i.e. only created if they don't already exist.
# `|` means that dependencies are order-only, i.e. only created if they don't already exist.
install-conf: | $(SRCS_CONF)
install -d $(DEST_CONF)
install -b -m 0600 $(SRCS_CONF) $(DEST_CONF)
$(RM) etc/restic/b2_env.sh etc/restic/b2_pw.txt
$(RM) etc/restic/_global.env etc/restic/default.env etc/restic/pw.txt
# target: install-systemd - Install systemd timer and service files.
install-systemd: