summaryrefslogtreecommitdiff
path: root/docker
diff options
context:
space:
mode:
authorMS <ms@taler.net>2022-11-17 11:36:12 +0100
committerMS <ms@taler.net>2022-11-17 11:36:12 +0100
commit8103b44c26bd5437fd878c2feb694c9da39d4a03 (patch)
tree21d3c546b47f45bc1ae45681b00e09cc71edb05e /docker
parent955f83f174fb4554018d30604a0cb2d61577786d (diff)
downloaddeployment-8103b44c26bd5437fd878c2feb694c9da39d4a03.tar.gz
deployment-8103b44c26bd5437fd878c2feb694c9da39d4a03.tar.bz2
deployment-8103b44c26bd5437fd878c2feb694c9da39d4a03.zip
scripts help message
Diffstat (limited to 'docker')
-rwxr-xr-xdocker/demo/backup.sh16
-rwxr-xr-xdocker/demo/build_base.sh22
-rwxr-xr-xdocker/demo/import-backup.sh31
3 files changed, 59 insertions, 10 deletions
diff --git a/docker/demo/backup.sh b/docker/demo/backup.sh
index 0027b55..4be72a8 100755
--- a/docker/demo/backup.sh
+++ b/docker/demo/backup.sh
@@ -2,6 +2,22 @@
set -eu
+usage () {
+ echo
+ echo Usage: ./backup.sh [-h, --help]
+ echo
+ echo This utility extracts a TAR backup of data and logs
+ echo produced by the Taler services running inside this Docker
+ echo Compose setup. The backup is saved in /tmp/YYYY-MM-DD-taler-backup.tar
+}
+
+for helpOpt in "-h" "--help"; do
+ if test "$helpOpt" = "${1:-}"; then
+ usage
+ exit 0
+ fi
+done
+
if ! which docker > /dev/null; then
echo docker not found.
exit 1
diff --git a/docker/demo/build_base.sh b/docker/demo/build_base.sh
index 578ee9d..a9b65e4 100755
--- a/docker/demo/build_base.sh
+++ b/docker/demo/build_base.sh
@@ -3,20 +3,34 @@
# args: $1 base Dockerfile, $2 optional tags file
set -e
-if test $# -eq 0; then
- echo Usage: ./build_base.sh docker-file [tags-file]
+
+usage () {
+ echo Usage: ./build_base.sh [-h, --help] docker-file [tags-file]
echo
echo Builds the taler_local/taler_base base image, optionally
echo using the 'tags-file', a text file containing environment
echo variables definitions to specify to which Git tag each Taler
echo component should be pulled.
- exit 0
-fi
+}
+
+for helpOpt in "-h" "--help"; do
+ if test "$helpOpt" = "${1:-}"; then
+ usage
+ exit 0
+ fi
+done
if ! which realpath > /dev/null; then
echo "Please, install 'realpath' (coreutils)"
fi
+# Help message not returned, assume the first
+# argument is the Dockerfile.
+if test -z "$1"; then
+ echo docker-file argument not found.
+ exit 1
+fi
+
DOCKER_FILE=$(realpath $1)
# Check base file.
diff --git a/docker/demo/import-backup.sh b/docker/demo/import-backup.sh
index 6e13919..2531611 100755
--- a/docker/demo/import-backup.sh
+++ b/docker/demo/import-backup.sh
@@ -1,6 +1,22 @@
#!/bin/bash
-set -e
+set -eu
+
+usage () {
+ echo
+ echo Usage: ./import-backup.sh [-h, --help] backup-tar
+ echo
+ echo This utility imports a TAR backup of data and logs
+ echo into the Taler services running inside this Docker
+ echo Compose setup.
+}
+
+for arg in "$@"; do
+ if test "$arg" = "--help" -o "$arg" = "-h"; then
+ usage
+ exit 0
+ fi
+done
if ! which docker > /dev/null; then
echo docker not found.
@@ -12,18 +28,21 @@ if ! docker images | grep debian | grep stable > /dev/null; then
exit 2
fi
-if test -z $1; then
- echo "Please, give the backup (TAR) file's path as the one argument."
+# No --help/-h given, assume the first argument is the TAR.
+BACKUP_TAR="${1:-}"
+
+if test -z $BACKUP_TAR; then
+ echo Backup file argument not given.
exit 1
fi
-if ! test -a $1; then
- echo File $1 not found.
+if ! test -a $BACKUP_TAR; then
+ echo File $BACKUP_TAR not found.
exit 1
fi
docker run \
- -v $1:/tmp/backup.tar \
+ -v $BACKUP_TAR:/tmp/backup.tar \
-v demo_talerdata:/taler-data \
-v demo_talerlogs:/taler-logs \
-it debian:stable /bin/bash -c "tar -x -f /tmp/backup.tar"