summaryrefslogtreecommitdiff
path: root/netzbon/main.sh
diff options
context:
space:
mode:
Diffstat (limited to 'netzbon/main.sh')
-rwxr-xr-xnetzbon/main.sh105
1 files changed, 46 insertions, 59 deletions
diff --git a/netzbon/main.sh b/netzbon/main.sh
index 52f5f67..b05af85 100755
--- a/netzbon/main.sh
+++ b/netzbon/main.sh
@@ -26,62 +26,53 @@ say ""
say "All configuration values asked during the setup script"
say "can be changed in config/user.conf"
-if test -z "${CURRENCY:-}"
-then
- read -p "Enter the name of the currency (e.g. 'EUR'): " CURRENCY
- # convert to all-caps
- CURRENCY=`echo ${CURRENCY} | tr a-z A-Z`
- # libeufin currenly doesn't like currency names less than 3 letters.
- if [[ ${#CURRENCY} -lt 3 || ${#CURRENCY} -gt 11 ]]; then
- say "Currency name must be between 3 and 10 letters"
- exit 1
- fi
- echo "CURRENCY=${CURRENCY}" >> config/user.conf
+if test -z "${CURRENCY:-}"; then
+ read -p "Enter the name of the currency (e.g. 'EUR'): " CURRENCY
+ # convert to all-caps
+ CURRENCY=$(echo ${CURRENCY} | tr a-z A-Z)
+ # libeufin currenly doesn't like currency names less than 3 letters.
+ if [[ ${#CURRENCY} -lt 3 || ${#CURRENCY} -gt 11 ]]; then
+ say "Currency name must be between 3 and 10 letters"
+ exit 1
+ fi
+ echo "CURRENCY=${CURRENCY}" >>config/user.conf
fi
-if test -z "${BANK_NAME:-}"
-then
- read -p "Enter the human-readable name of the bank (e.g. 'Taler Bank'): " BANK_NAME
- echo "BANK_NAME=\"${BANK_NAME}\"" >> config/user.conf
+if test -z "${BANK_NAME:-}"; then
+ read -p "Enter the human-readable name of the bank (e.g. 'Taler Bank'): " BANK_NAME
+ echo "BANK_NAME=\"${BANK_NAME}\"" >>config/user.conf
fi
-if test -z "${ENABLE_TLS:-}"
-then
- read -p "Use TLS? (y/n): " ENABLE_TLS
- echo "ENABLE_TLS=${ENABLE_TLS}" >> config/user.conf
+if test -z "${ENABLE_TLS:-}"; then
+ read -p "Use TLS? (y/n): " ENABLE_TLS
+ echo "ENABLE_TLS=${ENABLE_TLS}" >>config/user.conf
fi
-if test -z "${DO_OFFLINE:-}"
-then
- read -p "Run taler-exchange-offline? (y/n): " DO_OFFLINE
- echo "DO_OFFLINE=${DO_OFFLINE}" >> config/user.conf
+if test -z "${DO_OFFLINE:-}"; then
+ read -p "Run taler-exchange-offline? (y/n): " DO_OFFLINE
+ echo "DO_OFFLINE=${DO_OFFLINE}" >>config/user.conf
fi
-if test -z "${MASTER_PUBLIC_KEY:-}"
-then
- if test ${DO_OFFLINE:-y} == n
- then
- read -p "Enter the exchange-offline master public key: " MASTER_PUBLIC_KEY
- echo "MASTER_PUBLIC_KEY=${MASTER_PUBLIC_KEY}" >> config/user.conf
- fi
+if test -z "${MASTER_PUBLIC_KEY:-}"; then
+ if test ${DO_OFFLINE:-y} == n; then
+ read -p "Enter the exchange-offline master public key: " MASTER_PUBLIC_KEY
+ echo "MASTER_PUBLIC_KEY=${MASTER_PUBLIC_KEY}" >>config/user.conf
+ fi
fi
-if test -z "${SANDBOX_ADMIN_PASSWORD:-}"
-then
- read -s -p "Enter the admin password for the bank: " SANDBOX_ADMIN_PASSWORD
- echo "SANDBOX_ADMIN_PASSWORD=${SANDBOX_ADMIN_PASSWORD}" >> config/user.conf
- echo "" # force new line
+if test -z "${SANDBOX_ADMIN_PASSWORD:-}"; then
+ read -s -p "Enter the admin password for the bank: " SANDBOX_ADMIN_PASSWORD
+ echo "SANDBOX_ADMIN_PASSWORD=${SANDBOX_ADMIN_PASSWORD}" >>config/user.conf
+ echo "" # force new line
fi
-if test -z "${DOMAIN_NAME:-}"
-then
- read -p "Enter the domain name: " DOMAIN_NAME
- # convert to lower-case
- DOMAIN_NAME=`echo ${DOMAIN_NAME} | tr A-Z a-z`
- echo "DOMAIN_NAME=${DOMAIN_NAME}" >> config/user.conf
+if test -z "${DOMAIN_NAME:-}"; then
+ read -p "Enter the domain name: " DOMAIN_NAME
+ # convert to lower-case
+ DOMAIN_NAME=$(echo ${DOMAIN_NAME} | tr A-Z a-z)
+ echo "DOMAIN_NAME=${DOMAIN_NAME}" >>config/user.conf
fi
# END USER INTERACTION
# Check DNS settings
-if ! ping -c1 exchange.${DOMAIN_NAME} &> /dev/null
-then
- say "Could not ping exchange.${DOMAIN_NAME}."
- say "Please make sure your DNS/network are working."
- exit 1
+if ! ping -c1 exchange.${DOMAIN_NAME} &>/dev/null; then
+ say "Could not ping exchange.${DOMAIN_NAME}."
+ say "Please make sure your DNS/network are working."
+ exit 1
fi
# Check if the user is root, otherwise EXIT.
@@ -90,15 +81,13 @@ check_user
# Installation of deb packages required
. install_packages.sh
-if test -z "${NEXUS_EXCHANGE_PASSWORD:-}"
-then
- NEXUS_EXCHANGE_PASSWORD=`uuidgen`
- echo "NEXUS_EXCHANGE_PASSWORD=${NEXUS_EXCHANGE_PASSWORD}" >> config/internal.conf
+if test -z "${NEXUS_EXCHANGE_PASSWORD:-}"; then
+ NEXUS_EXCHANGE_PASSWORD=$(uuidgen)
+ echo "NEXUS_EXCHANGE_PASSWORD=${NEXUS_EXCHANGE_PASSWORD}" >>config/internal.conf
fi
-if test -z "${SANDBOX_EXCHANGE_PASSWORD:-}"
-then
- SANDBOX_EXCHANGE_PASSWORD=`uuidgen`
- echo "SANDBOX_EXCHANGE_PASSWORD=${SANDBOX_EXCHANGE_PASSWORD}" >> config/internal.conf
+if test -z "${SANDBOX_EXCHANGE_PASSWORD:-}"; then
+ SANDBOX_EXCHANGE_PASSWORD=$(uuidgen)
+ echo "SANDBOX_EXCHANGE_PASSWORD=${SANDBOX_EXCHANGE_PASSWORD}" >>config/internal.conf
fi
. config_launch_libeufin.sh
@@ -106,13 +95,11 @@ fi
. setup-exchange.sh
. setup-merchant.sh
-
# Final message to the user
-if test ${ENABLE_TLS:-} == "y"
-then
- PROTO="https"
+if test ${ENABLE_TLS:-} == "y"; then
+ PROTO="https"
else
- PROTO="http"
+ PROTO="http"
fi
say "Congratulations, you have successfully installed GNU Taler"