aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xlifeboat12
1 files changed, 6 insertions, 6 deletions
diff --git a/lifeboat b/lifeboat
index 9d569f5..4ce396c 100755
--- a/lifeboat
+++ b/lifeboat
@@ -2,6 +2,8 @@
set -e
+LIFEBOAT_ROOT=${LIFEBOAT_ROOT:-"/srv/backup/lifeboat"}
+
errx() {
printf "lifeboat: %s\n" "$1" >&2
exit 1
@@ -14,7 +16,7 @@ usage() {
run_backup() {
(
- cd "$rootdir/$repo"
+ cd "$LIFEBOAT_ROOT/$repo"
for i in run retain clean sync; do
if test -x $i; then
@@ -64,19 +66,17 @@ sync_single() {
rclone sync --transfers 20 --fast-list "$RESTIC_REPOSITORY" "$1/$LIFEBOAT_REPO_NAME"
}
-rootdir=${LIFEBOAT_ROOT:-"/srv/backup/lifeboat"}
-
test $# -lt 2 && usage
repo=$1
shift
-test -d "$rootdir/$repo" || errx "$repo: no such repository"
+test -d "$LIFEBOAT_ROOT/$repo" || errx "$repo: no such repository"
export PATH="$HOME/bin:$PATH"
export LIFEBOAT_REPO_NAME=$repo
-export RESTIC_REPOSITORY=$rootdir/$repo/repo
-export RESTIC_PASSWORD_FILE=$rootdir/$repo/credentials/restic
+export RESTIC_REPOSITORY=$LIFEBOAT_ROOT/$repo/repo
+export RESTIC_PASSWORD_FILE=$LIFEBOAT_ROOT/$repo/credentials/restic
case "$1" in
run) run_backup;;