forked from nurpax/nurpawiki
-
Notifications
You must be signed in to change notification settings - Fork 1
/
gen_ocsigen_config
executable file
·62 lines (55 loc) · 1.55 KB
/
gen_ocsigen_config
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
#!/bin/sh
#------------------------------------------------------------------
# Configure OCaml library paths based on information queried from
# ocamlfind & command line and creates a configuration file for
# Ocsigen.
#------------------------------------------------------------------
set -e # Bail out on errors
site_cma="_build/src/nurpawiki.cma"
static_root="."
if [ -z $1 ]; then
true
else
if [ "$1" = "--godi-install" ]; then
site_cma=`ocamlfind query nurpawiki`/nurpawiki.cma
static_root="$LOCALBASE/share/nurpawiki"
else
echo Invalid args
exit 1
fi
fi
mkdir -p var/log
mkdir -p var/run
if [ "$DBNAME" = "" ]; then
echo
echo ERROR!
echo
echo DBNAME environment variable must be set to point to your nurpawiki DB
echo
exit 1
fi
if [ "$DBUSER" = "" ]; then
echo
echo ERROR!
echo
echo DBUSER environment variable must be set to your nurpawiki DB username
echo
exit 1
fi
if [ "$DBPASSWD" = "" ]; then
echo
echo ERROR!
echo
echo DBPASSWD environment variable must be set to your nurpawiki DB
echo postgres user password. See DB installation instructions for
echo more information on how to configure this.
echo
exit 1
fi
cat ocsigenserver.conf.in | \
sed -e "s|%_STATIC_ROOT_%|${static_root}|g" | \
sed -e "s|%_NURPAWIKI_CMA_%|${site_cma}|g" | \
sed -e "s|%_DBNAME_%|${DBNAME}|g" | \
sed -e "s|%_DBPASSWD_%|${DBPASSWD}|g" | \
sed -e "s|%_OCSIGEN_METAS_DIR_%|${ocsigen_metas_dir}|g" | \
sed -e "s|%_DBUSER_%|${DBUSER}|g"