2021-06-30 22:04:44 +00:00
|
|
|
#!/usr/bin/env sh
|
2021-03-29 20:55:10 +00:00
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
[ -z "${RCLONE_REMOTE}" ] && echo "\$RCLONE_REMOTE is not set" && exit 1
|
|
|
|
[ -z "${RCLONE_CONFIG}" ] && echo "\$RCLONE_CONFIG is not set" && exit 1
|
2021-06-17 20:49:09 +00:00
|
|
|
|
2021-07-02 18:02:42 +00:00
|
|
|
if [ -n "${ENC_PASSWORD}" ]; then
|
2021-06-17 20:49:09 +00:00
|
|
|
RESTIC_PASSWORD="${ENC_PASSWORD}"
|
2021-07-02 18:02:42 +00:00
|
|
|
elif [ -n "${ENC_PASSWORD_FILE}" ]; then
|
2021-06-30 22:04:44 +00:00
|
|
|
RESTIC_PASSWORD=$(cat "$ENC_PASSWORD_FILE")
|
2021-06-17 20:49:09 +00:00
|
|
|
else
|
|
|
|
echo "\$ENC_PASSWORD or \$ENC_PASSWORD_FILE is not set" && exit 1
|
|
|
|
fi
|
2021-03-29 20:55:10 +00:00
|
|
|
|
|
|
|
echo "Init new repo"
|
|
|
|
|
2021-06-30 22:04:44 +00:00
|
|
|
export RESTIC_PASSWORD
|
|
|
|
|
2021-03-29 20:55:10 +00:00
|
|
|
restic -r "rclone:$RCLONE_REMOTE" init
|
|
|
|
|
|
|
|
echo "Created new repo at $RCLONE_REMOTE"
|