run-server.sh 832 Bytes
Newer Older
1 2
#!/bin/sh

3
if [ ! -d _build ]; then
Stephane Glondu's avatar
Stephane Glondu committed
4
  echo "This script should be run from the root of the (built) source tree!"
5 6 7
  exit 1
fi

8 9
BELENIOS_RUNDIR=${BELENIOS_RUNDIR:-_run}
BELENIOS_TMPDIR=${BELENIOS_TMPDIR:-/tmp/belenios}
10
OCAML_STDLIBDIR=$(ocamlc -where)
11 12

mkdir -p \
13 14 15
  $BELENIOS_RUNDIR/etc \
  $BELENIOS_RUNDIR/log \
  $BELENIOS_RUNDIR/lib \
Stephane Glondu's avatar
Stephane Glondu committed
16
  $BELENIOS_RUNDIR/upload \
17
  $BELENIOS_RUNDIR/spool \
18
  $BELENIOS_TMPDIR/run
19

20
sed \
21
  -e "s@_OCAML_STDLIBDIR_@$OCAML_STDLIBDIR@g" \
22 23
  -e "s@_TMPDIR_@$BELENIOS_TMPDIR@g" \
  -e "s@_RUNDIR_@$BELENIOS_RUNDIR@g" \
24
  -e "s@_SRCDIR_@$PWD@g" \
Stephane Glondu's avatar
Stephane Glondu committed
25
  demo/ocsigenserver.conf.in > $BELENIOS_RUNDIR/etc/ocsigenserver.conf
26

27 28 29 30 31 32 33
OCSIGENSERVER=ocsigenserver

if command -v ocsigenserver.opt > /dev/null; then
  OCSIGENSERVER=ocsigenserver.opt
fi

exec $OCSIGENSERVER -c $BELENIOS_RUNDIR/etc/ocsigenserver.conf "$@"