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
This commit is contained in:
Erik Westrup
2021-12-03 17:06:11 +01:00
parent 99f4ba4436
commit 428f4be872
3 changed files with 10 additions and 7 deletions
+7 -7
View File
@@ -3,7 +3,7 @@
### Macros ###
SRCS_SCRIPTS = $(filter-out %cron_mail, $(wildcard usr/local/sbin/*))
SRCS_CONF = $(filter-out %template, $(wildcard etc/restic/*))
SRCS_CONF = $(patsubst %.template, %, $(wildcard etc/restic/*))
SRCS_SYSTEMD = $(wildcard etc/systemd/system/*)
# Just set PREFIX in envionment, like
@@ -32,15 +32,15 @@ install-scripts:
install -d $(DEST_SCRIPTS)
install -m 0744 $(SRCS_SCRIPTS) $(DEST_SCRIPTS)
etc/restic/b2_env.sh:
install -m 0600 etc/restic/b2_env.sh.template /etc/restic/b2_env.sh
etc/restic/b2_pw.txt:
install -m 0600 etc/restic/b2_pw.txt.template /etc/restic/b2_pw.txt
# Copy templates to new files with restricted permissions.
# Why? Because the non-template files are git-ignored to preovent 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:
install -m 0600 $@.template $@
# target: install-conf - Install restic configuration files.
# will create these files locally only if they don't already exist
install-conf: | etc/restic/b2_env.sh etc/restic/b2_pw.txt
# | means that dependencies are order-ony i.e. only created if they don't already exist.
install-conf: | $(SRCS_CONF)
install -d $(DEST_CONF)
install -m 0600 $(SRCS_CONF) $(DEST_CONF)