2 # --------------------------------------------------------------------
3 # Copyright (C) 2005 Georgia Public Library Service
4 # Bill Erickson <highfalutin@gmail.com>
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License
8 # as published by the Free Software Foundation; either version 2
9 # of the License, or (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15 # --------------------------------------------------------------------
18 # --------------------------------------------------------------------
19 # Prompts the user for config settings and writes a custom config
20 # file based on these settings
21 # --------------------------------------------------------------------
24 CONFIG_FILE="install.conf";
25 DEFAULT_CONFIG_FILE="install.conf.default";
27 function buildConfig {
29 # if [ -f "$CONFIG_FILE" ]; then
31 # echo "Using existing config file \"$CONFIG_FILE\"";
32 # echo "To generate a new config, remove \"$CONFIG_FILE\"";
39 if [ -f "$DEFAULT_CONFIG_FILE" ]; then
40 source "$DEFAULT_CONFIG_FILE";
45 echo "-----------------------------------------------------------------------";
46 echo "Type Enter to select the default"
47 echo "-----------------------------------------------------------------------";
49 prompt "Install prefix [$PREFIX] ";
51 if [ ! -z "$X" ]; then
53 BINDIR="$PREFIX/bin/";
54 LIBDIR="$PREFIX/lib/";
55 PERLDIR="$LIBDIR/perl5/";
56 INCLUDEDIR="$PREFIX/include/";
59 prompt "Executables directory [$BINDIR] "
61 if [ ! -z "$X" ]; then BINDIR="$X"; fi;
63 prompt "Lib directory [$LIBDIR] "
65 if [ ! -z "$X" ]; then LIBDIR="$X"; fi;
67 prompt "Perl directory [$PERLDIR] "
69 if [ ! -z "$X" ]; then PERLDIR="$X"; fi;
71 prompt "Include files directory [$INCLUDEDIR] "
73 if [ ! -z "$X" ]; then INCLUDEDIR="$X"; fi;
75 prompt "Config files directory [$ETCDIR] "
77 if [ ! -z "$X" ]; then ETCDIR="$X"; fi;
79 prompt "Temporary files directory [$TMP] "
81 if [ ! -z "$X" ]; then TMP="$X"; fi;
83 prompt "Apache2 apxs binary [$APXS2] "
85 if [ ! -z "$X" ]; then APXS2="$X"; fi;
87 prompt "Apache2 headers directory [$APACHE2_HEADERS] "
89 if [ ! -z "$X" ]; then APACHE2_HEADERS="$X"; fi;
91 prompt "Libxml2 headers directory [$LIBXML2_HEADERS] "
93 if [ ! -z "$X" ]; then LIBXML2_HEADERS="$X"; fi;
95 prompt "Build targets [${TARGETS[@]:0}] "
97 if [ ! -z "$X" ]; then TARGETS=("$X"); fi;
102 -----------------------------------------------------------------------
103 Verify the following install directories are sane.
104 Note: * indicates that you must have write privelages for the location
105 -----------------------------------------------------------------------
107 -----------------------------------------------------------------------
108 Install prefix [$PREFIX]*
109 Temporary files directory [$TMP]*
110 Apache2 apxs binary [$APXS2]
111 Apache2 headers directory [$APACHE2_HEADERS]
112 Libxml2 headers directory [$LIBXML2_HEADERS]
113 Build targets [${TARGETS[@]:0}]
114 -----------------------------------------------------------------------
116 If these are not OK, use control-c to break out rerun this script.
117 Otherwise, type enter.
126 function prompt { echo ""; echo -n "$*"; }
128 function writeConfig {
130 rm -f "$CONFIG_FILE";
131 echo "Writing config to $CONFIG_FILE...";
133 _write "PREFIX=\"$PREFIX\"";
134 _write "BINDIR=\"$BINDIR\"";
135 _write "LIBDIR=\"$LIBDIR\"";
136 _write "PERLDIR=\"$PERLDIR\"";
137 _write "INCLUDEDIR=\"$INCLUDEDIR\"";
139 _write "TMP=\"$TMP\"";
140 _write "APXS2=\"$APXS2\"";
141 _write "APACHE2_HEADERS=\"$APACHE2_HEADERS\"";
142 _write "LIBXML2_HEADERS=\"$LIBXML2_HEADERS\"";
144 # print out the targets
146 for target in ${TARGETS[@]:0}; do
147 STR="$STR \"$target\"";
152 _write "OPENSRF_DIR=\"OpenSRF/src/\"";
153 _write "OPENILS_DIR=\"Open-ILS/src/\"";
154 _write "EVERGREEN_DIR=\"Evergreen/\"";
159 echo "$*" >> "$CONFIG_FILE";