summaryrefslogtreecommitdiff
path: root/bootstrap-standalone
blob: dc62b0ef46a0f74723bd2c2226af7fed71c6e1f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/bash

# Bootstrap the Taler setup for the user account that
# is currently logged in.

# Generates a setup for a single user,
# including a postgresql DB.

set -eu

ENVNAME=$USER
BRANCH=master
CURRENCY=$(echo "KUDOS-$USER" | cut -c 1-12)

cd $HOME

if ! test -d $HOME/gnunet; then
  git clone git://gnunet.org/gnunet.git
fi

if ! test -d $HOME/libmicrohttpd; then
  git clone git://gnunet.org/libmicrohttpd.git
fi

for component in bank merchant gnurl landing exchange merchant-frontends deployment auditor; do
  if ! test -d $HOME/$component; then
    git clone /var/git/$component.git
  fi
done

for component in bank merchant landing exchange merchant-frontends auditor; do
  echo "Checking out $component to $BRANCH"
  git -C $HOME/$component checkout $BRANCH
done

if ! test -d $HOME/talerdb; then
  /usr/lib/postgresql/9.5/bin/initdb -D talerdb -U $USER
fi

mkdir -p $HOME/sockets

/usr/lib/postgresql/9.5/bin/postgres --single -D ~/talerdb  -k $HOME/sockets -h "" postgres \
  >/dev/null <<< "create database taler"
/usr/lib/postgresql/9.5/bin/postgres --single -D ~/talerdb  -k $HOME/sockets -h "" postgres \
  >/dev/null <<< "create database talercheck"

cat >$HOME/activate <<EOL
#!/bin/bash

function taler-config-generate () {
  echo "Command disabled. Please use taler-deployment-config-generate instead."
  return 1
}
function taler-exchange-keyup () {
  echo "Command disabled. Please use taler-deployment-keyup instead."
}

export PATH="$HOME/deployment/bin:$HOME/local/bin:\$PATH"
export TALER_CHECKDB="postgresql:///talercheck?host=$HOME/sockets"
export TALER_CONFIG_CURRENCY=$CURRENCY
export TALER_CONFIG_STANDALONE=1

# DEPRECATED ALIAS!
export TALER_CONFIG_ENV=$ENVNAME

export TALER_ENV_NAME=$ENVNAME
export TALER_CONFIG_DB="postgresql:///taler?host=$HOME/sockets"
export TALER_ENV_URL_INTRO="https://env.taler.net/$ENVNAME/"
export TALER_ENV_URL_BANK="https://env.taler.net/$ENVNAME/bank"
export TALER_ENV_URL_MERCHANT_BLOG="https://env.taler.net/$ENVNAME/shop"
export TALER_ENV_URL_MERCHANT_DONATIONS="https://env.taler.net/$ENVNAME/donations"
export TALER_ENV_URL_AUDITOR="https://env.taler.net/$ENVNAME/auditor"
export TALER_ACTIVATED=1
EOL