Compare commits
1 Commits
7e13fbedd8
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fc98619d3c |
@@ -1,16 +1,20 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [ -z "${RESTIC_DIR}" ]; then
|
||||||
if [ "$#" -ne 1 ]; then
|
if [ "$#" -ne 1 ]; then
|
||||||
echo "$(tput setaf 1)No repo name specified$(tput sgr0)"
|
echo "$(tput setaf 1)No repo name specified$(tput sgr0)"
|
||||||
echo "Usage: $0 <repo name>"
|
echo "Usage: $0 <repo name>"
|
||||||
|
echo "Or have the RESTIC_DIR variable set"
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
# Assign the directory to a variable
|
RESTIC_DIR=$(readlink -f $1)
|
||||||
REPO_PATH=/mnt/backups/$1
|
fi
|
||||||
echo -e "Creating $(tput setaf 4)$REPO_PATH$(tput sgr0)"
|
|
||||||
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
|
||||||
|
|||||||
Reference in New Issue
Block a user