diff --git a/README.md b/README.md index 3e19d32..cd44ebd 100644 --- a/README.md +++ b/README.md @@ -2,24 +2,24 @@ Wrapper to simplify backups with borgbackup # Installation -Put the [script](src/borgwrapper.sh) somewhere practical +Put the [script](src/borgwrapper) somewhere practical - cp borgwrapper.sh /usr/local/bin/borgwrapper + cp borgwrapper /usr/local/bin/borgwrapper chown root. /usr/local/bin/borgwrapper chmod 750 /usr/local/bin/borgwrapper # Configuration -By default borgwrapper expects the configuration to be located at `/etc/borgwrapper/config.sh`. -An example configuration file is included in [config.sh.example](src/config.sh.example). +By default borgwrapper expects the configuration to be located at `/etc/borgwrapper/config`. +An example configuration file is included in [config.example](src/config.example). Ensure restrictive permissions on this file as it exposes the passphrase. - chown root. config.sh - chmod 600 config.sh + chown root. config + chmod 600 config # Scheduling ## systemd Copy the example systemd [unit files](systemd/) to `/etc/systemd/system/`. Then for each -configuration file in `/etc/borgwrapper/.sh` do: +configuration file in `/etc/borgwrapper/` do: systemctl enable borgwrapper-backup@.timer systemctl enable borgwrapper-verify@.timer @@ -89,5 +89,5 @@ Run in subshell if you do not want the passphrase stored in the current shell af Examples: - (. /etc/borgwrapper/config.sh; export BORG_PASSPHRASE; borg mount "$BORG_REPO" /mnt) - (. /etc/borgwrapper/config.sh; export BORG_PASSPHRASE; borg list "$BORG_REPO") + (. /etc/borgwrapper/config; export BORG_PASSPHRASE; borg mount "$BORG_REPO" /mnt) + (. /etc/borgwrapper/config; export BORG_PASSPHRASE; borg list "$BORG_REPO") diff --git a/src/borgwrapper.sh b/src/borgwrapper similarity index 98% rename from src/borgwrapper.sh rename to src/borgwrapper index d1b9d39..d45bad9 100755 --- a/src/borgwrapper.sh +++ b/src/borgwrapper @@ -1,11 +1,11 @@ #!/bin/bash -VERSION="1.3.0" +VERSION="1.4.0" print_usage () { cat << EOF -Usage: $(basename "${BASH_SOURCE[0]}") [OPTIONS] MODE +Usage: borgwrapper [OPTIONS] MODE OPTIONS -c CONFIG_FILE @@ -170,7 +170,7 @@ exit_clean () { # Default parameters -CONFIG="/etc/borgwrapper/config.sh" +CONFIG="/etc/borgwrapper/config" DRY_RUN=false BORG="/usr/bin/borg" LOCKDIR="/run/lock/borgwrapper" diff --git a/src/config.sh.example b/src/config.example similarity index 100% rename from src/config.sh.example rename to src/config.example diff --git a/systemd/borgwrapper-backup@.service b/systemd/borgwrapper-backup@.service index a9adc0c..4d3d614 100644 --- a/systemd/borgwrapper-backup@.service +++ b/systemd/borgwrapper-backup@.service @@ -4,7 +4,7 @@ After=network.target [Service] Type=oneshot -ExecStart=/usr/local/bin/borgwrapper -c /etc/borgwrapper/%i.sh backup +ExecStart=/usr/local/bin/borgwrapper -c /etc/borgwrapper/%i backup Nice=10 User=root Group=root diff --git a/systemd/borgwrapper-verify@.service b/systemd/borgwrapper-verify@.service index 0638867..5c51a9d 100644 --- a/systemd/borgwrapper-verify@.service +++ b/systemd/borgwrapper-verify@.service @@ -4,7 +4,7 @@ After=network.target borgwrapper-backup@%i.service [Service] Type=oneshot -ExecStart=/usr/local/bin/borgwrapper -c /etc/borgwrapper/%i.sh verify +ExecStart=/usr/local/bin/borgwrapper -c /etc/borgwrapper/%i verify Nice=10 User=root Group=root