From 7870c134928ffc971ecc723e20b22ad492d7f2c4 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Wed, 12 Apr 2023 15:29:20 +0200 Subject: netzbon: quoting --- netzbon/config_launch_libeufin.sh | 36 ++++++++++++++++---------------- netzbon/setup-exchange.sh | 44 +++++++++++++++++++-------------------- 2 files changed, 40 insertions(+), 40 deletions(-) diff --git a/netzbon/config_launch_libeufin.sh b/netzbon/config_launch_libeufin.sh index 1231378..09bf077 100755 --- a/netzbon/config_launch_libeufin.sh +++ b/netzbon/config_launch_libeufin.sh @@ -45,7 +45,7 @@ fi # TODO: add sanity-checks for presence of other required env-vars -if test ${ENABLE_TLS:-} == "y"; then +if test "${ENABLE_TLS:-}" == "y"; then PROTO="https" else PROTO="http" @@ -68,7 +68,7 @@ echo "LIBEUFIN_NEXUS_USERNAME=\"${LIBEUFIN_NEXUS_USERNAME}\"" >>config/internal. source /etc/libeufin/nexus.env export LIBEUFIN_NEXUS_DB_CONNECTION -if test -z ${LIBEUFIN_NEXUS_DB_CONNECTION:-}; then +if test -z "${LIBEUFIN_NEXUS_DB_CONNECTION:-}"; then say "Error: /etc/libeufin/nexus.env does not specify LIBEUFIN_NEXUS_DB_CONNECTION" exit 1 fi @@ -82,7 +82,7 @@ export LIBEUFIN_NEXUS_URL="http://localhost:${LIBEUFIN_NEXUS_PORT}" . /etc/libeufin/sandbox.env export LIBEUFIN_SANDBOX_DB_CONNECTION -if test -z ${LIBEUFIN_SANDBOX_DB_CONNECTION:-}; then +if test -z "${LIBEUFIN_SANDBOX_DB_CONNECTION:-}"; then say "Error: /etc/libeufin/sandbox.env does not specify LIBEUFIN_SANDBOX_DB_CONNECTION" exit 1 fi @@ -105,7 +105,7 @@ sudo -E -u libeufin-sandbox \ --bank-debt-limit 1000000 \ --users-debt-limit 0 \ --without-signup-bonus \ - --currency ${CURRENCY} \ + --currency "${CURRENCY}" \ default say "DONE" say "Start the bank..." @@ -117,13 +117,13 @@ curl --max-time 25 \ --retry-connrefused \ --retry-delay 3 \ --retry 10 \ - ${SANDBOX_URL} &>/dev/null + "${SANDBOX_URL}" &>/dev/null say "DONE" say "Make one superuser at Nexus..." sudo -E -u libeufin-nexus libeufin-nexus superuser \ ${LIBEUFIN_NEXUS_USERNAME} \ - --password $NEXUS_EXCHANGE_PASSWORD + --password "$NEXUS_EXCHANGE_PASSWORD" say "DONE" say "Launching Nexus..." @@ -135,7 +135,7 @@ curl --max-time 25 \ --retry-connrefused \ --retry-delay 3 \ --retry 10 \ - ${LIBEUFIN_NEXUS_URL} &>/dev/null + "${LIBEUFIN_NEXUS_URL}" &>/dev/null say "DONE" EXCHANGE_SANDBOX_USERNAME="exchange-at-sandbox" @@ -147,28 +147,28 @@ export LIBEUFIN_SANDBOX_PASSWORD="${SANDBOX_EXCHANGE_PASSWORD}" # FIXME-MS: might be better to DELETE an existing # account here instead!?? libeufin-cli \ - sandbox --sandbox-url ${SANDBOX_URL} \ + sandbox --sandbox-url "${SANDBOX_URL}" \ demobank register || true say "DONE" say "Getting the exchange IBAN and Payto URI..." EXCHANGE_DETAILS=$(libeufin-cli \ - sandbox --sandbox-url ${SANDBOX_URL} \ + sandbox --sandbox-url "${SANDBOX_URL}" \ demobank info --bank-account ${LIBEUFIN_SANDBOX_USERNAME}) say "DONE" -EXCHANGE_IBAN=$(echo $EXCHANGE_DETAILS | jq -r .iban) -EXCHANGE_PAYTO=$(echo $EXCHANGE_DETAILS | jq -r .paytoUri) +EXCHANGE_IBAN=$(echo "$EXCHANGE_DETAILS" | jq -r .iban) +EXCHANGE_PAYTO=$(echo "$EXCHANGE_DETAILS" | jq -r .paytoUri) # Communicating this to the exchange script, as the exchange # needs it for the /wire response. export EXCHANGE_IBAN export EXCHANGE_PAYTO -echo "EXCHANGE_IBAN=\"${EXCHANGE_IBAN}\"" >>${MY_DIR}/config/internal.conf -echo "EXCHANGE_PAYTO=\"${EXCHANGE_PAYTO}\"" >>${MY_DIR}/config/internal.conf +echo "EXCHANGE_IBAN=\"${EXCHANGE_IBAN}\"" >>"${MY_DIR}"/config/internal.conf +echo "EXCHANGE_PAYTO=\"${EXCHANGE_PAYTO}\"" >>"${MY_DIR}"/config/internal.conf say "Setting the default exchange at Sandbox..." -libeufin-sandbox default-exchange "${PROTO}://exchange.$DOMAIN_NAME/" $EXCHANGE_PAYTO +libeufin-sandbox default-exchange "${PROTO}://exchange.$DOMAIN_NAME/" "$EXCHANGE_PAYTO" say "DONE" export LIBEUFIN_SANDBOX_USERNAME="admin" @@ -177,7 +177,7 @@ say "Create EBICS host at Sandbox..." # Continue on failure, request is not idempotent... # FIXME-MS: might be nicer to delete existing host first. libeufin-cli sandbox \ - --sandbox-url ${SANDBOX_URL} \ + --sandbox-url "${SANDBOX_URL}" \ ebicshost create --host-id ${EBICS_HOST_ID} || true say "OK" @@ -185,7 +185,7 @@ say "Create exchange EBICS subscriber at Sandbox..." # Continue on failure, request is not idempotent... # FIXME-MS: might be nicer to delete existing host first. libeufin-cli sandbox \ - --sandbox-url ${SANDBOX_URL} \ + --sandbox-url "${SANDBOX_URL}" \ demobank new-ebicssubscriber \ --host-id ${EBICS_HOST_ID} \ --user-id ${EBICS_USER_ID} \ @@ -226,13 +226,13 @@ say "Create the Taler facade at Nexus..." # FIXME-MS: might be nicer to delete existing facade first. libeufin-cli facades \ new-taler-wire-gateway-facade \ - --currency $CURRENCY \ + --currency "$CURRENCY" \ --facade-name ${LIBEUFIN_TALER_FACADE} \ ${EBICS_CONNECTION_NAME} ${LIBEUFIN_NEXUS_USERNAME} || true say "OK" export WIRE_GATEWAY_URL="${LIBEUFIN_NEXUS_URL}/facades/${LIBEUFIN_TALER_FACADE}/taler-wire-gateway/" -echo "WIRE_GATEWAY_URL=\"${WIRE_GATEWAY_URL}\"" >>${MY_DIR}/config/internal.conf +echo "WIRE_GATEWAY_URL=\"${WIRE_GATEWAY_URL}\"" >>"${MY_DIR}"/config/internal.conf say "Configuring the background jobs to submit/get transactions..." # Tries every second. 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" -- cgit v1.2.3