From 602747a5132c1a7f4456cbad8f9bed73765856eb Mon Sep 17 00:00:00 2001 From: erickson Date: Wed, 6 Jul 2005 15:07:15 +0000 Subject: [PATCH 1/1] broke build into three parts - config, build, and install 'make' does config and build 'make install' does install git-svn-id: svn://svn.open-ils.org/ILS/trunk@1077 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Makefile | 7 ++++-- config.sh | 10 ++++++++ install.sh | 72 ++++++++++++++++++++++++++++++++++++++++-------------- 3 files changed, 69 insertions(+), 20 deletions(-) diff --git a/Makefile b/Makefile index 0447919c1a..f0f31e48ce 100644 --- a/Makefile +++ b/Makefile @@ -14,13 +14,16 @@ # GNU General Public License for more details. # -------------------------------------------------------------------- -all: config install +all: config build config: ./config.sh +build: + ./install.sh build + install: - ./install.sh + ./install.sh install clean: ./install.sh clean diff --git a/config.sh b/config.sh index a6fab55233..971c5cb765 100755 --- 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; diff --git a/install.sh b/install.sh index 3513170d9a..af632209af 100755 --- a/install.sh +++ b/install.sh @@ -74,26 +74,47 @@ function verifyInstallPaths { # -------------------------------------------------------------------- function mkInstallDirs { - mkdir -p "$PREFIX"; - if [ "$?" != "0" ]; then - fail "Error creating $PREFIX"; - fi + if installing; then - mkdir -p "$TMP"; - if [ "$?" != "0" ]; then - fail "Error creating $TMP"; - fi + mkdir -p "$PREFIX"; + if [ "$?" != "0" ]; then + fail "Error creating $PREFIX"; + fi + + if [ ! -w "$PREFIX" ]; then + fail "We don't have write access to $PREFIX"; + fi - if [ ! -w "$PREFIX" ]; then - fail "We don't have write access to $PREFIX"; fi - if [ ! -w "$TMP" ]; then - fail "We don't have write access to $TMP"; + if building; then + + mkdir -p "$TMP"; + if [ "$?" != "0" ]; then + fail "Error creating $TMP"; + fi + + if [ ! -w "$TMP" ]; then + fail "We don't have write access to $TMP"; + fi fi + + +} + +function installing { + if [ -z "$INSTALLING" ]; then return 1; fi; + return 0; +} + +function building { + if [ -z "$BUILDING" ]; then return 1; fi; + return 0; } + + # -------------------------------------------------------------------- # Loads the config file. If it can't fine CONFIG_FILE, it attempts to # use DEFAULT_CONFIG_FILE. If it can't find that, it fails. @@ -101,6 +122,7 @@ function mkInstallDirs { function loadConfig { if [ ! -f "$CONFIG_FILE" ]; then if [ -f "$DEFAULT_CONFIG_FILE" ]; then + echo "+ + + Copying $DEFAULT_CONFIG_FILE to $CONFIG_FILE and using its settings..."; cp "$DEFAULT_CONFIG_FILE" "$CONFIG_FILE"; else fail "config file \"$CONFIG_FILE\" cannot be found"; @@ -134,7 +156,10 @@ function runInstall { case "$target" in - "jserver" | "router" | "gateway" | "srfsh" ) $MAKE -C "$OPENSRF_DIR" "$target" "$target-install";; + "jserver" | "router" | "gateway" | "srfsh" ) + if building; then $MAKE -C "$OPENSRF_DIR" "$target"; fi; + if installing; then $MAKE -C "$OPENSRF_DIR" "$target-install"; fi; + ;; *) fail "Unknown target: $target";; @@ -161,24 +186,35 @@ function checkParams { case "$arg" in "clean") - make -C OpenSRF/src clean - make -C Open-ILS/src clean - make -C Evergreen/src clean;; + cleanMe;; "force") FORCE="1";; + "build") + BUILDING="1";; + + "install") + INSTALLING="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 + +function cleanMe { + loadConfig; + make -C "$OPENSRF_DIR" clean; + make -C "$OPENILS_DIR" clean; + make -C "$EVERGREEN_DIR" clean; +} + checkParams "$@"; +if installing; then echo "Installing..."; fi; # Kick it off... runInstall; -- 2.43.2