fixed some typos, logic errors
[Evergreen.git] / config.sh
index a6fab55..33f58a1 100755 (executable)
--- a/config.sh
+++ b/config.sh
@@ -26,6 +26,16 @@ DEFAULT_CONFIG_FILE="install.conf.default";
 
 function buildConfig {
 
+#      if [ -f "$CONFIG_FILE" ]; then
+#              echo "";
+#              echo "Using existing config file \"$CONFIG_FILE\""; 
+#              echo "To generate a new config, remove \"$CONFIG_FILE\"";
+#              echo "";
+#              sleep 3;        
+#              exit 0;
+#      fi
+
+
        if [ -f "$DEFAULT_CONFIG_FILE" ]; then
                source "$DEFAULT_CONFIG_FILE";
        fi;
@@ -36,53 +46,51 @@ function buildConfig {
        echo "Type Enter to select the default"
        echo "-----------------------------------------------------------------------";
 
-       prompt "Install prefix [$PREFIX] ";
-       read X;
-       if [ ! -z "$X" ]; then PREFIX="$X"; fi;
-
        prompt "Temporary files directory [$TMP] "
-       read X;
-       if [ ! -z "$X" ]; then TMP="$X"; fi;
+       read X; if [ ! -z "$X" ]; then TMP="$X"; fi;
 
-       prompt "Apache2 apxs binary [$APXS2] "
+       prompt "Install prefix [$PREFIX] ";
        read X;
-       if [ ! -z "$X" ]; then APXS2="$X"; fi;
+       if [ ! -z "$X" ]; then 
+               PREFIX="$X"; 
+               BINDIR="$PREFIX/bin/";
+               LIBDIR="$PREFIX/lib/";
+               PERLDIR="$LIBDIR/perl5/";
+               INCLUDEDIR="$PREFIX/include/";
+       fi
 
-       prompt "Apache2 headers directory [$APACHE2_HEADERS] "
-       read X;
-       if [ ! -z "$X" ]; then APACHE2_HEADERS="$X"; fi;
+       prompt "Executables directory [$BINDIR] "
+       read X; if [ ! -z "$X" ]; then BINDIR="$X"; fi;
 
-       prompt "Libxml2 headers directory [$LIBXML2_HEADERS] "
-       read X;
-       if [ ! -z "$X" ]; then LIBXML2_HEADERS="$X"; fi;
+       prompt "Lib directory [$LIBDIR] "
+       read X; if [ ! -z "$X" ]; then LIBDIR="$X"; fi;
 
-       prompt "Build targets [${TARGETS[@]:0}] "
-       read X;
-       if [ ! -z "$X" ]; then TARGETS=("$X"); fi;
+       prompt "Perl directory [$PERLDIR] "
+       read X; if [ ! -z "$X" ]; then PERLDIR="$X"; fi;
 
+       prompt "Include files directory [$INCLUDEDIR] "
+       read X; if [ ! -z "$X" ]; then INCLUDEDIR="$X"; fi;
 
-       cat <<-WORDS
+       prompt "Config files directory [$ETCDIR] "
+       read X; if [ ! -z "$X" ]; then ETCDIR="$X"; fi;
 
-       -----------------------------------------------------------------------
-       Verify the following install directories are sane.
-       Note: * indicates that you must have write privelages for the location
-       -----------------------------------------------------------------------
+       prompt "Web Root Directory [$WEBDIR] "
+       read X; if [ ! -z "$X" ]; then WEBDIR="$X"; fi;
 
-       -----------------------------------------------------------------------
-       Install prefix             [$PREFIX]*
-       Temporary files directory  [$TMP]*
-       Apache2 apxs binary        [$APXS2]
-       Apache2 headers directory  [$APACHE2_HEADERS]
-       Libxml2 headers directory  [$LIBXML2_HEADERS]
-       Build targets              [${TARGETS[@]:0}]
-       -----------------------------------------------------------------------
+       prompt "Templates directory [$TEMPLATEDIR] "
+       read X; if [ ! -z "$X" ]; then TEMPLATEDIR="$X"; fi;
 
-       If these are not OK, use control-c to break out rerun this script.
-       Otherwise, type enter.
+       prompt "Apache2 apxs binary [$APXS2] "
+       read X; if [ ! -z "$X" ]; then APXS2="$X"; fi;
 
-       WORDS
+       prompt "Apache2 headers directory [$APACHE2_HEADERS] "
+       read X; if [ ! -z "$X" ]; then APACHE2_HEADERS="$X"; fi;
 
-       read OK;
+       prompt "Libxml2 headers directory [$LIBXML2_HEADERS] "
+       read X; if [ ! -z "$X" ]; then LIBXML2_HEADERS="$X"; fi;
+
+       prompt "Build targets [${TARGETS[@]:0}] "
+       read X; if [ ! -z "$X" ]; then TARGETS=("$X"); fi;
 
        writeConfig;
 }
@@ -95,11 +103,19 @@ function writeConfig {
        echo "Writing config to $CONFIG_FILE...";
 
        _write "PREFIX=\"$PREFIX\"";
+       _write "BINDIR=\"$BINDIR\"";
+       _write "LIBDIR=\"$LIBDIR\"";
+       _write "PERLDIR=\"$PERLDIR\"";
+       _write "INCLUDEDIR=\"$INCLUDEDIR\"";
+
        _write "TMP=\"$TMP\"";
        _write "APXS2=\"$APXS2\"";
        _write "APACHE2_HEADERS=\"$APACHE2_HEADERS\"";
        _write "LIBXML2_HEADERS=\"$LIBXML2_HEADERS\"";
 
+       _write "WEBDIR=\"$WEBDIR\"";
+       _write "TEMPLATEDIR=\"$TEMPLATEDIR\"";
+
        # print out the targets
        STR="TARGETS=(";
        for target in ${TARGETS[@]:0}; do
@@ -112,6 +128,9 @@ function writeConfig {
        _write "OPENILS_DIR=\"Open-ILS/src/\"";
        _write "EVERGREEN_DIR=\"Evergreen/\"";
 
+       prompt "To write a new config, run 'make config'";
+       prompt "";
+
 }
 
 function _write {