backup-docker/setup.sh
Djeeberjr 2c821d31db
All checks were successful
continuous-integration/drone/push Build is passing
i am not good at this
2022-02-15 12:27:53 +01:00

38 lines
1013 B
Bash
Executable File

#!/usr/bin/env sh
set -e
if [ -n "$RCLONE_CONFIG_FILE" ]; then
echo "$RCLONE_CONFIG_FILE" > "${RCLONE_CONFIG:=/config/rclone.conf}"
fi
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