diff options
Diffstat (limited to 'netzbon/setup-exchange.sh')
-rwxr-xr-x | netzbon/setup-exchange.sh | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/netzbon/setup-exchange.sh b/netzbon/setup-exchange.sh index 1a031df..69e0238 100755 --- a/netzbon/setup-exchange.sh +++ b/netzbon/setup-exchange.sh @@ -5,7 +5,7 @@ set -eu notify_exit() { - [[ $1 == 0 ]] || echo Script $0 failed, exit code $1 + [[ $1 == 0 ]] || echo Script "$0" failed, exit code "$1" } notify_err() { @@ -34,29 +34,29 @@ say "Beginning Exchange setup" # - EXCHANGE_PAYTO (exchange account PAYTO) # - ENABLE_TLS (http or https?) -if test -z ${LIBEUFIN_NEXUS_USERNAME:-}; then +if test -z "${LIBEUFIN_NEXUS_USERNAME:-}"; then say "Failure: LIBEUFIN_NEXUS_USERNAME not set" exit 1 fi -if test -z ${NEXUS_EXCHANGE_PASSWORD:-}; then +if test -z "${NEXUS_EXCHANGE_PASSWORD:-}"; then say "Failure: NEXUS_EXCHANGE_PASSWORD not set" exit 1 fi -if test -z ${EXCHANGE_IBAN:-}; then +if test -z "${EXCHANGE_IBAN:-}"; then say "Failure: EXCHANGE_IBAN not set" exit 1 fi -if test -z ${WIRE_GATEWAY_URL:-}; then +if test -z "${WIRE_GATEWAY_URL:-}"; then say "Failure: WIRE_GATEWAY_URL not set" exit 1 fi -if test -z ${EXCHANGE_PAYTO:-}; then +if test -z "${EXCHANGE_PAYTO:-}"; then say "Failure: EXCHANGE_PAYTO not set" exit 1 fi function die() { - say $1 + say "$1" exit 1 } @@ -68,8 +68,8 @@ sudo -i -u taler-exchange-offline id >/dev/null || die "Error: Unable to switch export MASTER_PRIV_DIR=.local/share/taler/exchange/offline-keys export MASTER_PRIV_FILE=${MASTER_PRIV_DIR}/master.priv export SECMOD_TOFU_FILE=${MASTER_PRIV_DIR}/secm_tofus.pub -if test -z ${MASTER_PUBLIC_KEY:-}; then - if test ${DO_OFFLINE:-y} == n; then +if test -z "${MASTER_PUBLIC_KEY:-}"; then + if test "${DO_OFFLINE:-y}" == n; then say "Error: No MASTER_PUBLIC_KEY but DO_OFFLINE set to NO" exit 1 fi @@ -81,7 +81,7 @@ if test -z ${MASTER_PUBLIC_KEY:-}; then MASTER_PUBLIC_KEY=$(sudo -i -u taler-exchange-offline taler-exchange-offline -LDEBUG setup) echo "MASTER_PUBLIC_KEY=\"${MASTER_PUBLIC_KEY}\"" >>config/user.conf - if test -z ${DO_OFFLINE:-}; then + if test -z "${DO_OFFLINE:-}"; then # Set 'DO_OFFLINE' DO_OFFLINE=y echo "DO_OFFLINE=y" >>config/user.conf @@ -113,7 +113,7 @@ sudo -i -u postgres createdb -O taler-exchange-httpd $EXCHANGE_DB || true say "Configuring exchange" -if test ${ENABLE_TLS} = "y"; then +if test "${ENABLE_TLS}" = "y"; then export EXCHANGE_BASE_URL="https://exchange.${DOMAIN_NAME}/" else export EXCHANGE_BASE_URL="http://exchange.${DOMAIN_NAME}/" @@ -154,14 +154,14 @@ chmod 400 /etc/taler/secrets/exchange-accountcredentials-default.secret.conf chown taler-exchange-wire:taler-exchange-db /etc/taler/secrets/exchange-accountcredentials-default.secret.conf taler-harness deployment gen-coin-config \ - --min-amount ${CURRENCY}:0.01 \ - --max-amount ${CURRENCY}:100 | + --min-amount "${CURRENCY}":0.01 \ + --max-amount "${CURRENCY}":100 | sed -e "s/FEE_DEPOSIT = ${CURRENCY}:0.01/FEE_DEPOSIT = ${CURRENCY}:0/" \ - >/etc/taler/conf.d/${CURRENCY}-coins.conf + >/etc/taler/conf.d/"${CURRENCY}"-coins.conf # FIXME-DOLD: this belongs with taler-harness -for SEC in $(taler-config -c /etc/taler/conf.d/${CURRENCY}-coins.conf -S | grep COIN-); do - taler-config -c /etc/taler/conf.d/${CURRENCY}-coins.conf -s $SEC -o CIPHER -V "RSA" +for SEC in $(taler-config -c /etc/taler/conf.d/"${CURRENCY}"-coins.conf -S | grep COIN-); do + taler-config -c /etc/taler/conf.d/"${CURRENCY}"-coins.conf -s "$SEC" -o CIPHER -V "RSA" done say "Initializing exchange database" @@ -190,14 +190,14 @@ curl --max-time 2 \ --retry-connrefused \ --retry-delay 1 \ --retry 10 \ - ${EXCHANGE_BASE_URL}config &>/dev/null + "${EXCHANGE_BASE_URL}"config &>/dev/null say "DONE" say "Waiting for exchange management keys (this may take a while)..." curl --max-time 30 \ --retry-delay 1 \ --retry 60 \ - ${EXCHANGE_BASE_URL}management/keys &>/dev/null + "${EXCHANGE_BASE_URL}"management/keys &>/dev/null say "DONE" if test ${DO_OFFLINE} == y; then @@ -212,9 +212,9 @@ if test ${DO_OFFLINE} == y; then sudo -i -u taler-exchange-offline \ taler-exchange-offline \ - enable-account ${EXCHANGE_PAYTO} \ - wire-fee now iban ${CURRENCY}:0 ${CURRENCY}:0 \ - global-fee now ${CURRENCY}:0 ${CURRENCY}:0 ${CURRENCY}:0 1h 6a 0 \ + enable-account "${EXCHANGE_PAYTO}" \ + wire-fee now iban "${CURRENCY}":0 "${CURRENCY}":0 \ + global-fee now "${CURRENCY}":0 "${CURRENCY}":0 "${CURRENCY}":0 1h 6a 0 \ upload fi @@ -223,7 +223,7 @@ curl --max-time 2 \ --retry-connrefused \ --retry-delay 1 \ --retry 10 \ - ${EXCHANGE_BASE_URL}keys &>/dev/null + "${EXCHANGE_BASE_URL}"keys &>/dev/null say "DONE" say "Exchange setup finished" |