gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-deployment] branch master updated: scripts help message


From: gnunet
Subject: [taler-deployment] branch master updated: scripts help message
Date: Thu, 17 Nov 2022 11:36:20 +0100

This is an automated email from the git hooks/post-receive script.

ms pushed a commit to branch master
in repository deployment.

The following commit(s) were added to refs/heads/master by this push:
     new 8103b44  scripts help message
8103b44 is described below

commit 8103b44c26bd5437fd878c2feb694c9da39d4a03
Author: MS <ms@taler.net>
AuthorDate: Thu Nov 17 11:36:12 2022 +0100

    scripts help message
---
 docker/demo/backup.sh        | 16 ++++++++++++++++
 docker/demo/build_base.sh    | 22 ++++++++++++++++++----
 docker/demo/import-backup.sh | 31 +++++++++++++++++++++++++------
 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"

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]