Compare commits

1 Commits
new ... main

Author SHA1 Message Date
John Lancaster
fc98619d3c old WIP on the create_restic_repo script 2024-05-19 19:58:52 -05:00

View File

@@ -1,16 +1,20 @@
#!/bin/bash #!/bin/bash
set -e
if [ "$#" -ne 1 ]; then if [ -z "${RESTIC_DIR}" ]; then
echo "$(tput setaf 1)No repo name specified$(tput sgr0)" if [ "$#" -ne 1 ]; then
echo "Usage: $0 <repo name>" echo "$(tput setaf 1)No repo name specified$(tput sgr0)"
exit 1 echo "Usage: $0 <repo name>"
else echo "Or have the RESTIC_DIR variable set"
# Assign the directory to a variable exit 1
REPO_PATH=/mnt/backups/$1 else
echo -e "Creating $(tput setaf 4)$REPO_PATH$(tput sgr0)" RESTIC_DIR=$(readlink -f $1)
fi
fi fi
echo "RESTIC_DIR is $(tput setaf 4)$RESTIC_DIR$(tput sgr0)"
docker run -it --rm \ docker run -it --rm \
-v /mnt/backups:/mnt/backups \ -v $RESTIC_DIR:$RESTIC_DIR \
restic/restic \ restic/restic \
init --repo $REPO_PATH init --repo $RESTIC_DIR