diff options
Diffstat (limited to 'bin/taler-deployment-prepare')
-rwxr-xr-x | bin/taler-deployment-prepare | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/bin/taler-deployment-prepare b/bin/taler-deployment-prepare index b3ddd4b..20d737b 100755 --- a/bin/taler-deployment-prepare +++ b/bin/taler-deployment-prepare @@ -9,7 +9,7 @@ set -eu -source $HOME/activate +source "$HOME/activate" if [[ -z ${TALER_ENV_NAME+x} ]]; then echo "TALER_ENV_NAME not set" @@ -22,14 +22,14 @@ if [[ -z ${TALER_CONFIG_CURRENCY+x} ]]; then fi function generate_config() { - EXCHANGE_PUB=$(gnunet-ecc -p $HOME/deployment/private-keys/${TALER_ENV_NAME}-exchange-master.priv) + EXCHANGE_PUB=$(gnunet-ecc -p "$HOME/deployment/private-keys/${TALER_ENV_NAME}-exchange-master.priv") - mkdir -p $HOME/.config + mkdir -p "$HOME/.config" - $HOME/deployment/bin/taler-config-generate \ + "$HOME/deployment/bin/taler-config-generate" \ --exchange-pub "$EXCHANGE_PUB" \ --currency "$TALER_CONFIG_CURRENCY" \ - --outdir $HOME/.config \ + --outdir "$HOME/.config" \ --envname "$TALER_ENV_NAME" } @@ -50,18 +50,36 @@ esac ## Step 2: Copy key material and update denom keys ## +case $TALER_ENV_NAME in + demo|test|int) + EXCHANGE_PUB=$(gnunet-ecc -p "$HOME/deployment/private-keys/${TALER_ENV_NAME}-exchange-master.priv") + EXCHANGE_PRIV_FILE=$(taler-config -f -s exchange -o master_priv_file) + if [[ -e "$EXCHANGE_PRIV_FILE" ]]; then + EXCHANGE_PUB2=$(gnunet-ecc -p "$EXCHANGE_PRIV_FILE") + if [[ "$EXCHANGE_PUB" != "$EXCHANGE_PUB2" ]]; then + echo "Warning: Different exchange private key already exists, not copying" + fi + else + cp "$HOME/deployment/private-keys/${TALER_ENV_NAME}-exchange-master.priv" "$EXCHANGE_PRIV_FILE" + fi + ;; + *) + echo "Not copying key material for env $TALER_ENV_NAME" + ;; +esac + EXCHANGE_MASTER_PUB=$(taler-config -s exchange -o master_public_key) taler-auditor-exchange \ - -m $EXCHANGE_MASTER_PUB \ - -u $(taler-config -s exchange -o base_url) || true + -m "$EXCHANGE_MASTER_PUB" \ + -u "$(taler-config -s exchange -o base_url)" || true rm -f auditor.in taler-exchange-keyup -o auditor.in -taler-auditor-sign -m $EXCHANGE_MASTER_PUB -r auditor.in -o auditor.out || true +taler-auditor-sign -m "$EXCHANGE_MASTER_PUB" -r auditor.in -o auditor.out || true rm -f auditor.in auditor.out # we don't actually use the auditor's signatures in the demo! # Make configuration accessible to auditor -chmod 750 $HOME/.config +chmod 750 "$HOME/.config" ## ## Step 3: Sign the exchange's wire information @@ -70,7 +88,7 @@ chmod 750 $HOME/.config WIRE_RESPONSE=$(taler-config -s exchange-account-1 -o wire_response -f) taler-exchange-wire -chmod 770 $WIRE_RESPONSE +chmod 770 "$WIRE_RESPONSE" ## |