-
Notifications
You must be signed in to change notification settings - Fork 3
/
gen_ocsigen_config
executable file
·98 lines (86 loc) · 2.84 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/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/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
stdlib_path=`ocamlfind ocamlc -where`
str_path=`ocamlfind query str`
nums_path="$stdlib_path"
pcre_path=`ocamlfind query pcre`
calendar_path=`ocamlfind query calendar`
extlib_path=`ocamlfind query extlib`
postgresql_path=`ocamlfind query postgresql`
sqlite3_path=`ocamlfind query sqlite3`
cryptokit_path=`ocamlfind query cryptokit`
# The way we find Ocsigen METAS directory is extremely hacky. I don't
# know of a better way. See issue 56 in
# http://code.google.com/p/nurpawiki/issues/list for more info.
ocsigen_metas_dir="`ocamlfind printconf stdlib`/../../ocsigen/METAS"
if [ "$DEBUG" != "" ]; then
echo $str_path
echo $pcre_path
echo $calendar_path
echo $extlib_path
echo $postgresql_path
echo $sqlite3_path
echo $ocsigen_metas_dir
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 ocsigen.conf.in | \
sed -e "s|%_OCSIGEN_ROOT_%|$OCSIGEN_ROOT|g" | \
sed -e "s|%_STR_CMA_%|${str_path}/str.cma|g" | \
sed -e "s|%_NUMS_CMA_%|${nums_path}/nums.cma|g" | \
sed -e "s|%_CALENDAR_CMA_%|${calendar_path}/calendarLib.cmo|g" | \
sed -e "s|%_PCRE_CMA_%|${pcre_path}/pcre.cma|g" | \
sed -e "s|%_EXTLIB_CMA_%|${extlib_path}/extLib.cma|g" | \
sed -e "s|%_POSTGRESQL_CMA_%|${postgresql_path}/postgresql.cma|g" | \
sed -e "s|%_CRYPTOKIT_CMA_%|${cryptokit_path}/cryptokit.cma|g" | \
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|%_SQLITE3_CMA_%|${sqlite3_path}/sqlite3.cma|g" | \
sed -e "s|%_OCSIGEN_METAS_DIR_%|${ocsigen_metas_dir}|g" | \
sed -e "s|%_DBUSER_%|${DBUSER}|g"