more install goodness
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 6 Jul 2005 14:45:37 +0000 (14:45 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 6 Jul 2005 14:45:37 +0000 (14:45 +0000)
now 'make' runs config.sh and install.sh
make config runs config.sh
make install runs install.sh
make clean runs install.sh clean

git-svn-id: svn://svn.open-ils.org/ILS/trunk@1075 dcc99617-32d9-48b4-a31d-7c20da2025e4

Makefile [new file with mode: 0644]
config.sh [new file with mode: 0755]
install.conf.default
install.sh

diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..0447919
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,27 @@
+#!/bin/bash
+# --------------------------------------------------------------------
+# Copyright (C) 2005  Georgia Public Library Service 
+# Bill Erickson <highfalutin@gmail.com>
+#
+# This program 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.
+#
+# This program 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.
+# --------------------------------------------------------------------
+
+all:   config install
+
+config:
+       ./config.sh
+
+install:
+       ./install.sh
+
+clean:
+       ./install.sh clean
+       
diff --git a/config.sh b/config.sh
new file mode 100755 (executable)
index 0000000..6b4cdfe
--- /dev/null
+++ b/config.sh
@@ -0,0 +1,117 @@
+#!/bin/bash
+# --------------------------------------------------------------------
+# Copyright (C) 2005  Georgia Public Library Service 
+# Bill Erickson <highfalutin@gmail.com>
+#
+# This program 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.
+#
+# This program 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.
+# --------------------------------------------------------------------
+
+
+CONFIG_FILE="install.conf";
+DEFAULT_CONFIG_FILE="install.conf.default";
+
+function buildConfig {
+
+       if [ -f "$DEFAULT_CONFIG_FILE" ]; then
+               source "$DEFAULT_CONFIG_FILE";
+       fi;
+
+
+       echo "";
+       echo "-----------------------------------------------------------------------";
+       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;
+
+       prompt "Apache2 apxs binary [$APXS2] "
+       read X;
+       if [ ! -z "$X" ]; then APXS2="$X"; fi;
+
+       prompt "Apache2 headers directory [$APACHE2_HEADERS] "
+       read X;
+       if [ ! -z "$X" ]; then APACHE2_HEADERS="$X"; fi;
+
+       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;
+
+
+       cat <<-WORDS
+
+       -----------------------------------------------------------------------
+       Verify the following install directories are sane.
+       Note: * indicates that you must have write privelages for the location
+       -----------------------------------------------------------------------
+
+       -----------------------------------------------------------------------
+       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}]
+       -----------------------------------------------------------------------
+
+       If these are not OK, use control-c to break out rerun this script.
+       Otherwise, type enter.
+
+       WORDS
+
+       read OK;
+
+       writeConfig;
+}
+
+function prompt { echo ""; echo -n "$*"; }
+
+function writeConfig {
+
+       rm -f "$CONFIG_FILE";
+       echo "Writing config to $CONFIG_FILE...";
+
+       _write "PREFIX=\"$PREFIX\"";
+       _write "TMP=\"$TMP\"";
+       _write "APXS2=\"$APXS2\"";
+       _write "APACHE2_HEADERS=\"$APACHE2_HEADERS\"";
+       _write "LIBXML2_HEADERS=\"$LIBXML2_HEADERS\"";
+
+       # print out the targets
+       STR="TARGETS=(";
+       for target in ${TARGETS[@]:0}; do
+               STR="$STR \"$target\"";
+       done;
+       STR="$STR)";
+       _write "$STR";
+
+       _write "OPENSRF_DIR=\"OpenSRF/src/\"";
+       _write "OPENILS_DIR=\"Open-ILS/src/\"";
+       _write "EVERGREEN_DIR=\"Evergreen/\"";
+
+}
+
+function _write {
+       echo "$*" >> "$CONFIG_FILE";
+}
+
+
+
+buildConfig;
index a16f36a..83c34d1 100644 (file)
@@ -1,3 +1,21 @@
+#!/bin/bash
+# --------------------------------------------------------------------
+# Copyright (C) 2005  Georgia Public Library Service 
+# Bill Erickson <highfalutin@gmail.com>
+#
+# This program 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.
+#
+# This program 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.
+# --------------------------------------------------------------------
+
+
+
 # --------------------------------------------------------------------
 # Build targets.  Options include:
 # 
@@ -25,14 +43,14 @@ TARGETS=("router" "gateway" "jserver" "srfsh");
 # running install.sh must have write permissions to PREFIX
 # --------------------------------------------------------------------
 #PREFIX="/tmp/testinstall/";
-PREFIX="/pines/";
+PREFIX="/tmp/ilsinstall/";
 
 
 # --------------------------------------------------------------------
 # Temporary build files go here.  The User running install.sh must
 # have write permissions to TMP
 # --------------------------------------------------------------------
-TMP="/tmp/ilsinstall/";
+TMP="/tmp/ilstmp/";
 
 
 # --------------------------------------------------------------------
@@ -66,3 +84,4 @@ LIBXML2_HEADERS="/usr/include/libxml2/";
 OPENSRF_DIR="OpenSRF/src/";
 OPENILS_DIR="Open-ILS/src/";
 EVERGREEN_DIR="Evergreen/";
+
index 219e43d..3513170 100755 (executable)
@@ -100,10 +100,11 @@ function mkInstallDirs {
 # --------------------------------------------------------------------
 function loadConfig {
        if [ ! -f "$CONFIG_FILE" ]; then
-               if [ -f "$DEFAULT_CONFIG_FILE" ];
-                       $CONFIG_FILE="$DEFAULT_CONFIG_FILE";
+               if [ -f "$DEFAULT_CONFIG_FILE" ]; then
+                       cp "$DEFAULT_CONFIG_FILE" "$CONFIG_FILE";
                else
                        fail "config file \"$CONFIG_FILE\" cannot be found";
+               fi
        fi
        source "$CONFIG_FILE";
 }
@@ -113,7 +114,7 @@ function runInstall {
 
 
        loadConfig;
-       [ ! -z "$NOFORCE" ] && verifyInstallPaths;
+       #[ -z "$FORCE" ] && verifyInstallPaths;
        mkInstallDirs;
 
        # pass the collected variables to make
@@ -153,27 +154,30 @@ function checkParams {
 
        if [ -z "$1" ]; then return; fi;
 
-       for arg in "$*"; do
+       for arg in "$@"; do
+
+               lastArg="$arg";
 
                case "$arg" in
 
                        "clean") 
                                make -C OpenSRF/src clean
                                make -C Open-ILS/src clean
-                               make -C Evergreen/src clean
-                               exit 0;;
+                               make -C Evergreen/src clean;;
 
                        "force")
                                FORCE="1";;
 
                        *) fail "Unknown command line argument: $arg";;
                esac
-
        done
+
+       echo "LAST $lastArg";
+       if [ "$lastArg" = "clean" ]; then exit 0; fi;
 }
 
 # if user passes in the word 'clean' as the first shell arg, clean all
-checkParams "$*";
+checkParams "$@";
 
 
 # Kick it off...