-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Change INSTALL_PREFIX placeholder notation to templating notation (
#131) * refactor: Change INSTALL_PREFIX placeholder notation to templating notation The former shell notation `$INSTALL_PREFIX` could result confusing. As this is a placeholder that's replaced in the `make`, we switch it to a template notation `{{ INSTALL_PREFIX }}`. * docs: Small fix on README/manual setup * docs(email-notif): Document the `{{ INSTALL_PREFIX }}` placeholder co-authored-by: giuaig <[email protected]> * Update README.md Co-authored-by: Gerard Bosch <[email protected]> --------- Co-authored-by: giuaig <[email protected]> Co-authored-by: Erik Westrup <[email protected]>
- Loading branch information
1 parent
849181b
commit de28285
Showing
16 changed files
with
35 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -308,17 +308,17 @@ $ git clone https://github.com/erikw/restic-automatic-backup-scheduler.git && cd | |
|
||
Make a quick search-and-replace in the source files: | ||
```console | ||
$ find etc bin -type f -exec sed -i.bak -e 's|$INSTALL_PREFIX||g' {} \; -exec rm {}.bak \; | ||
$ find bin etc usr Library ScheduledTask -type f -exec sed -i.bak -e 's|{{ INSTALL_PREFIX }}||g' {} \; -exec rm {}.bak \; | ||
``` | ||
and you should now see that all files have been changed like e.g. | ||
```diff | ||
-export RESTIC_PASSWORD_FILE="$INSTALL_PREFIX/etc/restic/pw.txt" | ||
-export RESTIC_PASSWORD_FILE="{{ INSTALL_PREFIX }}/etc/restic/pw.txt" | ||
+export RESTIC_PASSWORD_FILE="/etc/restic/pw.txt" | ||
``` | ||
|
||
Why? The OS specific TL;DR setups above all use the [Makefile](Makefile) or a package manager to install these files. The placeholder string `$INSTALL_PREFIX` is in the source files for portability reasons, so that the Makefile can support all different operating systems. `make` users can set a different `$PREFIX` when installing like `PREFIX=/usr/local make install-systemd`. | ||
Why? The OS specific TL;DR setups above all use the [Makefile](Makefile) or a package manager to install these files. The placeholder string `{{ INSTALL_PREFIX }}` is in the source files for portability reasons, so that the Makefile can support all different operating systems. `make` users can set a different `$PREFIX` when installing like `PREFIX=/usr/local make install-systemd`. | ||
|
||
In this detailed manual setup we will copy all files manually to `/etc`and `/bin`. Thus we need to remove the placeholder string `$INSTALL_PREFIX` in the source files as a first step. | ||
In this detailed manual setup we will copy all files manually to `/etc`and `/bin`. Thus, we need to remove the placeholder string `{{ INSTALL_PREFIX }}` in the source files as a first step. | ||
|
||
|
||
#### 1. Create Backblaze B2 Account, Bucket and Keys | ||
|
@@ -483,8 +483,8 @@ We want to be aware when the automatic backup fails, so we can fix it. Since my | |
Put this file in `/bin`: | ||
* `systemd-email`: Sends email using sendmail(1). This script also features time-out for not spamming Gmail servers and getting my account blocked. | ||
|
||
Put this files in `/etc/systemd/system/`: | ||
* `[email protected]`: A service that can notify you via email when a systemd service fails. Edit the target email address in this file. | ||
Put this file in `/etc/systemd/system/`: | ||
* `[email protected]`: A service that can notify you via email when a systemd service fails. Edit the target email address in this file, and replace or remove `{{ INSTALL_PREFIX }}` according to your installation. | ||
|
||
Now edit `[email protected]` and `[email protected]` to call this service failure. | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
SHELL=/bin/sh | ||
PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin/:$INSTALL_PREFIX/bin/ | ||
PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin/:{{ INSTALL_PREFIX }}/bin/ | ||
# Order of crontab fields | ||
# minute hour mday month wday command | ||
# Reference: https://www.freebsd.org/doc/handbook/configtuning-cron.html | ||
# Reference: crontab(5). | ||
|
||
@midnight root . $INSTALL_PREFIX/etc/restic/default.env.sh && restic_backup.sh | ||
@monthly root . $INSTALL_PREFIX/etc/restic/default.env.sh && restic_check.sh | ||
@midnight root . {{ INSTALL_PREFIX }}/etc/restic/default.env.sh && restic_backup.sh | ||
@monthly root . {{ INSTALL_PREFIX }}/etc/restic/default.env.sh && restic_check.sh | ||
|
||
# Email notification version. Make sure bin/cron_mail is in the above $PATH | ||
#@midnight root . $INSTALL_PREFIX/etc/restic/default.env.sh && cron_mail restic_backup.sh | ||
#@monthly root . $INSTALL_PREFIX/etc/restic/default.env.sh && cron_mail restic_check.sh | ||
#@midnight root . {{ INSTALL_PREFIX }}/etc/restic/default.env.sh && cron_mail restic_backup.sh | ||
#@monthly root . {{ INSTALL_PREFIX }}/etc/restic/default.env.sh && cron_mail restic_check.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,6 @@ Description=Send status email for %i to user | |
|
||
[Service] | ||
Type=oneshot | ||
ExecStart=$INSTALL_PREFIX/bin/systemd-email [email protected] %i | ||
ExecStart={{ INSTALL_PREFIX }}/bin/systemd-email [email protected] %i | ||
User=root | ||
Group=systemd-journal |