21 lines
457 B
Bash
Executable File
21 lines
457 B
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
|
|
if [ -z "${RESTIC_DIR}" ]; then
|
|
if [ "$#" -ne 1 ]; then
|
|
echo "$(tput setaf 1)No repo name specified$(tput sgr0)"
|
|
echo "Usage: $0 <repo name>"
|
|
echo "Or have the RESTIC_DIR variable set"
|
|
exit 1
|
|
else
|
|
RESTIC_DIR=$(readlink -f $1)
|
|
fi
|
|
fi
|
|
|
|
echo "RESTIC_DIR is $(tput setaf 4)$RESTIC_DIR$(tput sgr0)"
|
|
|
|
docker run -it --rm \
|
|
-v $RESTIC_DIR:$RESTIC_DIR \
|
|
restic/restic \
|
|
init --repo $RESTIC_DIR
|