summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntoine A <>2024-02-20 15:57:44 +0100
committerAntoine A <>2024-02-20 15:57:44 +0100
commit9b974ef0e13cf15e4333bced01bd027ab5dce977 (patch)
treecb917276c8fa04e2a5f38522aaf0eea15dc60d42
parente998accdbfd0727af6e418ee74e34fba2536942d (diff)
downloaddeployment-9b974ef0e13cf15e4333bced01bd027ab5dce977.tar.gz
deployment-9b974ef0e13cf15e4333bced01bd027ab5dce977.tar.bz2
deployment-9b974ef0e13cf15e4333bced01bd027ab5dce977.zip
Improve regional currency script
-rwxr-xr-xregional-currency/functions.sh31
-rwxr-xr-xregional-currency/main.sh18
2 files changed, 11 insertions, 38 deletions
diff --git a/regional-currency/functions.sh b/regional-currency/functions.sh
index 604265e..3dc2626 100755
--- a/regional-currency/functions.sh
+++ b/regional-currency/functions.sh
@@ -66,7 +66,7 @@ function ask_questions() {
fi
fi
if test -z "${DO_OFFLINE:-}"; then
- read -r -p "Run taler-exchange-offline? (y/n): " DO_OFFLINE
+ read -r -p "Do you want Taler Exchange keys in this server (y), or externally in other server (n) ?" DO_OFFLINE
echo "DO_OFFLINE=${DO_OFFLINE}" >>config/user.conf
fi
if test -z "${MASTER_PUBLIC_KEY:-}"; then
@@ -86,7 +86,7 @@ function ask_questions() {
read -r -p "Enter your Telesign Customer ID: " TELESIGN_CUSTOMER_ID
read -r -s -p "Enter your Telesign API Key: " TELESIGN_API_KEY
echo "" # force new line
- read -r -p "Enter a phone number to test: " TELESIGN_PHONE
+ read -r -p "Enter a phone number to test your API key (e.g. '+447911123456'): " TELESIGN_PHONE
TELESIGN_AUTH_TOKEN=$(echo "$TELESIGN_CUSTOMER_ID:$TELESIGN_API_KEY" | base64 -w 0)
export AUTH_TOKEN=$TELESIGN_AUTH_TOKEN
echo "12345" | libeufin-tan-sms.sh $TELESIGN_PHONE
@@ -98,7 +98,6 @@ function ask_questions() {
echo "TELESIGN_AUTH_TOKEN=\"${TELESIGN_AUTH_TOKEN}\"" >>config/user.conf
fi
echo "DO_TELESIGN=${DO_TELESIGN}" >>config/user.conf
- echo "" # force new line
fi
}
@@ -113,32 +112,6 @@ function normalize_currency() {
echo "${CURRENCY}"
}
-function check_currency_spec() {
- return 0
- # TODO fix when 'taler-harness deployment setup-currency' works
- # Convert to lowercase
- local CURRENCY=$(echo "$1" | tr A-Z a-z)
- local HAS_SPEC=$(taler-config -S 2>/dev/null | grep --count "^currency-$CURRENCY$")
- if test "${HAS_SPEC}" != "1"; then
- say "Missing currency specification for $1, creating one"
- read -r -p "Enter the currency name (e.g. 'US Dollar' for USD): " CURRENCY_SPEC_NAME
- read -r -p "Enter the currency unit name (e.g. '$' for USD): " CURRENCY_SPEC_UNIT_NAME
- cat << EOF > /usr/share/taler/config.d/$CURRENCY.conf
-[currency-$CURRENCY]
-ENABLED=YES
-name="$CURRENCY_SPEC_NAME"
-code="$1"
-fractional_input_digits=2
-fractional_normal_digits=2
-fractional_trailing_zero_digits=2
-alt_unit_names = {"0":"$CURRENCY_SPEC_UNIT_NAME"}
-EOF
- chmod a+r /usr/share/taler/config.d/$CURRENCY.conf
- ln -s /usr/share/taler/config.d/$CURRENCY.conf /usr/share/libeufin/config.d/$CURRENCY.conf
- say "Currency specification for $1 have been created at /usr/share/taler/config.d/$CURRENCY.conf"
- fi
-}
-
function check_dns() {
for prefix in "exchange" "bank" "backend"; do
if ! ping -c1 "${prefix}.${DOMAIN_NAME}" &>>setup.log; then
diff --git a/regional-currency/main.sh b/regional-currency/main.sh
index 1d3eb6a..5234b78 100755
--- a/regional-currency/main.sh
+++ b/regional-currency/main.sh
@@ -32,8 +32,6 @@ say "can be changed in config/user.conf."
say "Logs are written in setup.log."
say ""
-ask_questions
-
# END USER INTERACTION
# Check if the user is root, otherwise EXIT.
@@ -41,9 +39,13 @@ check_user
# Installation of deb packages required
say ""
-say "Installing packages (step 1 of 5)"
+say "Installing packages (step 1 of 6)"
. install_packages.sh
+say ""
+say "Interactive configuration (step 2 of 6)"
+ask_questions
+
check_dns
# Remove when libeufin currencies.conf is in sync with exchange
cat >>/usr/share/libeufin/config.d/netzbon.conf <<EOF
@@ -56,8 +58,6 @@ fractional_normal_digits=2
fractional_trailing_zero_digits=2
alt_unit_names={"0":"NETZBON"}
EOF
-check_currency_spec $CURRENCY
-check_currency_spec $FIAT_CURRENCY
if test -z "${BANK_EXCHANGE_PASSWORD:-}"; then
BANK_EXCHANGE_PASSWORD=$(uuidgen)
@@ -75,19 +75,19 @@ else
fi
say ""
-say "Configuring nginx (step 2 of 5)"
+say "Configuring nginx (step 3 of 6)"
./config_nginx.sh
say ""
-say "Setting up libeufin (step 3 of 5)"
+say "Setting up libeufin (step 4 of 6)"
./setup-libeufin.sh
say ""
-say "Setting up exchange (step 4 of 5)"
+say "Setting up exchange (step 5 of 6)"
./setup-exchange.sh
say ""
-say "Setting up merchant (step 5 of 5)"
+say "Setting up merchant (step 6 of 6)"
./setup-merchant.sh
# Final message to the user