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 # --------------------------------------------------------------------
20 # --------------------------------------------------------------------
21 CONFIG_FILE="install.conf";
22 DEFAULT_CONFIG_FILE="install.conf.default";
25 # --------------------------------------------------------------------
26 # Loads all of the path information from the user setting
27 # install variables as it goes
28 # --------------------------------------------------------------------
32 echo "A build error occured: $MSG";
37 function verifyInstallPaths {
41 -----------------------------------------------------------------------
42 Verify the following install directories are sane.
43 Note: * indicates that you must have write privelages for the location
44 -----------------------------------------------------------------------
46 -----------------------------------------------------------------------
47 Install prefix [$PREFIX]*
48 Temporary files directory [$TMP]*
49 Apache2 apxs binary [$APXS2]
50 Apache2 header directory [$APACHE2_HEADERS]
51 Libxml2 header directory [$LIBXML2_HEADERS]
52 Building targets [${TARGETS[@]:0}];
53 -----------------------------------------------------------------------
55 If these are not OK, use control-c to break out and fix the variables
56 in install.config. Otherwise, type enter.
58 To disable this message, run "./install.sh force".
64 #function postMessage {
67 # --------------------------------------------------------------------
72 # --------------------------------------------------------------------
73 # Makes sure the install directories exist and are writable
74 # --------------------------------------------------------------------
75 function mkInstallDirs {
78 if [ "$?" != "0" ]; then
79 fail "Error creating $PREFIX";
83 if [ "$?" != "0" ]; then
84 fail "Error creating $TMP";
87 if [ ! -w "$PREFIX" ]; then
88 fail "We don't have write access to $PREFIX";
91 if [ ! -w "$TMP" ]; then
92 fail "We don't have write access to $TMP";
97 # --------------------------------------------------------------------
98 # Loads the config file. If it can't fine CONFIG_FILE, it attempts to
99 # use DEFAULT_CONFIG_FILE. If it can't find that, it fails.
100 # --------------------------------------------------------------------
101 function loadConfig {
102 if [ ! -f "$CONFIG_FILE" ]; then
103 if [ -f "$DEFAULT_CONFIG_FILE" ]; then
104 cp "$DEFAULT_CONFIG_FILE" "$CONFIG_FILE";
106 fail "config file \"$CONFIG_FILE\" cannot be found";
109 source "$CONFIG_FILE";
113 function runInstall {
117 #[ -z "$FORCE" ] && verifyInstallPaths;
120 # pass the collected variables to make
121 for target in ${TARGETS[@]:0}; do
125 --------------------------------------------------------------------
127 --------------------------------------------------------------------
131 MAKE="make APXS2=$APXS2 PREFIX=$PREFIX TMP=$TMP APACHE2_HEADERS=$APACHE2_HEADERS LIBXML2_HEADERS=$LIBXML2_HEADERS";
133 echo "Passing to sub-makes: $VARS"
137 "jserver" | "router" | "gateway" | "srfsh" ) $MAKE -C "$OPENSRF_DIR" "$target" "$target-install";;
139 *) fail "Unknown target: $target";;
147 # --------------------------------------------------------------------
148 # Checks command line parameters for special behavior
149 # Supported params are:
150 # clean - cleans all build files
151 # force - forces build without the initial message
152 # --------------------------------------------------------------------
153 function checkParams {
155 if [ -z "$1" ]; then return; fi;
164 make -C OpenSRF/src clean
165 make -C Open-ILS/src clean
166 make -C Evergreen/src clean;;
171 *) fail "Unknown command line argument: $arg";;
175 echo "LAST $lastArg";
176 if [ "$lastArg" = "clean" ]; then exit 0; fi;
179 # if user passes in the word 'clean' as the first shell arg, clean all