2019-12-19 04:09:05 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Ansible managed
|
|
|
|
|
|
|
|
error_exit() {
|
|
|
|
printf "%s\n" "$1"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
RESTIC_ETC_PATH=${RESTIC_ETC_PATH:-/etc/restic}
|
2020-04-21 03:28:32 +00:00
|
|
|
|
|
|
|
# shellcheck source=/dev/null
|
|
|
|
source "${RESTIC_ETC_PATH}/env.sh"
|
2019-12-19 04:09:05 +00:00
|
|
|
|
|
|
|
if [ $# -lt 2 ]; then
|
|
|
|
error_exit "missing arguments"
|
|
|
|
fi
|
|
|
|
|
|
|
|
REPO=$1
|
|
|
|
shift
|
|
|
|
|
|
|
|
REPO_PATH="${RESTIC_ETC_PATH}/repos/${REPO}"
|
|
|
|
REPO_ENV="${REPO_PATH}/env.sh"
|
|
|
|
|
|
|
|
if [ ! -r "$REPO_ENV" ]; then
|
|
|
|
error_exit "${REPO_ENV} does not exist"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# shellcheck disable=SC1090
|
|
|
|
. "$REPO_ENV"
|
|
|
|
|
|
|
|
$RESTIC_PATH "$@"
|