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 "$DEFAULT_CONFIG_FILE" ]; then
30 source "$DEFAULT_CONFIG_FILE";
35 echo "-----------------------------------------------------------------------";
36 echo "Type Enter to select the default"
37 echo "-----------------------------------------------------------------------";
39 prompt "Install prefix [$PREFIX] ";
41 if [ ! -z "$X" ]; then PREFIX="$X"; fi;
43 prompt "Temporary files directory [$TMP] "
45 if [ ! -z "$X" ]; then TMP="$X"; fi;
47 prompt "Apache2 apxs binary [$APXS2] "
49 if [ ! -z "$X" ]; then APXS2="$X"; fi;
51 prompt "Apache2 headers directory [$APACHE2_HEADERS] "
53 if [ ! -z "$X" ]; then APACHE2_HEADERS="$X"; fi;
55 prompt "Libxml2 headers directory [$LIBXML2_HEADERS] "
57 if [ ! -z "$X" ]; then LIBXML2_HEADERS="$X"; fi;
59 prompt "Build targets [${TARGETS[@]:0}] "
61 if [ ! -z "$X" ]; then TARGETS=("$X"); fi;
66 -----------------------------------------------------------------------
67 Verify the following install directories are sane.
68 Note: * indicates that you must have write privelages for the location
69 -----------------------------------------------------------------------
71 -----------------------------------------------------------------------
72 Install prefix [$PREFIX]*
73 Temporary files directory [$TMP]*
74 Apache2 apxs binary [$APXS2]
75 Apache2 headers directory [$APACHE2_HEADERS]
76 Libxml2 headers directory [$LIBXML2_HEADERS]
77 Build targets [${TARGETS[@]:0}]
78 -----------------------------------------------------------------------
80 If these are not OK, use control-c to break out rerun this script.
81 Otherwise, type enter.
90 function prompt { echo ""; echo -n "$*"; }
92 function writeConfig {
95 echo "Writing config to $CONFIG_FILE...";
97 _write "PREFIX=\"$PREFIX\"";
98 _write "TMP=\"$TMP\"";
99 _write "APXS2=\"$APXS2\"";
100 _write "APACHE2_HEADERS=\"$APACHE2_HEADERS\"";
101 _write "LIBXML2_HEADERS=\"$LIBXML2_HEADERS\"";
103 # print out the targets
105 for target in ${TARGETS[@]:0}; do
106 STR="$STR \"$target\"";
111 _write "OPENSRF_DIR=\"OpenSRF/src/\"";
112 _write "OPENILS_DIR=\"Open-ILS/src/\"";
113 _write "EVERGREEN_DIR=\"Evergreen/\"";
118 echo "$*" >> "$CONFIG_FILE";