8000 Replace repository checking logic by ThomDietrich · Pull Request #47 · djmaze/resticker · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

8000 Replace repository checking logic #47

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 21, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions entrypoint
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
#!/bin/bash
set -euo pipefail

if [ -z "${RESTIC_REPOSITORY##*:*}" ]; then
echo "Trying to initialize remote repository '${RESTIC_REPOSITORY}' (in case it has not been initialized yet)"
restic init || true
elif [ ! -f "$RESTIC_REPOSITORY/config" ]; then
echo "Restic repository '${RESTIC_REPOSITORY}' does not exist. Running restic init"
restic init
echo "Checking configured repository '${RESTIC_REPOSITORY}' ..."
if restic cat config > /dev/null; then
echo "Repository found."
else
echo "Could not access the configured repository. Trying to initialize (in case it has not been initialized yet) ..."
if restic init; then
echo "Repository successfully initialized."
else
if [ "${SKIP_INIT_CHECK:-}" == "true" ]; then
echo "Initialization failed. Ignoring errors because SKIP_INIT_CHECK is set in your configuration."
else
echo "Initialization failed. Please see error messages above and check your configuration. Exiting."
exit 1
fi
fi
fi
echo -e "\n"

if [[ $# -gt 0 ]]; then
exec restic "$@"
Expand Down
0