From 4e8b8adff65d3796a5155592c311dc6cf64e1f98 Mon Sep 17 00:00:00 2001 From: Erik Westrup Date: Tue, 1 Feb 2022 16:52:17 +0100 Subject: [PATCH] Rename backup_exclude to backup_exclude.txt Fixes #64 --- CHANGELOG.md | 1 + README.md | 6 +++--- etc/restic/_global.env.template | 2 +- etc/restic/{backup_exclude => backup_exclude.txt} | 0 usr/local/sbin/restic_backup.sh | 6 +++--- 5 files changed, 8 insertions(+), 7 deletions(-) rename etc/restic/{backup_exclude => backup_exclude.txt} (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index a5025e5..318cad8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Assertion on all needed envionment variables in the backup and check scripts. ### Changed +- **BREAKING CHANGE** renamed `/etc/restic/backup_exclude` to `/etc/restic/backup_exclude.txt` and ditto for `/.backup_exclude` to `/.backup_exclude.txt`. - Align terminology used in README with the one used by B2 for credentials (keyId + applicationKey pair). ## [2.0.0] - 2022-02-01 diff --git a/README.md b/README.md index 30a7084..082e907 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ Note, you can use any of the supported [storage backends](https://restic.readthe * `/etc/restic/pw.txt` - Contains the password (single line) to be used by restic to encrypt the repository files. Should be different than your B2 password! * `/etc/restic/_global.env` - Global environment variables. * `/etc/restic/default.env` - Profile specific environment variables (multiple profiles can be defined by copying to `/etc/restic/something.env`). - * `/etc/restic/backup_exclude` - List of file patterns to ignore. This will trim down your backup size and the speed of the backup a lot when done properly! + * `/etc/restic/backup_exclude.txt` - List of file patterns to ignore. This will trim down your backup size and the speed of the backup a lot when done properly! 1. Initialize remote repo as described [below](#3-initialize-remote-repo) 1. Configure [how often](https://www.freedesktop.org/software/systemd/man/systemd.time.html#Calendar%20Events) back up should be made. * Edit if needed `OnCalendar` in `/etc/systemd/system/restic-check@.timer`. @@ -124,8 +124,8 @@ Put this file in `/usr/local/sbin`: * `restic_backup.sh`: A script that defines how to run the backup. The intention is that you should not need to edit this script yourself, but be able to control everything from the `*.env` profiles. Restic support exclude files. They list file pattern paths to exclude from you backups, files that just occupy storage space, backup-time, network and money. `restic_backup.sh` allows for a few different exclude files. -* `/etc/restic/backup_exclude` - global exclude list. You can use only this one if your setup is easy. This is set in `_global.env`. If you need a different file for another profile, you can override the envvar `RESTIC_BACKUP_EXCLUDE_FILE` in this profile. -* `.backup_exclude` per backup path. If you have e.g. an USB disk mounted at /mnt/media and this path is included in the `$BACKUP_PATHS`, you can place a file `/mnt/media/.backup_exclude` and it will automatically picked up. The nice thing about this is that the backup paths are self-contained in terms of what they shoud exclude! +* `/etc/restic/backup_exclude.txt` - global exclude list. You can use only this one if your setup is easy. This is set in `_global.env`. If you need a different file for another profile, you can override the envvar `RESTIC_BACKUP_EXCLUDE_FILE` in this profile. +* `.backup_exclude.txt` per backup path. If you have e.g. an USB disk mounted at /mnt/media and this path is included in the `$BACKUP_PATHS`, you can place a file `/mnt/media/.backup_exclude.txt` and it will automatically picked up. The nice thing about this is that the backup paths are self-contained in terms of what they shoud exclude! ## 5. Make first backup Now see if the backup itself works, by running as root diff --git a/etc/restic/_global.env.template b/etc/restic/_global.env.template index f6ea41d..3b708f5 100644 --- a/etc/restic/_global.env.template +++ b/etc/restic/_global.env.template @@ -10,7 +10,7 @@ # The restic repository encryption key export RESTIC_PASSWORD_FILE="/etc/restic/pw.txt" # The global restic exclude file -export RESTIC_BACKUP_EXCLUDE_FILE="/etc/restic/backup_exclude" +export RESTIC_BACKUP_EXCLUDE_FILE="/etc/restic/backup_exclude.txt" # Backblaze B2 credentials keyID & applicationKey pair. # Restic environment variables are documented at https://restic.readthedocs.io/en/latest/040_backup.html#environment-variables diff --git a/etc/restic/backup_exclude b/etc/restic/backup_exclude.txt similarity index 100% rename from etc/restic/backup_exclude rename to etc/restic/backup_exclude.txt diff --git a/usr/local/sbin/restic_backup.sh b/usr/local/sbin/restic_backup.sh index 59d16da..2f91c41 100644 --- a/usr/local/sbin/restic_backup.sh +++ b/usr/local/sbin/restic_backup.sh @@ -47,10 +47,10 @@ trap exit_hook INT TERM ## Global backup configuration. exclusion_args="--exclude-file ${RESTIC_BACKUP_EXCLUDE_FILE}" ## Self-contained backup files per backup path. E.g. having an USB disk at /mnt/media in BACKUP_PATHS, -# a file /mnt/media/.backup_exclude will automatically be detected and used: +# a file /mnt/media/.backup_exclude.txt will automatically be detected and used: for backup_path in ${BACKUP_PATHS[@]}; do - if [ -f "$backup_path/.backup_exclude" ]; then - exclusion_args+=" --exclude-file $backup_path/.backup_exclude" + if [ -f "$backup_path/.backup_exclude.txt" ]; then + exclusion_args+=" --exclude-file $backup_path/.backup_exclude.txt" fi done