summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorMarcello Stanisci <stanisci.m@gmail.com>2019-06-08 13:34:16 +0200
committerMarcello Stanisci <stanisci.m@gmail.com>2019-06-08 13:34:16 +0200
commita30d49bccd6545d4b6d99785987777b4c452cd60 (patch)
tree72ad69306d26821cd4a791e1e444dfffcb08927a /bin
parentd1b8596366fa46aebfd6c868bf2702eba04b9124 (diff)
downloaddeployment-a30d49bccd6545d4b6d99785987777b4c452cd60.tar.gz
deployment-a30d49bccd6545d4b6d99785987777b4c452cd60.tar.bz2
deployment-a30d49bccd6545d4b6d99785987777b4c452cd60.zip
dir maker
Diffstat (limited to 'bin')
-rwxr-xr-xbin/taler-deployment-shared-data54
1 files changed, 54 insertions, 0 deletions
diff --git a/bin/taler-deployment-shared-data b/bin/taler-deployment-shared-data
new file mode 100755
index 0000000..805fcf6
--- /dev/null
+++ b/bin/taler-deployment-shared-data
@@ -0,0 +1,54 @@
+#!/bin/bash
+
+# @author Marcello Stanisci
+# @brief Creates the directories hierarchy under $HOME/shared-data/.
+# Note: shared-data/ must already exist and give execute
+# permission to the group (test|demo). Also note that any
+# program that creates files must set perms by its own!
+
+if test -z $TALER_CONFIG_ENV; then
+ echo Please run 'source ~/activate' first.
+ exit 1
+fi
+
+SHARED_DATA=$(taler-config -s paths -o taler_deployment_shared -f)
+
+# Check shared-data/ exists & has write permissions for group.
+if ! test -f $SHARED_DATA; then
+ echo Please bootstrap your setup first (run "bootstrap-bluegreen" script?).
+ exit 1
+fi
+
+# Check if shared-data/ has already a hierarchy.
+if find $SHARED_DATA -type d | grep -q [a-zA-Z]; then
+ echo $SHARED_DATA not empty, exiting
+ exit 0
+fi
+
+if ! test -w $SHARED_DATA; then
+ echo "Can't write under $SHARED_DATA, please ajdust permissions"
+ exit 0
+fi
+
+declare -A TALER_DIRS=(
+ [MERCHANT_WIRE]=$(dirname $(taler-config -s account-merchant -o wire_response -f))
+ [MERCHANT]=$(dirname $(taler-config -s instance-default -o keyfile -f))
+
+ [EXCHANGE_WIREFEES]=$(taler-config -s exchangedb -o wirefee_base_dir -f)
+ [EXCHANGE_AUDITOR_REQUEST]=$(taler-config -s exchangedb -o auditor_inputs -f)
+ [EXCHANGE_WIRE]=$(basename $(taler-config -s account-1 -o wire_response -f))
+ [EXCHANGE_OFFLINE_KEYS]=$(dirname $(taler-config -s exchange -o master_priv_file -f))
+ [EXCHANGE_LIVE_KEYS]=$(taler-config -s -o keydir -f)
+ [EXCHANGE_AUDITORS]=$(taler-config -s exchangedb -o auditor_base_dir -f)
+
+ [AUDITOR_REPORTS]=$(taler-config -s auditor -o reports -f)
+ [AUDITOR_OFFLINE_KEYS]=$(dirname $(taler-config -s auditor -o auditor_priv_file -f))
+)
+
+for dir in ${TALER_DIRS[@]}; do
+ mkdir -p $dir
+done
+
+# All dirs will give only the group RWX perms.
+chgrp -R $TALER_CONFIG_ENV $SHARED_DATA
+chmod -R 070 $SHARED_DATA