aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWynn Wolf Arbor2020-06-04 16:33:52 +0200
committerWynn Wolf Arbor2020-06-04 16:33:52 +0200
commite58da98d30ba8b739bd4f3d05589899673426ca8 (patch)
tree141d3021b0384570e21c612b0bd7da4aac5d74f9
parent30538d79aed40675b3be1853c374e8e28d625441 (diff)
downloadlifeboat-e58da98d30ba8b739bd4f3d05589899673426ca8.tar.gz
Use LIFEBOAT_ROOT directly throughout the script
Instead of using another variable name to refer to the value of LIFEBOAT_ROOT or its default, use LIFEBOAT_ROOT directly.
-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;;