summaryrefslogtreecommitdiff
path: root/netzbon/functions.sh
diff options
context:
space:
mode:
Diffstat (limited to 'netzbon/functions.sh')
-rwxr-xr-xnetzbon/functions.sh160
1 files changed, 31 insertions, 129 deletions
diff --git a/netzbon/functions.sh b/netzbon/functions.sh
index 9820ca6..afdd12e 100755
--- a/netzbon/functions.sh
+++ b/netzbon/functions.sh
@@ -1,14 +1,15 @@
#!/bin/bash
# Message
-# -----------------------------------
+
function say()
{
echo "TALER: " "$@"
}
+
# Check user if the user is root
-# -----------------------------------
+
function check_user()
{
@@ -18,135 +19,36 @@ function check_user()
fi
}
-# Asks several questions to the user
-# -----------------------------------
-function ask()
-{
-
-# DOMAIN_NAME
-
-if [ $1 == "DOMAIN_NAME" ]; then
- read -p "Enter the domain name: " DOMAIN_NAME
-fi
-
-# ENABLE_TLS
-
-if [ $1 == "ENABLE_TLS" ]; then
- read -p "Use TLS? (y/n): " ENABLE_TLS
-fi
-
-# CURRENCY
-
-if [ $1 == "CURRENCY" ]; then
- read -p "Enter the name of the currency (e.g. 'EUR'):" CURRENCY
-fi
-
-# BANK_NAME
-
-if [ $1 == "BANK_NAME" ]; then
- read -p "Enter the human-readable name of the bank (e.g. 'Taler Bank'): " BANK_NAME
-
-fi
-
-# DO_OFFLINE
-
-if [ $1 == "DO_OFFLINE" ]; then
- read -p "Run taler-exchange offline? (y/n): " DO_OFFLINE
-fi
-
-# MASTER_PUBLIC_KEY
-
-if [ $1 == "MASTER_PUBLIC_KEY" ]; then
- if [ $2 == "DO_OFFLINE" ] && [ $DO_OFFLINE == 'n' ]; then
- read -p "Enter the exchange-offline master public key: " MASTER_PUBLIC_KEY
- fi
-fi
-
-# SANDBOX_ADMIN_PASSWORD
-
-if [ $1 == "SANDBOX_ADMIN_PASSWORD" ]; then
- read -s -p "Enter the admin password for the bank: " SANDBOX_ADMIN_PASSWORD
- echo "" # force new line
-fi
-
-# SANDBOX_EXCHANGE_PASSWORD
-
-if [ $1 == "SANDBOX_EXCHANGE_PASSWORD" ]; then
- SANDBOX_EXCHANGE_PASSWORD=`uuidgen`
-
-fi
-
-
-# NEXUS_EXCHANGE_PASSWORD
-
-if [ $1 == "NEXUS_EXCHANGE_PASSWORD" ]; then
- NEXUS_EXCHANGE_PASSWORD=`uuidgen`
-fi
-
-}
-
-
-
-function check_nexus_exchange ()
-{
-
-if test -z ${LIBEUFIN_NEXUS_USERNAME:-}
-then
- say "Failure: LIBEUFIN_NEXUS_USERNAME not set"
- exit 1
-fi
-
-if test -z ${NEXUS_EXCHANGE_PASSWORD:-}
-then
- say "Failure: NEXUS_EXCHANGE_PASSWORD not set"
- exit 1
-fi
-
-if test -z ${EXCHANGE_IBAN:-}
-then
- say "Failure: EXCHANGE_IBAN not set"
- exit 1
-fi
-if test -z ${EXCHANGE_PAYTO:-}
-then
- say "Failure: EXCHANGE_PAYTO not set"
- exit 1
-fi
-
-}
-
-
-# Ask about whether use TLS or not
-# -----------------------------------
-
-function ask_tls()
+# Create users "exchange" and "merchant"
+# Deprecated: should be done by Debian!
+function create_users()
{
-
-read -p "Use TLS? (y/n): " ENABLE_TLS
-
-if test ${ENABLE_TLS} == "y"
-then
- PROTO="https"
-else
- PROTO="http"
-fi
+ say "Creating users"
+ for n in exchange merchant
+ do
+ # Only setup use if it does not yet exist
+ if test ! -d /home/$n
+ then
+ adduser --disabled-password $n
+ fi
+ done
}
-# Check network
-# -----------------------------------
-
-check_dns()
+# Assign group and permissions to users
+# Deprecated: should be done by Debian!
+function assign_user_permissions()
{
-
-ping -c1 exchange.${DOMAIN_NAME} # &> /dev/null
-
-
-if test 0 != $?
-then
- say "Could not ping TO exchange.${DOMAIN_NAME}."
- say "Please make sure your DNS/network are working."
- exit 1
-fi
-
+ for n in exchange merchant
+ do
+ adduser www-data $n
+ mkdir -p /home/$n/.config/
+ # FIXME
+ # cp -r $n/* /home/$n/
+ # TODO: No taler.conf is provided
+ # mv /home/$n/taler.conf /home/$n/.config/taler.conf
+ chmod 600 /home/$n/.config/taler.conf
+ chown -R $n:$n /home/$n/
+ su - postgres -c "createuser $n"
+ su - postgres -c "createdb -O $n taler-$n"
+ done
}
-