-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.savane
executable file
·231 lines (199 loc) · 7.35 KB
/
configure.savane
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
#!/bin/sh
# Default bootstrap configuration
# <http://gna.org/projects/savane/>
#
# $Id$
#
# Copyright 2002-2006 (c) Mathieu Roy <[email protected]>
# Lutz Behnke <[email protected]>
# Copyright (C) 2007 Sylvain Beucler
#
# The Savane project is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# The Savane project is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with the Savane project; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
########################## CHECKS ##################################
BLOCKER_ITEM_LIST="make bash perl sed find gettext"
for item in $BLOCKER_ITEM_LIST; do
echo -n "checking for $item... "
bin_item=`which $item 2>&1`
if [ ! -x "$bin_item" ]; then echo "no" \
&& echo "Error: Unable to find $item. Please check your installation." && \
exit ; else echo "yes" ; fi
done
# Non-blocker
item=mysql
echo -n "checking for $item... "
item=`which $item`
# no other db support = blocker
if [ ! -x "$item" ]; then
echo "no"
SV_DB=no
SV_DB_CMD=""
else
echo "yes"
SV_DB=`basename $item`
SV_DB_CMD=$SV_DB
fi
# Distro
item="GNU/Linux distribution"
echo -n "checking for $item... "
if [ -e "/etc/debian_version" ]; then
# Debian-based
GUESS_WWW_SERVER_USER="www-data"
GUESS_PERL_INC="/usr/lib/perl5"
elif [ -e "/etc/redhat-release" ]; then
# Fedora- or RedHat-based
GUESS_WWW_SERVER_USER="apache"
GUESS_PERL_INC="/usr/lib/perl5/site_perl"
elif [ -e "/etc/gentoo-release" ]; then
# Gentoo-based
GUESS_WWW_SERVER_USER="apache"
elif [ -e "/etc/slackware-version" ]; then
# Slackware-based"
GUESS_WWW_SERVER_USER="nobody"
fi
# TODO: ps aux | grep -E 'http|apache' | parse_uid_field...
########################## USER INPUT ##################################
if [ -e configure.cache ]; then
. configure.cache
else
echo " "
echo "Do you want the configuration file creation process to be interactive?"
echo "ex: yes"
echo "ex: no"
echo -n "[yes]: "
read SV_CONF_INTERACTIVE
if [ "$SV_CONF_INTERACTIVE" = "" ]; then SV_CONF_INTERACTIVE=yes ; fi
# TODO: --with-apache-user=XXX or something
if [ "$GUESS_WWW_SERVER_USER" = "" ]; then
echo " "
echo "Default web server username? "
echo "ex: www"
echo "ex: apache "
echo -n "[$GUESS_WWW_SERVER_USER]"
read WWW_SERVER_USER
if [ "$WWW_SERVER_USER" = "" ]; then WWW_SERVER_USER=$GUESS_WWW_SERVER_USER;fi
fi
# TODO: use --prefix, --sysconfdir...
SV_CONF=/etc/savane
echo " "
echo "Where should we install binaries and scripts?"
echo "ex: /usr/bin"
echo "ex: /usr/local/bin"
echo -n "[/usr/local/bin]: "
read SV_BIN
if [ "$SV_BIN" = "" ]; then SV_BIN=/usr/local/bin ; fi
if [ "$SV_DB" = "no" ]; then
echo " "
echo "No supported database system has been found. Please choose one below:"
echo -n "[mysql]: "
read SV_DB
if [ "$SV_DB" = "" ] ; then SV_DB=mysql && SV_DB_CMD=$SV_DB ; fi
fi
if [ "$SV_DB_CMD" = "" ]; then
echo " "
echo "Cannot not find the command for the $SV_DB Database in the path"
echo -n "[]: "
read SV_DB_CMD
fi
if [ "$PERL_INC" = "" ]; then
echo " "
echo "Where should we install perl modules?"
echo "ex: /usr/lib/perl5/site_perl"
echo "ex: /usr/lib/perl5"
echo "ex: /usr/local/lib/site_perl"
echo -n "[/usr/local/lib/site_perl]: "
read PERL_INC
if [ "$PERL_INC" = "" ]; then PERL_INC=/usr/local/lib/site_perl ; fi
fi
# Without a call to bindtextdomain(), gettext() will search in
# libintl's default LOCALEDIR, which is set at compile time. The
# most common case is:
# $datadir/locale = $prefix/share/locale = /usr/share/locale
# However we could run on a PHP+gettext compiled with, say,
# prefix=/usr/local; that's why the gettext documentation
# recommends to always use bindtextdomain() at application
# initialization, using the app's LOCALEDIR (and not
# libintl's). This also avoid messing with /usr when installing
# in /usr/local.
# Check <gettext-source>/gettext-tools/examples/hello-php/ for an
# autoconf example. One solution is autoconfiscating the PHP app
# to set @localedir@; another is to use the configuration file,
# and default to gettext's default path (ie. don't call
# bindtextdomain is $sys_localedir is empty).
# We still need this variable for the .po Makefile. For that part
# (PO), let's use autoconf.
INSTALLNLSDIR=/usr/share/locale
# echo " "
# echo "Where should we install i18n files?"
# echo "ex: /usr/share/locale"
# echo "ex: /usr/local/share/locale"
# echo -n "[/usr/share/locale]: "
# read INSTALLNLSDIR
# if [ "$INSTALLNLSDIR" = "" ]; then INSTALLNLSDIR=/usr/share/locale ; fi
echo " "
echo "What is the database name?"
echo "ex: savane"
echo -n "[savane]: "
read SV_DB_NAME
if [ "$SV_DB_NAME" = "" ]; then SV_DB_NAME=savane ; fi
echo " "
echo "Any options to use for $DB?"
echo "ex: you may add for mysql, if you do not have a ~/.my.cnf"
echo "something like -u user -p"
echo "(never include password in clear text here)"
echo -n "options: "
read SV_DB_OPTIONS
fi
# Checks: var that cannot be empty
if [ ! $SV_CONF_INTERACTIVE ]; then
SV_CONF_INTERACTIVE=yes
fi
########################## GENERATE MAKEFILES ###############################
echo " "
for mkfile in `find . -name "Makefile.in"` ; do
mkfileo=`basename $mkfile .in`
mkfiled=`dirname $mkfile`
echo "creating $mkfiled/$mkfileo..."
echo "SV_CONF=$SV_CONF" >> $mkfiled/$mkfileo
echo "SV_CONF_INTERACTIVE=$SV_CONF_INTERACTIVE" >> $mkfiled/$mkfileo
echo "SV_BIN=$SV_BIN" >> $mkfiled/$mkfileo
echo "PERL_INC=$PERL_INC" >> $mkfiled/$mkfileo
echo "INSTALLNLSDIR=$INSTALLNLSDIR" >> $mkfiled/$mkfileo
echo "SV_URLROOT=$SV_URLROOT" >> $mkfiled/$mkfileo
echo "SV_DB=$SV_DB" >> $mkfiled/$mkfileo
echo "SV_DB_NAME=$SV_DB_NAME" >> $mkfiled/$mkfileo
echo "SV_DB_CMD=$SV_DB_CMD" >> $mkfiled/$mkfileo
echo "SV_DB_OPTIONS=$SV_DB_OPTIONS" >> $mkfiled/$mkfileo
echo "WWW_SERVER_USER=$WWW_SERVER_USER" >> $mkfiled/$mkfileo
echo " " >> $mkfiled/$mkfileo
cat $mkfile >> $mkfiled/$mkfileo
done
mkfileo=configure.cache
echo "SV_CONF=$SV_CONF" >> $mkfileo
echo "SV_CONF_INTERACTIVE=$SV_CONF_INTERACTIVE" >> $mkfileo
echo "SV_BIN=$SV_BIN" >> $mkfileo
echo "PERL_INC=$PERL_INC" >> $mkfileo
echo "INSTALLNLSDIR=$INSTALLNLSDIR" >> $mkfileo
echo "SV_URLROOT=$SV_URLROOT" >> $mkfileo
echo "SV_DB=$SV_DB" >> $mkfileo
echo "SV_DB_NAME=$SV_DB_NAME" >> $mkfileo
echo "SV_DB_CMD=$SV_DB_CMD" >> $mkfileo
echo "SV_DB_OPTIONS=\"$SV_DB_OPTIONS\"" >> $mkfileo
echo "WWW_SERVER_USER=$WWW_SERVER_USER" >> $mkfileo
########################## SHOW HELP ###############################
echo " "
echo "Now, you should continue by doing the following:"
url=${SV_URLROOT%/}
sed -e 's,\.\/configure,,g' -e "s,/pathtosavane,$url," INSTALL
# EOF