2021-11-10 20:27:49 +00:00
|
|
|
#!/usr/bin/env sh
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2022-02-15 11:27:53 +00:00
|
|
|
if [ -n "$RCLONE_CONFIG_FILE" ]; then
|
2022-02-15 10:19:08 +00:00
|
|
|
echo "$RCLONE_CONFIG_FILE" > "${RCLONE_CONFIG:=/config/rclone.conf}"
|
|
|
|
fi
|
|
|
|
|
2021-11-10 20:27:49 +00:00
|
|
|
if [ -z "${RCLONE_CONFIG}" ]; then
|
|
|
|
RCLONE_CONFIG="/config/rclone.conf"
|
|
|
|
[ -e "${RCLONE_CONFIG}" ] || echo "No config file found"
|
|
|
|
echo "\$RCLONE_CONFIG not set. Defaulting to \"/config/rclone.conf\""
|
|
|
|
fi
|
|
|
|
|
|
|
|
export RCLONE_CONFIG
|
|
|
|
|
|
|
|
if [ -z "$RCLONE_REMOTE" ]; then
|
|
|
|
RCLONE_REMOTE="$(rclone listremotes | head -1)/backup"
|
|
|
|
echo "\$RCLONE_REMOTE not set. Defaulting to \"$RCLONE_REMOTE\""
|
|
|
|
fi
|
|
|
|
|
|
|
|
RESTIC_REPOSITORY="rclone:$RCLONE_REMOTE"
|
|
|
|
|
|
|
|
if [ -n "${RESTIC_PASSWORD}" ] && [ -n "$RESTIC_PASSWORD_FILE" ]; then
|
|
|
|
echo "\$RESTIC_PASSWORD or \$RESTIC_PASSWORD_FILE is not set"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -n "${MYSQL_PASSWORD}" ]; then
|
|
|
|
MYSQL_PASSWORD_ACTUAL="${MYSQL_PASSWORD}"
|
|
|
|
elif [ -n "${MYSQL_PASSWORD_FILE}" ]; then
|
|
|
|
MYSQL_PASSWORD_ACTUAL=$(cat "$MYSQL_PASSWORD_FILE")
|
|
|
|
fi
|
|
|
|
|
|
|
|
export RCLONE_REMOTE
|
|
|
|
export RESTIC_PASSWORD
|
|
|
|
export MYSQL_PASSWORD_ACTUAL
|
|
|
|
export RESTIC_REPOSITORY
|