summaryrefslogtreecommitdiff
path: root/regional-currency/main.sh
diff options
context:
space:
mode:
Diffstat (limited to 'regional-currency/main.sh')
-rwxr-xr-xregional-currency/main.sh104
1 files changed, 104 insertions, 0 deletions
diff --git a/regional-currency/main.sh b/regional-currency/main.sh
new file mode 100755
index 0000000..a88ac3d
--- /dev/null
+++ b/regional-currency/main.sh
@@ -0,0 +1,104 @@
+#!/bin/bash
+# This file is in the public domain.
+
+# main.sh is the main script that asks the questions and
+# puts the answers into environment variables located at "config/taler-internal.conf or config/taler.conf" files
+# Nginx configuration - Reads values directly from these "config files".
+
+set -eu
+
+# include functions source file
+
+source functions.sh
+
+# Clear logs
+
+> setup.log
+
+# include variables from configuration
+mkdir -p config/
+touch config/user.conf config/internal.conf
+# Values we generated
+source config/internal.conf
+
+# Ask questions to user
+# START USER INTERACTION
+say "Welcome to the GNU Taler regional currency setup!"
+say ""
+say "All configuration values asked during the setup script"
+say "can be changed in config/user.conf."
+say "Logs are written in setup.log."
+say ""
+
+# END USER INTERACTION
+
+# Check if the user is root, otherwise EXIT.
+check_user
+
+# Installation of deb packages required
+say ""
+say "Installing packages (step 1 of 6)"
+. install_packages.sh
+
+say ""
+say "Interactive configuration (step 2 of 6)"
+{ source <(./config.py 3>&1 >&4 4>&-); } 4>&1
+
+# Remove when libeufin currencies.conf is in sync with exchange
+cat >>/usr/share/libeufin/config.d/netzbon.conf <<EOF
+[CURRENCY-NETZBON]
+enabled=yes
+name=NetzBon
+code=NETZBON
+fractional_input_digits=2
+fractional_normal_digits=2
+fractional_trailing_zero_digits=2
+alt_unit_names={"0":"NETZBON"}
+EOF
+
+if test -z "${BANK_EXCHANGE_PASSWORD:-}"; then
+ BANK_EXCHANGE_PASSWORD=$(uuidgen)
+ echo "BANK_EXCHANGE_PASSWORD=\"${BANK_EXCHANGE_PASSWORD}\"" >>config/internal.conf
+fi
+
+if test -z "${BANK_PORT:-}"; then
+ echo "BANK_PORT=8080" >>config/user.conf
+ export BANK_PORT=8080
+fi
+
+say ""
+say "Configuring nginx (step 3 of 6)"
+./config_nginx.sh
+
+say ""
+say "Setting up libeufin (step 4 of 6)"
+./setup-libeufin.sh
+
+say ""
+say "Setting up exchange (step 5 of 6)"
+./setup-exchange.sh
+
+say ""
+say "Setting up merchant (step 6 of 6)"
+./setup-merchant.sh
+
+# Final message to the user
+say ""
+say "Congratulations, you have successfully installed GNU Taler"
+say "Your bank is at ${PROTO}://bank.${DOMAIN_NAME}/"
+if test ${BANK_ADMIN_PASSWORD_GENERATED} == y; then
+ say "You can connect to the bank web UI as 'admin' using '${BANK_ADMIN_PASSWORD}'"
+else
+ say "You can connect to the bank web UI as 'admin' using the password you entered earlier"
+fi
+say "A merchant is at ${PROTO}://backend.${DOMAIN_NAME}/"
+say "You should set credentials for the merchant soon."
+say "The exchange withdraw URI is taler://withdraw-exchange/exchange.${DOMAIN_NAME}/"
+
+if test ${DO_CONVERSION} == y; then
+ say "For currency conversion to work, you must manually complete"
+ say "the EBICS configuration."
+fi
+
+exit 0
+# END INSTALLATION